@mastra/core 0.9.3-alpha.0 → 0.9.3

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 (133) hide show
  1. package/dist/agent/index.cjs +2 -2
  2. package/dist/agent/index.d.cts +2 -2
  3. package/dist/agent/index.d.ts +2 -2
  4. package/dist/agent/index.js +1 -1
  5. package/dist/{base-CzHSMvOb.d.ts → base-BCnFhShR.d.ts} +27 -7
  6. package/dist/{base-DT2poiVK.d.ts → base-CeEVvwRi.d.ts} +2 -2
  7. package/dist/{base-BihKcqDY.d.cts → base-D9APQt4V.d.cts} +2 -2
  8. package/dist/{base-Cs0ddGCf.d.cts → base-VMWGZau0.d.cts} +27 -7
  9. package/dist/base.cjs +2 -2
  10. package/dist/base.d.cts +1 -1
  11. package/dist/base.d.ts +1 -1
  12. package/dist/base.js +1 -1
  13. package/dist/bundler/index.cjs +2 -2
  14. package/dist/bundler/index.d.cts +1 -1
  15. package/dist/bundler/index.d.ts +1 -1
  16. package/dist/bundler/index.js +1 -1
  17. package/dist/{chunk-WYL4MKWH.cjs → chunk-2PLTE53B.cjs} +37 -27
  18. package/dist/{chunk-QJJD56YR.cjs → chunk-37HZ77Z5.cjs} +13 -12
  19. package/dist/{chunk-JSKASUR2.cjs → chunk-5ENQX4BI.cjs} +9 -9
  20. package/dist/{chunk-RZCYBC7D.cjs → chunk-6NUAJ6AB.cjs} +2 -2
  21. package/dist/{chunk-O6EYGXZO.cjs → chunk-6YITFTRU.cjs} +2 -2
  22. package/dist/{chunk-KWYJUFY3.js → chunk-BFNYQFG2.js} +80 -55
  23. package/dist/chunk-BMSBIZKD.cjs +72 -0
  24. package/dist/{chunk-MNGIRRFY.js → chunk-CPONI4EX.js} +1 -1
  25. package/dist/{chunk-WAW7QBY4.cjs → chunk-CRHH7KRS.cjs} +2 -2
  26. package/dist/{chunk-5TFGORLG.js → chunk-DWD7X4KB.js} +1 -1
  27. package/dist/{chunk-PPNVAI5G.js → chunk-EYMLOJ2Q.js} +6 -5
  28. package/dist/{chunk-Q6Z2YS6I.js → chunk-FVYYXFPR.js} +2 -2
  29. package/dist/{chunk-OHIRECYU.cjs → chunk-FXAV2WYX.cjs} +3 -3
  30. package/dist/{chunk-ZZRFVSYZ.cjs → chunk-GUMHVPHG.cjs} +4 -4
  31. package/dist/{chunk-2ZK5VAXE.js → chunk-IKZWOULI.js} +2 -2
  32. package/dist/{chunk-T3UZONPQ.cjs → chunk-ITFMXU6H.cjs} +2 -2
  33. package/dist/{chunk-TZIOJX3N.js → chunk-JCBDQUQY.js} +1 -1
  34. package/dist/{chunk-2UAN6SRJ.js → chunk-KPOUHZFJ.js} +2 -2
  35. package/dist/{chunk-POEYDVX7.cjs → chunk-KXWR3FNX.cjs} +4 -4
  36. package/dist/{chunk-CLJQYXNM.js → chunk-NDAW47QQ.js} +6 -2
  37. package/dist/{chunk-XNBNJEES.cjs → chunk-OGNJRWRQ.cjs} +2 -2
  38. package/dist/chunk-Q6ZDDQOB.js +70 -0
  39. package/dist/{chunk-7IAP7VPO.js → chunk-QFJY3MEL.js} +2 -2
  40. package/dist/{chunk-4DEDPTLO.cjs → chunk-QQFFJTJ4.cjs} +2 -2
  41. package/dist/{chunk-47NGQPZI.js → chunk-R652KYQW.js} +1 -1
  42. package/dist/{chunk-FXUTMNQG.cjs → chunk-RE5MNHDE.cjs} +2 -2
  43. package/dist/{chunk-D63P5O4Q.cjs → chunk-RO52JMKQ.cjs} +6 -2
  44. package/dist/{chunk-6HHSM7FP.js → chunk-SONEVGEJ.js} +1 -1
  45. package/dist/{chunk-52SRR7WR.js → chunk-T5V4W7WU.js} +1 -1
  46. package/dist/{chunk-GHK3HBWN.js → chunk-TCL7XDJL.js} +1 -1
  47. package/dist/{chunk-MYHX5XVW.cjs → chunk-UVRGQEMD.cjs} +79 -53
  48. package/dist/{chunk-KSH5B376.js → chunk-XYP6MY7U.js} +22 -12
  49. package/dist/{chunk-22CFFDPA.cjs → chunk-ZMMZXEOL.cjs} +7 -7
  50. package/dist/{chunk-WD3HYQV3.js → chunk-ZQ7FXUGY.js} +1 -1
  51. package/dist/deployer/index.cjs +2 -2
  52. package/dist/deployer/index.d.cts +1 -1
  53. package/dist/deployer/index.d.ts +1 -1
  54. package/dist/deployer/index.js +1 -1
  55. package/dist/eval/index.d.cts +2 -2
  56. package/dist/eval/index.d.ts +2 -2
  57. package/dist/index.cjs +70 -66
  58. package/dist/index.d.cts +5 -5
  59. package/dist/index.d.ts +5 -5
  60. package/dist/index.js +15 -15
  61. package/dist/integration/index.cjs +3 -3
  62. package/dist/integration/index.d.cts +2 -2
  63. package/dist/integration/index.d.ts +2 -2
  64. package/dist/integration/index.js +1 -1
  65. package/dist/llm/index.d.cts +2 -2
  66. package/dist/llm/index.d.ts +2 -2
  67. package/dist/mastra/index.cjs +2 -2
  68. package/dist/mastra/index.d.cts +2 -2
  69. package/dist/mastra/index.d.ts +2 -2
  70. package/dist/mastra/index.js +1 -1
  71. package/dist/memory/index.cjs +4 -4
  72. package/dist/memory/index.d.cts +2 -2
  73. package/dist/memory/index.d.ts +2 -2
  74. package/dist/memory/index.js +1 -1
  75. package/dist/network/index.cjs +6 -6
  76. package/dist/network/index.d.cts +2 -2
  77. package/dist/network/index.d.ts +2 -2
  78. package/dist/network/index.js +3 -3
  79. package/dist/relevance/index.cjs +4 -4
  80. package/dist/relevance/index.d.cts +2 -2
  81. package/dist/relevance/index.d.ts +2 -2
  82. package/dist/relevance/index.js +1 -1
  83. package/dist/server/index.cjs +1 -0
  84. package/dist/server/index.d.cts +9 -4
  85. package/dist/server/index.d.ts +9 -4
  86. package/dist/server/index.js +1 -0
  87. package/dist/storage/index.cjs +2 -2
  88. package/dist/storage/index.d.cts +2 -2
  89. package/dist/storage/index.d.ts +2 -2
  90. package/dist/storage/index.js +1 -1
  91. package/dist/storage/libsql/index.cjs +2 -2
  92. package/dist/storage/libsql/index.d.cts +2 -2
  93. package/dist/storage/libsql/index.d.ts +2 -2
  94. package/dist/storage/libsql/index.js +1 -1
  95. package/dist/telemetry/index.cjs +10 -6
  96. package/dist/telemetry/index.d.cts +14 -4
  97. package/dist/telemetry/index.d.ts +14 -4
  98. package/dist/telemetry/index.js +1 -1
  99. package/dist/tools/index.cjs +4 -4
  100. package/dist/tools/index.d.cts +2 -2
  101. package/dist/tools/index.d.ts +2 -2
  102. package/dist/tools/index.js +1 -1
  103. package/dist/tts/index.cjs +2 -2
  104. package/dist/tts/index.d.cts +1 -1
  105. package/dist/tts/index.d.ts +1 -1
  106. package/dist/tts/index.js +1 -1
  107. package/dist/utils.cjs +12 -12
  108. package/dist/utils.d.cts +2 -2
  109. package/dist/utils.d.ts +2 -2
  110. package/dist/utils.js +1 -1
  111. package/dist/vector/index.cjs +2 -2
  112. package/dist/vector/index.d.cts +3 -1
  113. package/dist/vector/index.d.ts +3 -1
  114. package/dist/vector/index.js +1 -1
  115. package/dist/vector/libsql/index.cjs +3 -3
  116. package/dist/vector/libsql/index.d.cts +1 -1
  117. package/dist/vector/libsql/index.d.ts +1 -1
  118. package/dist/vector/libsql/index.js +1 -1
  119. package/dist/voice/index.cjs +4 -4
  120. package/dist/voice/index.d.cts +2 -2
  121. package/dist/voice/index.d.ts +2 -2
  122. package/dist/voice/index.js +1 -1
  123. package/dist/workflows/index.cjs +22 -22
  124. package/dist/workflows/index.d.cts +3 -3
  125. package/dist/workflows/index.d.ts +3 -3
  126. package/dist/workflows/index.js +1 -1
  127. package/dist/workflows/vNext/index.cjs +166 -129
  128. package/dist/workflows/vNext/index.d.cts +37 -12
  129. package/dist/workflows/vNext/index.d.ts +37 -12
  130. package/dist/workflows/vNext/index.js +162 -125
  131. package/package.json +2 -2
  132. package/dist/chunk-LXIAHZ45.js +0 -37
  133. package/dist/chunk-YAJVZMZH.cjs +0 -39
@@ -1,10 +1,10 @@
1
1
  'use strict';
2
2
 
3
- var chunkWYL4MKWH_cjs = require('../chunk-WYL4MKWH.cjs');
3
+ var chunk2PLTE53B_cjs = require('../chunk-2PLTE53B.cjs');
4
4
 
5
5
 
6
6
 
7
7
  Object.defineProperty(exports, "Agent", {
8
8
  enumerable: true,
9
- get: function () { return chunkWYL4MKWH_cjs.Agent; }
9
+ get: function () { return chunk2PLTE53B_cjs.Agent; }
10
10
  });
@@ -1,8 +1,8 @@
1
1
  export { Message as AiMessageType } from 'ai';
2
2
  import 'json-schema';
3
3
  import 'zod';
4
- export { F as Agent, G as AgentConfig, be as AgentGenerateOptions, bf as AgentStreamOptions, bd as DynamicArgument, b1 as MastraLanguageModel, b3 as ToolsInput, bc as ToolsetsInput } from '../base-Cs0ddGCf.cjs';
5
- import '../base-BihKcqDY.cjs';
4
+ export { F as Agent, G as AgentConfig, be as AgentGenerateOptions, bf as AgentStreamOptions, bd as DynamicArgument, b1 as MastraLanguageModel, b3 as ToolsInput, bc as ToolsetsInput } from '../base-VMWGZau0.cjs';
5
+ import '../base-D9APQt4V.cjs';
6
6
  import '../types-BtMyV38I.cjs';
7
7
  import '../runtime-context/index.cjs';
8
8
  import 'sift';
@@ -1,8 +1,8 @@
1
1
  export { Message as AiMessageType } from 'ai';
2
2
  import 'json-schema';
3
3
  import 'zod';
4
- export { F as Agent, G as AgentConfig, be as AgentGenerateOptions, bf as AgentStreamOptions, bd as DynamicArgument, b1 as MastraLanguageModel, b3 as ToolsInput, bc as ToolsetsInput } from '../base-CzHSMvOb.js';
5
- import '../base-DT2poiVK.js';
4
+ export { F as Agent, G as AgentConfig, be as AgentGenerateOptions, bf as AgentStreamOptions, bd as DynamicArgument, b1 as MastraLanguageModel, b3 as ToolsInput, bc as ToolsetsInput } from '../base-BCnFhShR.js';
5
+ import '../base-CeEVvwRi.js';
6
6
  import '../types-BtMyV38I.js';
7
7
  import '../runtime-context/index.js';
8
8
  import 'sift';
@@ -1 +1 @@
1
- export { Agent } from '../chunk-KSH5B376.js';
1
+ export { Agent } from '../chunk-XYP6MY7U.js';
@@ -1,6 +1,6 @@
1
1
  import * as ai from 'ai';
2
2
  import { Tool as Tool$1, Schema, ToolExecutionOptions, LanguageModelV1, CoreMessage as CoreMessage$1, GenerateTextResult, GenerateObjectResult, StreamTextResult, StreamObjectResult, EmbeddingModel, Message, UserContent, AssistantContent, LanguageModel as LanguageModel$1, DeepPartial, generateText, generateObject, streamText, streamObject, TelemetrySettings, CoreSystemMessage as CoreSystemMessage$1, CoreAssistantMessage as CoreAssistantMessage$1, CoreUserMessage as CoreUserMessage$1, CoreToolMessage as CoreToolMessage$1, EmbedResult as EmbedResult$1, EmbedManyResult as EmbedManyResult$1, GenerateTextOnStepFinishCallback, StreamTextOnFinishCallback, StreamObjectOnFinishCallback, StreamTextOnStepFinishCallback, ToolContent } from 'ai';
3
- import { M as MastraBase, T as Telemetry, O as OtelConfig } from './base-DT2poiVK.js';
3
+ import { M as MastraBase, T as Telemetry, O as OtelConfig } from './base-CeEVvwRi.js';
4
4
  import { a as Metric, M as MetricResult, T as TestInfo } from './types-BtMyV38I.js';
5
5
  import { Query } from 'sift';
6
6
  import { z, ZodSchema } from 'zod';
@@ -1137,7 +1137,9 @@ type ExecuteFunction<TStepInput, TStepOutput, TResumeSchema, TSuspendSchema> = (
1137
1137
  steps: string[];
1138
1138
  resumePayload: any;
1139
1139
  };
1140
- emitter: EventEmitter$1;
1140
+ emitter: {
1141
+ emit: (event: string, data: any) => Promise<void>;
1142
+ };
1141
1143
  }) => Promise<TStepOutput>;
1142
1144
  interface NewStep<TStepId extends string = string, TSchemaIn extends z.ZodType<any> = z.ZodType<any>, TSchemaOut extends z.ZodType<any> = z.ZodType<any>, TResumeSchema extends z.ZodType<any> = z.ZodType<any>, TSuspendSchema extends z.ZodType<any> = z.ZodType<any>> {
1143
1145
  id: TStepId;
@@ -1156,7 +1158,7 @@ type StepSuccess<T> = {
1156
1158
  };
1157
1159
  type StepFailure = {
1158
1160
  status: 'failed';
1159
- error: string;
1161
+ error: string | Error;
1160
1162
  };
1161
1163
  type StepSuspended<T> = {
1162
1164
  status: 'suspended';
@@ -1242,7 +1244,9 @@ declare abstract class ExecutionEngine extends MastraBase {
1242
1244
  resumePayload: any;
1243
1245
  resumePath: number[];
1244
1246
  };
1245
- emitter: EventEmitter$1;
1247
+ emitter: {
1248
+ emit: (event: string, data: any) => Promise<void>;
1249
+ };
1246
1250
  runtimeContext: RuntimeContext;
1247
1251
  retryConfig?: {
1248
1252
  attempts?: number;
@@ -1398,6 +1402,7 @@ declare class NewWorkflow<TSteps extends NewStep<string, any, any, any, any>[] =
1398
1402
  delay?: number;
1399
1403
  };
1400
1404
  constructor({ mastra, id, inputSchema, outputSchema, description, executionEngine, retryConfig, steps, }: NewWorkflowConfig<TWorkflowId, TInput, TOutput, TSteps>);
1405
+ get runs(): Map<string, Run<TSteps, TInput, TOutput>>;
1401
1406
  get mastra(): Mastra<Record<string, Agent<any, ToolsInput, Record<string, Metric>>>, Record<string, Workflow<Step<string, any, any, StepExecutionContext<any, WorkflowContext<any, Step<string, any, any, any>[], Record<string, any>>>>[], string, any, any>>, Record<string, NewWorkflow<NewStep<string, any, any, any, any>[], string, z.ZodType<any, z.ZodTypeDef, any>, z.ZodType<any, z.ZodTypeDef, any>, z.ZodType<any, z.ZodTypeDef, any>>>, Record<string, MastraVector>, Record<string, MastraTTS>, Logger, Record<string, AgentNetwork>> | undefined;
1402
1407
  __registerMastra(mastra: Mastra): void;
1403
1408
  __registerPrimitives(p: MastraPrimitives): void;
@@ -1464,7 +1469,9 @@ declare class NewWorkflow<TSteps extends NewStep<string, any, any, any, any>[] =
1464
1469
  resumePayload: any;
1465
1470
  runId?: string;
1466
1471
  };
1467
- emitter: EventEmitter$1;
1472
+ emitter: {
1473
+ emit: (event: string, data: any) => void;
1474
+ };
1468
1475
  mastra: Mastra;
1469
1476
  }): Promise<z.infer<TOutput>>;
1470
1477
  getWorkflowRuns(args?: {
@@ -2124,13 +2131,21 @@ type AgentStreamOptions<Z extends ZodSchema | JSONSchema7 | undefined = undefine
2124
2131
  threadId: string;
2125
2132
  }) & (Z extends undefined ? DefaultLLMStreamOptions : DefaultLLMStreamObjectOptions);
2126
2133
 
2127
- type Methods = 'GET' | 'POST' | 'PUT' | 'DELETE';
2134
+ type Methods = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'ALL';
2128
2135
  type ApiRoute = {
2129
2136
  path: string;
2130
2137
  method: Methods;
2131
2138
  handler: Handler;
2132
2139
  middleware?: MiddlewareHandler | MiddlewareHandler[];
2133
2140
  openapi?: DescribeRouteOptions;
2141
+ } | {
2142
+ path: string;
2143
+ method: Methods;
2144
+ createHandler: ({ mastra }: {
2145
+ mastra: Mastra;
2146
+ }) => Promise<Handler>;
2147
+ middleware?: MiddlewareHandler | MiddlewareHandler[];
2148
+ openapi?: DescribeRouteOptions;
2134
2149
  };
2135
2150
  type Middleware = MiddlewareHandler | {
2136
2151
  path: string;
@@ -2184,6 +2199,11 @@ type ServerConfig = {
2184
2199
  */
2185
2200
  openAPIDocs?: boolean;
2186
2201
  };
2202
+ /**
2203
+ * Body size limit for the server
2204
+ * @default 4.5mb
2205
+ */
2206
+ bodySizeLimit?: number;
2187
2207
  };
2188
2208
 
2189
2209
  interface Config<TAgents extends Record<string, Agent<any>> = Record<string, Agent<any>>, TWorkflows extends Record<string, Workflow> = Record<string, Workflow>, TNewWorkflows extends Record<string, NewWorkflow> = Record<string, NewWorkflow>, 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>> {
@@ -2676,4 +2696,4 @@ declare abstract class MastraStorage extends MastraBase {
2676
2696
  }): Promise<WorkflowRun | null>;
2677
2697
  }
2678
2698
 
2679
- export { type CoreToolMessage as $, type ApiRoute as A, type WatchEvent as B, type ToolAction as C, type DynamicMapping as D, type EvalRow as E, Agent as F, type AgentConfig as G, MastraMemory as H, type ToolExecutionContext as I, Tool as J, Step as K, Workflow as L, type Methods as M, type NewStep as N, type WorkflowOptions as O, type PathsToStringProps as P, type LanguageModel as Q, Run as R, type StorageColumn as S, type TABLE_NAMES as T, type CoreMessage as U, type VariableReference as V, type WorkflowRuns as W, type CoreSystemMessage as X, type CoreAssistantMessage as Y, type ZodPathType as Z, type CoreUserMessage as _, Mastra as a, type WorkflowRunState as a$, type EmbedResult as a0, type EmbedManyResult as a1, type BaseStructuredOutputType as a2, type StructuredOutputType as a3, type StructuredOutputArrayItem as a4, type StructuredOutput as a5, type GenerateReturn as a6, type StreamReturn as a7, type OutputType as a8, type DefaultLLMTextOptions as a9, type BaseCondition as aA, type ActionContext as aB, WhenConditionReturnValue as aC, type StepDef as aD, type StepCondition as aE, type StepConfig as aF, type StepResult$1 as aG, type StepsRecord$1 as aH, type WorkflowRunResult as aI, type WorkflowContext as aJ, type WorkflowLogMessage as aK, type WorkflowEvent as aL, type ResolverFunctionInput as aM, type ResolverFunctionOutput as aN, type SubscriberFunctionOutput as aO, type DependencyCheckOutput as aP, type StepResolverOutput as aQ, type WorkflowActors as aR, type WorkflowActionParams as aS, type WorkflowActions as aT, type WorkflowState as aU, type StepId as aV, type ExtractSchemaFromStep$1 as aW, type ExtractStepResult as aX, type StepInputType as aY, type ExtractSchemaType$1 as aZ, type PathsToStringProps$1 as a_, type DefaultLLMTextObjectOptions as aa, type DefaultLLMStreamOptions as ab, type DefaultLLMStreamObjectOptions as ac, type LLMTextOptions as ad, type LLMTextObjectOptions as ae, type LLMStreamOptions as af, type LLMInnerStreamOptions as ag, type LLMStreamObjectOptions as ah, createMockModel as ai, type Config as aj, type MessageResponse as ak, type MemoryConfig as al, type SharedMemoryConfig as am, type MemoryProcessorOpts as an, MemoryProcessor as ao, memoryDefaultOptions as ap, createTool as aq, type VercelTool as ar, type CoreTool as as, type StepExecutionContext as at, type StepAction as au, type StepVariableType as av, type StepNode as aw, type StepGraph as ax, type RetryConfig as ay, type VariableReference$1 as az, MastraStorage as b, type WorkflowResumeResult as b0, type MastraLanguageModel as b1, type MastraPrimitives as b2, type ToolsInput as b3, AgentNetwork as b4, type AgentNetworkConfig as b5, type VoiceEventType as b6, type VoiceEventMap as b7, type VoiceConfig as b8, MastraVoice as b9, CompositeVoice as ba, DefaultVoice as bb, type ToolsetsInput as bc, type DynamicArgument as bd, type AgentGenerateOptions as be, type AgentStreamOptions as bf, TABLE_WORKFLOW_SNAPSHOT as bg, TABLE_EVALS as bh, TABLE_MESSAGES as bi, TABLE_THREADS as bj, TABLE_TRACES as bk, TABLE_SCHEMAS as bl, type StorageThreadType as c, type MessageType as d, type StorageGetMessagesArg as e, type WorkflowRun as f, ExecutionEngine as g, type ExecutionGraph as h, type StepResult as i, type StepFlowEntry as j, type ExecuteFunction as k, type SerializedStep as l, type SerializedStepFlowEntry as m, createStep as n, cloneStep as o, createWorkflow as p, cloneWorkflow as q, type WorkflowResult as r, type NewWorkflowConfig as s, NewWorkflow as t, type StepSuccess as u, type StepFailure as v, type StepSuspended as w, type StepsRecord as x, type ExtractSchemaType as y, type ExtractSchemaFromStep as z };
2699
+ export { type CoreToolMessage as $, type ApiRoute as A, type WatchEvent as B, type ToolAction as C, type DynamicMapping as D, type EvalRow as E, Agent as F, type AgentConfig as G, MastraMemory as H, type ToolExecutionContext as I, Tool as J, Step as K, Workflow as L, type Methods as M, type NewStep as N, type WorkflowOptions as O, type PathsToStringProps as P, type LanguageModel as Q, Run as R, type StorageColumn as S, type TABLE_NAMES as T, type CoreMessage as U, type VariableReference as V, type WorkflowRuns as W, type CoreSystemMessage as X, type CoreAssistantMessage as Y, type ZodPathType as Z, type CoreUserMessage as _, Mastra as a, type WorkflowRunState as a$, type EmbedResult as a0, type EmbedManyResult as a1, type BaseStructuredOutputType as a2, type StructuredOutputType as a3, type StructuredOutputArrayItem as a4, type StructuredOutput as a5, type GenerateReturn as a6, type StreamReturn as a7, type OutputType as a8, type DefaultLLMTextOptions as a9, type BaseCondition as aA, type ActionContext as aB, WhenConditionReturnValue as aC, type StepDef as aD, type StepCondition as aE, type StepConfig as aF, type StepResult$1 as aG, type StepsRecord$1 as aH, type WorkflowRunResult as aI, type WorkflowContext as aJ, type WorkflowLogMessage as aK, type WorkflowEvent as aL, type ResolverFunctionInput as aM, type ResolverFunctionOutput as aN, type SubscriberFunctionOutput as aO, type DependencyCheckOutput as aP, type StepResolverOutput as aQ, type WorkflowActors as aR, type WorkflowActionParams as aS, type WorkflowActions as aT, type WorkflowState as aU, type StepId as aV, type ExtractSchemaFromStep$1 as aW, type ExtractStepResult as aX, type StepInputType as aY, type ExtractSchemaType$1 as aZ, type PathsToStringProps$1 as a_, type DefaultLLMTextObjectOptions as aa, type DefaultLLMStreamOptions as ab, type DefaultLLMStreamObjectOptions as ac, type LLMTextOptions as ad, type LLMTextObjectOptions as ae, type LLMStreamOptions as af, type LLMInnerStreamOptions as ag, type LLMStreamObjectOptions as ah, createMockModel as ai, type Config as aj, type MessageResponse as ak, type MemoryConfig as al, type SharedMemoryConfig as am, type MemoryProcessorOpts as an, MemoryProcessor as ao, memoryDefaultOptions as ap, createTool as aq, type VercelTool as ar, type CoreTool as as, type StepExecutionContext as at, type StepAction as au, type StepVariableType as av, type StepNode as aw, type StepGraph as ax, type RetryConfig as ay, type VariableReference$1 as az, MastraStorage as b, type WorkflowResumeResult as b0, type MastraLanguageModel as b1, type MastraPrimitives as b2, type ToolsInput as b3, AgentNetwork as b4, type AgentNetworkConfig as b5, type VoiceEventType as b6, type VoiceEventMap as b7, type VoiceConfig as b8, MastraVoice as b9, CompositeVoice as ba, DefaultVoice as bb, type ToolsetsInput as bc, type DynamicArgument as bd, type AgentGenerateOptions as be, type AgentStreamOptions as bf, TABLE_WORKFLOW_SNAPSHOT as bg, TABLE_EVALS as bh, TABLE_MESSAGES as bi, TABLE_THREADS as bj, TABLE_TRACES as bk, TABLE_SCHEMAS as bl, type StorageThreadType as c, type MessageType as d, type StorageGetMessagesArg as e, type WorkflowRun as f, ExecutionEngine as g, type StepResult as h, type ExecutionGraph as i, type StepFlowEntry as j, type ExecuteFunction as k, type SerializedStep as l, type SerializedStepFlowEntry as m, createStep as n, cloneStep as o, createWorkflow as p, cloneWorkflow as q, type WorkflowResult as r, type NewWorkflowConfig as s, NewWorkflow as t, type StepSuccess as u, type StepFailure as v, type StepSuspended as w, type StepsRecord as x, type ExtractSchemaType as y, type ExtractSchemaFromStep as z };
@@ -1,5 +1,5 @@
1
1
  import * as _opentelemetry_api from '@opentelemetry/api';
2
- import { Tracer, Span, Context } from '@opentelemetry/api';
2
+ import { Tracer, Span, BaggageEntry, Context } from '@opentelemetry/api';
3
3
  import { R as RegisteredLogger, L as Logger } from './index-CquI0inB.js';
4
4
  import { SpanExporter } from '@opentelemetry/sdk-trace-base';
5
5
 
@@ -96,7 +96,7 @@ declare class Telemetry {
96
96
  /** Skip tracing if telemetry is not active */
97
97
  skipIfNoTelemetry?: boolean;
98
98
  }): T;
99
- static setBaggage(baggage: Record<string, string>, ctx?: Context): Context;
99
+ static setBaggage(baggage: Record<string, BaggageEntry>, ctx?: Context): Context;
100
100
  static withContext(ctx: Context, fn: () => void): void;
101
101
  /**
102
102
  * method to trace individual methods with proper context
@@ -1,5 +1,5 @@
1
1
  import * as _opentelemetry_api from '@opentelemetry/api';
2
- import { Tracer, Span, Context } from '@opentelemetry/api';
2
+ import { Tracer, Span, BaggageEntry, Context } from '@opentelemetry/api';
3
3
  import { R as RegisteredLogger, L as Logger } from './index-CquI0inB.cjs';
4
4
  import { SpanExporter } from '@opentelemetry/sdk-trace-base';
5
5
 
@@ -96,7 +96,7 @@ declare class Telemetry {
96
96
  /** Skip tracing if telemetry is not active */
97
97
  skipIfNoTelemetry?: boolean;
98
98
  }): T;
99
- static setBaggage(baggage: Record<string, string>, ctx?: Context): Context;
99
+ static setBaggage(baggage: Record<string, BaggageEntry>, ctx?: Context): Context;
100
100
  static withContext(ctx: Context, fn: () => void): void;
101
101
  /**
102
102
  * method to trace individual methods with proper context
@@ -1,6 +1,6 @@
1
1
  import * as ai from 'ai';
2
2
  import { Tool as Tool$1, Schema, ToolExecutionOptions, LanguageModelV1, CoreMessage as CoreMessage$1, GenerateTextResult, GenerateObjectResult, StreamTextResult, StreamObjectResult, EmbeddingModel, Message, UserContent, AssistantContent, LanguageModel as LanguageModel$1, DeepPartial, generateText, generateObject, streamText, streamObject, TelemetrySettings, CoreSystemMessage as CoreSystemMessage$1, CoreAssistantMessage as CoreAssistantMessage$1, CoreUserMessage as CoreUserMessage$1, CoreToolMessage as CoreToolMessage$1, EmbedResult as EmbedResult$1, EmbedManyResult as EmbedManyResult$1, GenerateTextOnStepFinishCallback, StreamTextOnFinishCallback, StreamObjectOnFinishCallback, StreamTextOnStepFinishCallback, ToolContent } from 'ai';
3
- import { M as MastraBase, T as Telemetry, O as OtelConfig } from './base-BihKcqDY.cjs';
3
+ import { M as MastraBase, T as Telemetry, O as OtelConfig } from './base-D9APQt4V.cjs';
4
4
  import { a as Metric, M as MetricResult, T as TestInfo } from './types-BtMyV38I.cjs';
5
5
  import { Query } from 'sift';
6
6
  import { z, ZodSchema } from 'zod';
@@ -1137,7 +1137,9 @@ type ExecuteFunction<TStepInput, TStepOutput, TResumeSchema, TSuspendSchema> = (
1137
1137
  steps: string[];
1138
1138
  resumePayload: any;
1139
1139
  };
1140
- emitter: EventEmitter$1;
1140
+ emitter: {
1141
+ emit: (event: string, data: any) => Promise<void>;
1142
+ };
1141
1143
  }) => Promise<TStepOutput>;
1142
1144
  interface NewStep<TStepId extends string = string, TSchemaIn extends z.ZodType<any> = z.ZodType<any>, TSchemaOut extends z.ZodType<any> = z.ZodType<any>, TResumeSchema extends z.ZodType<any> = z.ZodType<any>, TSuspendSchema extends z.ZodType<any> = z.ZodType<any>> {
1143
1145
  id: TStepId;
@@ -1156,7 +1158,7 @@ type StepSuccess<T> = {
1156
1158
  };
1157
1159
  type StepFailure = {
1158
1160
  status: 'failed';
1159
- error: string;
1161
+ error: string | Error;
1160
1162
  };
1161
1163
  type StepSuspended<T> = {
1162
1164
  status: 'suspended';
@@ -1242,7 +1244,9 @@ declare abstract class ExecutionEngine extends MastraBase {
1242
1244
  resumePayload: any;
1243
1245
  resumePath: number[];
1244
1246
  };
1245
- emitter: EventEmitter$1;
1247
+ emitter: {
1248
+ emit: (event: string, data: any) => Promise<void>;
1249
+ };
1246
1250
  runtimeContext: RuntimeContext;
1247
1251
  retryConfig?: {
1248
1252
  attempts?: number;
@@ -1398,6 +1402,7 @@ declare class NewWorkflow<TSteps extends NewStep<string, any, any, any, any>[] =
1398
1402
  delay?: number;
1399
1403
  };
1400
1404
  constructor({ mastra, id, inputSchema, outputSchema, description, executionEngine, retryConfig, steps, }: NewWorkflowConfig<TWorkflowId, TInput, TOutput, TSteps>);
1405
+ get runs(): Map<string, Run<TSteps, TInput, TOutput>>;
1401
1406
  get mastra(): Mastra<Record<string, Agent<any, ToolsInput, Record<string, Metric>>>, Record<string, Workflow<Step<string, any, any, StepExecutionContext<any, WorkflowContext<any, Step<string, any, any, any>[], Record<string, any>>>>[], string, any, any>>, Record<string, NewWorkflow<NewStep<string, any, any, any, any>[], string, z.ZodType<any, z.ZodTypeDef, any>, z.ZodType<any, z.ZodTypeDef, any>, z.ZodType<any, z.ZodTypeDef, any>>>, Record<string, MastraVector>, Record<string, MastraTTS>, Logger, Record<string, AgentNetwork>> | undefined;
1402
1407
  __registerMastra(mastra: Mastra): void;
1403
1408
  __registerPrimitives(p: MastraPrimitives): void;
@@ -1464,7 +1469,9 @@ declare class NewWorkflow<TSteps extends NewStep<string, any, any, any, any>[] =
1464
1469
  resumePayload: any;
1465
1470
  runId?: string;
1466
1471
  };
1467
- emitter: EventEmitter$1;
1472
+ emitter: {
1473
+ emit: (event: string, data: any) => void;
1474
+ };
1468
1475
  mastra: Mastra;
1469
1476
  }): Promise<z.infer<TOutput>>;
1470
1477
  getWorkflowRuns(args?: {
@@ -2124,13 +2131,21 @@ type AgentStreamOptions<Z extends ZodSchema | JSONSchema7 | undefined = undefine
2124
2131
  threadId: string;
2125
2132
  }) & (Z extends undefined ? DefaultLLMStreamOptions : DefaultLLMStreamObjectOptions);
2126
2133
 
2127
- type Methods = 'GET' | 'POST' | 'PUT' | 'DELETE';
2134
+ type Methods = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'ALL';
2128
2135
  type ApiRoute = {
2129
2136
  path: string;
2130
2137
  method: Methods;
2131
2138
  handler: Handler;
2132
2139
  middleware?: MiddlewareHandler | MiddlewareHandler[];
2133
2140
  openapi?: DescribeRouteOptions;
2141
+ } | {
2142
+ path: string;
2143
+ method: Methods;
2144
+ createHandler: ({ mastra }: {
2145
+ mastra: Mastra;
2146
+ }) => Promise<Handler>;
2147
+ middleware?: MiddlewareHandler | MiddlewareHandler[];
2148
+ openapi?: DescribeRouteOptions;
2134
2149
  };
2135
2150
  type Middleware = MiddlewareHandler | {
2136
2151
  path: string;
@@ -2184,6 +2199,11 @@ type ServerConfig = {
2184
2199
  */
2185
2200
  openAPIDocs?: boolean;
2186
2201
  };
2202
+ /**
2203
+ * Body size limit for the server
2204
+ * @default 4.5mb
2205
+ */
2206
+ bodySizeLimit?: number;
2187
2207
  };
2188
2208
 
2189
2209
  interface Config<TAgents extends Record<string, Agent<any>> = Record<string, Agent<any>>, TWorkflows extends Record<string, Workflow> = Record<string, Workflow>, TNewWorkflows extends Record<string, NewWorkflow> = Record<string, NewWorkflow>, 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>> {
@@ -2676,4 +2696,4 @@ declare abstract class MastraStorage extends MastraBase {
2676
2696
  }): Promise<WorkflowRun | null>;
2677
2697
  }
2678
2698
 
2679
- export { type CoreToolMessage as $, type ApiRoute as A, type WatchEvent as B, type ToolAction as C, type DynamicMapping as D, type EvalRow as E, Agent as F, type AgentConfig as G, MastraMemory as H, type ToolExecutionContext as I, Tool as J, Step as K, Workflow as L, type Methods as M, type NewStep as N, type WorkflowOptions as O, type PathsToStringProps as P, type LanguageModel as Q, Run as R, type StorageColumn as S, type TABLE_NAMES as T, type CoreMessage as U, type VariableReference as V, type WorkflowRuns as W, type CoreSystemMessage as X, type CoreAssistantMessage as Y, type ZodPathType as Z, type CoreUserMessage as _, Mastra as a, type WorkflowRunState as a$, type EmbedResult as a0, type EmbedManyResult as a1, type BaseStructuredOutputType as a2, type StructuredOutputType as a3, type StructuredOutputArrayItem as a4, type StructuredOutput as a5, type GenerateReturn as a6, type StreamReturn as a7, type OutputType as a8, type DefaultLLMTextOptions as a9, type BaseCondition as aA, type ActionContext as aB, WhenConditionReturnValue as aC, type StepDef as aD, type StepCondition as aE, type StepConfig as aF, type StepResult$1 as aG, type StepsRecord$1 as aH, type WorkflowRunResult as aI, type WorkflowContext as aJ, type WorkflowLogMessage as aK, type WorkflowEvent as aL, type ResolverFunctionInput as aM, type ResolverFunctionOutput as aN, type SubscriberFunctionOutput as aO, type DependencyCheckOutput as aP, type StepResolverOutput as aQ, type WorkflowActors as aR, type WorkflowActionParams as aS, type WorkflowActions as aT, type WorkflowState as aU, type StepId as aV, type ExtractSchemaFromStep$1 as aW, type ExtractStepResult as aX, type StepInputType as aY, type ExtractSchemaType$1 as aZ, type PathsToStringProps$1 as a_, type DefaultLLMTextObjectOptions as aa, type DefaultLLMStreamOptions as ab, type DefaultLLMStreamObjectOptions as ac, type LLMTextOptions as ad, type LLMTextObjectOptions as ae, type LLMStreamOptions as af, type LLMInnerStreamOptions as ag, type LLMStreamObjectOptions as ah, createMockModel as ai, type Config as aj, type MessageResponse as ak, type MemoryConfig as al, type SharedMemoryConfig as am, type MemoryProcessorOpts as an, MemoryProcessor as ao, memoryDefaultOptions as ap, createTool as aq, type VercelTool as ar, type CoreTool as as, type StepExecutionContext as at, type StepAction as au, type StepVariableType as av, type StepNode as aw, type StepGraph as ax, type RetryConfig as ay, type VariableReference$1 as az, MastraStorage as b, type WorkflowResumeResult as b0, type MastraLanguageModel as b1, type MastraPrimitives as b2, type ToolsInput as b3, AgentNetwork as b4, type AgentNetworkConfig as b5, type VoiceEventType as b6, type VoiceEventMap as b7, type VoiceConfig as b8, MastraVoice as b9, CompositeVoice as ba, DefaultVoice as bb, type ToolsetsInput as bc, type DynamicArgument as bd, type AgentGenerateOptions as be, type AgentStreamOptions as bf, TABLE_WORKFLOW_SNAPSHOT as bg, TABLE_EVALS as bh, TABLE_MESSAGES as bi, TABLE_THREADS as bj, TABLE_TRACES as bk, TABLE_SCHEMAS as bl, type StorageThreadType as c, type MessageType as d, type StorageGetMessagesArg as e, type WorkflowRun as f, ExecutionEngine as g, type ExecutionGraph as h, type StepResult as i, type StepFlowEntry as j, type ExecuteFunction as k, type SerializedStep as l, type SerializedStepFlowEntry as m, createStep as n, cloneStep as o, createWorkflow as p, cloneWorkflow as q, type WorkflowResult as r, type NewWorkflowConfig as s, NewWorkflow as t, type StepSuccess as u, type StepFailure as v, type StepSuspended as w, type StepsRecord as x, type ExtractSchemaType as y, type ExtractSchemaFromStep as z };
2699
+ export { type CoreToolMessage as $, type ApiRoute as A, type WatchEvent as B, type ToolAction as C, type DynamicMapping as D, type EvalRow as E, Agent as F, type AgentConfig as G, MastraMemory as H, type ToolExecutionContext as I, Tool as J, Step as K, Workflow as L, type Methods as M, type NewStep as N, type WorkflowOptions as O, type PathsToStringProps as P, type LanguageModel as Q, Run as R, type StorageColumn as S, type TABLE_NAMES as T, type CoreMessage as U, type VariableReference as V, type WorkflowRuns as W, type CoreSystemMessage as X, type CoreAssistantMessage as Y, type ZodPathType as Z, type CoreUserMessage as _, Mastra as a, type WorkflowRunState as a$, type EmbedResult as a0, type EmbedManyResult as a1, type BaseStructuredOutputType as a2, type StructuredOutputType as a3, type StructuredOutputArrayItem as a4, type StructuredOutput as a5, type GenerateReturn as a6, type StreamReturn as a7, type OutputType as a8, type DefaultLLMTextOptions as a9, type BaseCondition as aA, type ActionContext as aB, WhenConditionReturnValue as aC, type StepDef as aD, type StepCondition as aE, type StepConfig as aF, type StepResult$1 as aG, type StepsRecord$1 as aH, type WorkflowRunResult as aI, type WorkflowContext as aJ, type WorkflowLogMessage as aK, type WorkflowEvent as aL, type ResolverFunctionInput as aM, type ResolverFunctionOutput as aN, type SubscriberFunctionOutput as aO, type DependencyCheckOutput as aP, type StepResolverOutput as aQ, type WorkflowActors as aR, type WorkflowActionParams as aS, type WorkflowActions as aT, type WorkflowState as aU, type StepId as aV, type ExtractSchemaFromStep$1 as aW, type ExtractStepResult as aX, type StepInputType as aY, type ExtractSchemaType$1 as aZ, type PathsToStringProps$1 as a_, type DefaultLLMTextObjectOptions as aa, type DefaultLLMStreamOptions as ab, type DefaultLLMStreamObjectOptions as ac, type LLMTextOptions as ad, type LLMTextObjectOptions as ae, type LLMStreamOptions as af, type LLMInnerStreamOptions as ag, type LLMStreamObjectOptions as ah, createMockModel as ai, type Config as aj, type MessageResponse as ak, type MemoryConfig as al, type SharedMemoryConfig as am, type MemoryProcessorOpts as an, MemoryProcessor as ao, memoryDefaultOptions as ap, createTool as aq, type VercelTool as ar, type CoreTool as as, type StepExecutionContext as at, type StepAction as au, type StepVariableType as av, type StepNode as aw, type StepGraph as ax, type RetryConfig as ay, type VariableReference$1 as az, MastraStorage as b, type WorkflowResumeResult as b0, type MastraLanguageModel as b1, type MastraPrimitives as b2, type ToolsInput as b3, AgentNetwork as b4, type AgentNetworkConfig as b5, type VoiceEventType as b6, type VoiceEventMap as b7, type VoiceConfig as b8, MastraVoice as b9, CompositeVoice as ba, DefaultVoice as bb, type ToolsetsInput as bc, type DynamicArgument as bd, type AgentGenerateOptions as be, type AgentStreamOptions as bf, TABLE_WORKFLOW_SNAPSHOT as bg, TABLE_EVALS as bh, TABLE_MESSAGES as bi, TABLE_THREADS as bj, TABLE_TRACES as bk, TABLE_SCHEMAS as bl, type StorageThreadType as c, type MessageType as d, type StorageGetMessagesArg as e, type WorkflowRun as f, ExecutionEngine as g, type StepResult as h, type ExecutionGraph as i, type StepFlowEntry as j, type ExecuteFunction as k, type SerializedStep as l, type SerializedStepFlowEntry as m, createStep as n, cloneStep as o, createWorkflow as p, cloneWorkflow as q, type WorkflowResult as r, type NewWorkflowConfig as s, NewWorkflow as t, type StepSuccess as u, type StepFailure as v, type StepSuspended as w, type StepsRecord as x, type ExtractSchemaType as y, type ExtractSchemaFromStep as z };
package/dist/base.cjs CHANGED
@@ -1,10 +1,10 @@
1
1
  'use strict';
2
2
 
3
- var chunkD63P5O4Q_cjs = require('./chunk-D63P5O4Q.cjs');
3
+ var chunkRO52JMKQ_cjs = require('./chunk-RO52JMKQ.cjs');
4
4
 
5
5
 
6
6
 
7
7
  Object.defineProperty(exports, "MastraBase", {
8
8
  enumerable: true,
9
- get: function () { return chunkD63P5O4Q_cjs.MastraBase; }
9
+ get: function () { return chunkRO52JMKQ_cjs.MastraBase; }
10
10
  });
package/dist/base.d.cts CHANGED
@@ -1,6 +1,6 @@
1
1
  import '@opentelemetry/api';
2
2
  import './index-CquI0inB.cjs';
3
- export { M as MastraBase } from './base-BihKcqDY.cjs';
3
+ export { M as MastraBase } from './base-D9APQt4V.cjs';
4
4
  import 'stream';
5
5
  import 'pino';
6
6
  import '@opentelemetry/sdk-trace-base';
package/dist/base.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import '@opentelemetry/api';
2
2
  import './index-CquI0inB.js';
3
- export { M as MastraBase } from './base-DT2poiVK.js';
3
+ export { M as MastraBase } from './base-CeEVvwRi.js';
4
4
  import 'stream';
5
5
  import 'pino';
6
6
  import '@opentelemetry/sdk-trace-base';
package/dist/base.js CHANGED
@@ -1 +1 @@
1
- export { MastraBase } from './chunk-CLJQYXNM.js';
1
+ export { MastraBase } from './chunk-NDAW47QQ.js';
@@ -1,10 +1,10 @@
1
1
  'use strict';
2
2
 
3
- var chunkWAW7QBY4_cjs = require('../chunk-WAW7QBY4.cjs');
3
+ var chunkCRHH7KRS_cjs = require('../chunk-CRHH7KRS.cjs');
4
4
 
5
5
 
6
6
 
7
7
  Object.defineProperty(exports, "MastraBundler", {
8
8
  enumerable: true,
9
- get: function () { return chunkWAW7QBY4_cjs.MastraBundler; }
9
+ get: function () { return chunkCRHH7KRS_cjs.MastraBundler; }
10
10
  });
@@ -1,4 +1,4 @@
1
- import { M as MastraBase } from '../base-BihKcqDY.cjs';
1
+ import { M as MastraBase } from '../base-D9APQt4V.cjs';
2
2
  import '@opentelemetry/api';
3
3
  import '../index-CquI0inB.cjs';
4
4
  import 'stream';
@@ -1,4 +1,4 @@
1
- import { M as MastraBase } from '../base-DT2poiVK.js';
1
+ import { M as MastraBase } from '../base-CeEVvwRi.js';
2
2
  import '@opentelemetry/api';
3
3
  import '../index-CquI0inB.js';
4
4
  import 'stream';
@@ -1 +1 @@
1
- export { MastraBundler } from '../chunk-GHK3HBWN.js';
1
+ export { MastraBundler } from '../chunk-TCL7XDJL.js';
@@ -1,10 +1,10 @@
1
1
  'use strict';
2
2
 
3
- var chunkPOEYDVX7_cjs = require('./chunk-POEYDVX7.cjs');
4
- var chunk22CFFDPA_cjs = require('./chunk-22CFFDPA.cjs');
5
- var chunkMYHX5XVW_cjs = require('./chunk-MYHX5XVW.cjs');
6
- var chunkOHIRECYU_cjs = require('./chunk-OHIRECYU.cjs');
7
- var chunkD63P5O4Q_cjs = require('./chunk-D63P5O4Q.cjs');
3
+ var chunkKXWR3FNX_cjs = require('./chunk-KXWR3FNX.cjs');
4
+ var chunkZMMZXEOL_cjs = require('./chunk-ZMMZXEOL.cjs');
5
+ var chunkUVRGQEMD_cjs = require('./chunk-UVRGQEMD.cjs');
6
+ var chunkFXAV2WYX_cjs = require('./chunk-FXAV2WYX.cjs');
7
+ var chunkRO52JMKQ_cjs = require('./chunk-RO52JMKQ.cjs');
8
8
  var chunkO7IW545H_cjs = require('./chunk-O7IW545H.cjs');
9
9
  var chunkLABUWBKX_cjs = require('./chunk-LABUWBKX.cjs');
10
10
  var chunkST5RMVLG_cjs = require('./chunk-ST5RMVLG.cjs');
@@ -66,11 +66,11 @@ function resoolveMaybePromise(value, cb) {
66
66
  return cb(value);
67
67
  }
68
68
  var _Agent_decorators, _init, _a;
69
- _Agent_decorators = [chunkMYHX5XVW_cjs.InstrumentClass({
69
+ _Agent_decorators = [chunkUVRGQEMD_cjs.InstrumentClass({
70
70
  prefix: "agent",
71
71
  excludeMethods: ["hasOwnMemory", "getMemory", "__primitive", "__registerMastra", "__registerPrimitives", "__setTools", "__setLogger", "__setTelemetry", "log", "getModel", "getInstructions", "getTools", "getLLM"]
72
72
  })];
73
- exports.Agent = class Agent extends (_a = chunkD63P5O4Q_cjs.MastraBase) {
73
+ exports.Agent = class Agent extends (_a = chunkRO52JMKQ_cjs.MastraBase) {
74
74
  id;
75
75
  name;
76
76
  #instructions;
@@ -127,7 +127,7 @@ exports.Agent = class Agent extends (_a = chunkD63P5O4Q_cjs.MastraBase) {
127
127
  this.#voice?.addInstructions(config.instructions);
128
128
  }
129
129
  } else {
130
- this.#voice = new chunkPOEYDVX7_cjs.DefaultVoice();
130
+ this.#voice = new chunkKXWR3FNX_cjs.DefaultVoice();
131
131
  }
132
132
  }
133
133
  hasOwnMemory() {
@@ -155,7 +155,7 @@ exports.Agent = class Agent extends (_a = chunkD63P5O4Q_cjs.MastraBase) {
155
155
  }));
156
156
  return voice;
157
157
  } else {
158
- return new chunkPOEYDVX7_cjs.DefaultVoice();
158
+ return new chunkKXWR3FNX_cjs.DefaultVoice();
159
159
  }
160
160
  }
161
161
  get instructions() {
@@ -187,13 +187,13 @@ exports.Agent = class Agent extends (_a = chunkD63P5O4Q_cjs.MastraBase) {
187
187
  if (typeof this.#tools === "function") {
188
188
  throw new Error("Tools are not compatible when tools are a function. Please use getTools() instead.");
189
189
  }
190
- return chunkOHIRECYU_cjs.ensureToolProperties(this.#tools);
190
+ return chunkFXAV2WYX_cjs.ensureToolProperties(this.#tools);
191
191
  }
192
192
  getTools({
193
193
  runtimeContext = new chunkLABUWBKX_cjs.RuntimeContext()
194
194
  } = {}) {
195
195
  if (typeof this.#tools !== "function") {
196
- return chunkOHIRECYU_cjs.ensureToolProperties(this.#tools);
196
+ return chunkFXAV2WYX_cjs.ensureToolProperties(this.#tools);
197
197
  }
198
198
  const result = this.#tools({
199
199
  runtimeContext
@@ -203,7 +203,7 @@ exports.Agent = class Agent extends (_a = chunkD63P5O4Q_cjs.MastraBase) {
203
203
  this.logger.error(`[Agent:${this.name}] - Function-based tools returned empty value`);
204
204
  throw new Error("Tools are required when using a function to provide them. The function returned an empty value.");
205
205
  }
206
- return chunkOHIRECYU_cjs.ensureToolProperties(tools);
206
+ return chunkFXAV2WYX_cjs.ensureToolProperties(tools);
207
207
  });
208
208
  }
209
209
  get llm() {
@@ -225,7 +225,7 @@ exports.Agent = class Agent extends (_a = chunkD63P5O4Q_cjs.MastraBase) {
225
225
  runtimeContext
226
226
  });
227
227
  return resoolveMaybePromise(model, model2 => {
228
- const llm = new chunk22CFFDPA_cjs.MastraLLM({
228
+ const llm = new chunkZMMZXEOL_cjs.MastraLLM({
229
229
  model: model2,
230
230
  mastra: this.#mastra
231
231
  });
@@ -364,7 +364,7 @@ exports.Agent = class Agent extends (_a = chunkD63P5O4Q_cjs.MastraBase) {
364
364
  messages: userMessages
365
365
  };
366
366
  }
367
- const newMessages = chunkOHIRECYU_cjs.ensureAllMessagesAreCoreMessages(userMessages);
367
+ const newMessages = chunkFXAV2WYX_cjs.ensureAllMessagesAreCoreMessages(userMessages);
368
368
  const now = Date.now();
369
369
  const messages = newMessages.map((u, index) => {
370
370
  return {
@@ -417,13 +417,13 @@ exports.Agent = class Agent extends (_a = chunkD63P5O4Q_cjs.MastraBase) {
417
417
  };
418
418
  }
419
419
  getResponseMessages({
420
- response,
420
+ messages,
421
421
  threadId,
422
422
  resourceId,
423
423
  now
424
424
  }) {
425
- if (!response.messages) return [];
426
- const messagesArray = Array.isArray(response.messages) ? response.messages : [response.messages];
425
+ if (!messages) return [];
426
+ const messagesArray = Array.isArray(messages) ? messages : [messages];
427
427
  return this.sanitizeResponseMessages(messagesArray).map((message, index) => {
428
428
  const messageId = crypto$1.randomUUID();
429
429
  let toolCallIds;
@@ -545,7 +545,7 @@ exports.Agent = class Agent extends (_a = chunkD63P5O4Q_cjs.MastraBase) {
545
545
  let mastraProxy = void 0;
546
546
  const logger = this.logger;
547
547
  if (this.#mastra) {
548
- mastraProxy = chunkOHIRECYU_cjs.createMastraProxy({
548
+ mastraProxy = chunkFXAV2WYX_cjs.createMastraProxy({
549
549
  mastra: this.#mastra,
550
550
  logger
551
551
  });
@@ -569,7 +569,7 @@ exports.Agent = class Agent extends (_a = chunkD63P5O4Q_cjs.MastraBase) {
569
569
  runtimeContext
570
570
  }) : this.model
571
571
  };
572
- return [k, chunkOHIRECYU_cjs.makeCoreTool(tool, options)];
572
+ return [k, chunkFXAV2WYX_cjs.makeCoreTool(tool, options)];
573
573
  }
574
574
  return void 0;
575
575
  }));
@@ -641,7 +641,7 @@ exports.Agent = class Agent extends (_a = chunkD63P5O4Q_cjs.MastraBase) {
641
641
  runtimeContext
642
642
  }) : this.model
643
643
  };
644
- const convertedToCoreTool = chunkOHIRECYU_cjs.makeCoreTool(toolObj, options, "toolset");
644
+ const convertedToCoreTool = chunkFXAV2WYX_cjs.makeCoreTool(toolObj, options, "toolset");
645
645
  toolsFromToolsetsConverted[toolName] = convertedToCoreTool;
646
646
  }
647
647
  }
@@ -670,7 +670,7 @@ exports.Agent = class Agent extends (_a = chunkD63P5O4Q_cjs.MastraBase) {
670
670
  runtimeContext
671
671
  }) : this.model
672
672
  };
673
- const convertedToCoreTool = chunkOHIRECYU_cjs.makeCoreTool(rest, options, "client-tool");
673
+ const convertedToCoreTool = chunkFXAV2WYX_cjs.makeCoreTool(rest, options, "client-tool");
674
674
  toolsFromToolsetsConverted[toolName] = convertedToCoreTool;
675
675
  }
676
676
  }
@@ -833,9 +833,8 @@ exports.Agent = class Agent extends (_a = chunkD63P5O4Q_cjs.MastraBase) {
833
833
  if (memory && resourceId && thread) {
834
834
  try {
835
835
  const userMessage = this.getMostRecentUserMessage(messages);
836
- const newMessages = userMessage ? [userMessage] : messages;
837
836
  const now = Date.now();
838
- const threadMessages = this.sanitizeResponseMessages(chunkOHIRECYU_cjs.ensureAllMessagesAreCoreMessages(newMessages)).map((u, index) => {
837
+ const threadMessages = this.sanitizeResponseMessages(chunkFXAV2WYX_cjs.ensureAllMessagesAreCoreMessages(messages)).map((u, index) => {
839
838
  return {
840
839
  id: this.getMemory()?.generateId(),
841
840
  createdAt: new Date(now + index),
@@ -864,18 +863,29 @@ exports.Agent = class Agent extends (_a = chunkD63P5O4Q_cjs.MastraBase) {
864
863
  title
865
864
  });
866
865
  })();
866
+ let responseMessages = result.response.messages;
867
+ if (!responseMessages && result.object) {
868
+ responseMessages = [{
869
+ role: "assistant",
870
+ content: [{
871
+ type: "text",
872
+ text: outputText
873
+ }]
874
+ }];
875
+ }
867
876
  await memory.saveMessages({
868
877
  messages: [...threadMessages, ...this.getResponseMessages({
869
878
  threadId: threadId2,
870
879
  resourceId,
871
- response: result.response,
880
+ messages: responseMessages,
872
881
  now: dateResponseMessagesFrom
873
882
  })],
874
883
  memoryConfig: memoryConfig2
875
884
  });
876
885
  } catch (e) {
886
+ const message = e instanceof Error ? e.message : JSON.stringify(e);
877
887
  this.logger.error("Error saving response", {
878
- error: e,
888
+ error: message,
879
889
  runId: runId2,
880
890
  result: resToLog,
881
891
  threadId: threadId2
@@ -1900,7 +1910,7 @@ var Machine = class extends EventEmitter__default.default {
1900
1910
  const logger = this.logger;
1901
1911
  let mastraProxy = void 0;
1902
1912
  if (this.#mastra) {
1903
- mastraProxy = chunkOHIRECYU_cjs.createMastraProxy({
1913
+ mastraProxy = chunkFXAV2WYX_cjs.createMastraProxy({
1904
1914
  mastra: this.#mastra,
1905
1915
  logger
1906
1916
  });
@@ -3278,7 +3288,7 @@ var WorkflowInstance = class {
3278
3288
  };
3279
3289
 
3280
3290
  // src/workflows/workflow.ts
3281
- var Workflow = class extends chunkD63P5O4Q_cjs.MastraBase {
3291
+ var Workflow = class extends chunkRO52JMKQ_cjs.MastraBase {
3282
3292
  name;
3283
3293
  triggerSchema;
3284
3294
  resultSchema;