@mastra/core 0.15.2 → 0.15.3-alpha.1

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 (163) hide show
  1. package/dist/agent/agent.types.d.ts +2 -0
  2. package/dist/agent/agent.types.d.ts.map +1 -1
  3. package/dist/agent/index.cjs +8 -8
  4. package/dist/agent/index.d.ts +0 -2
  5. package/dist/agent/index.d.ts.map +1 -1
  6. package/dist/agent/index.js +1 -1
  7. package/dist/agent/input-processor/index.cjs +6 -6
  8. package/dist/agent/input-processor/index.js +1 -1
  9. package/dist/ai-tracing/base.d.ts +3 -1
  10. package/dist/ai-tracing/base.d.ts.map +1 -1
  11. package/dist/ai-tracing/default.d.ts +1 -9
  12. package/dist/ai-tracing/default.d.ts.map +1 -1
  13. package/dist/ai-tracing/exporters/console.d.ts +10 -0
  14. package/dist/ai-tracing/exporters/console.d.ts.map +1 -0
  15. package/dist/ai-tracing/exporters/default.d.ts +97 -0
  16. package/dist/ai-tracing/exporters/default.d.ts.map +1 -0
  17. package/dist/ai-tracing/exporters/index.d.ts +6 -0
  18. package/dist/ai-tracing/exporters/index.d.ts.map +1 -0
  19. package/dist/ai-tracing/index.cjs +31 -27
  20. package/dist/ai-tracing/index.d.ts +1 -0
  21. package/dist/ai-tracing/index.d.ts.map +1 -1
  22. package/dist/ai-tracing/index.js +1 -1
  23. package/dist/ai-tracing/no-op.d.ts +8 -0
  24. package/dist/ai-tracing/no-op.d.ts.map +1 -1
  25. package/dist/ai-tracing/types.d.ts +33 -0
  26. package/dist/ai-tracing/types.d.ts.map +1 -1
  27. package/dist/{chunk-EQLCC3M7.cjs → chunk-4DKPMUAC.cjs} +646 -101
  28. package/dist/chunk-4DKPMUAC.cjs.map +1 -0
  29. package/dist/{chunk-QLRALF4I.js → chunk-5MCNXLGT.js} +6 -4
  30. package/dist/chunk-5MCNXLGT.js.map +1 -0
  31. package/dist/{chunk-RMEG4MOG.cjs → chunk-6VROHRAR.cjs} +45 -30
  32. package/dist/chunk-6VROHRAR.cjs.map +1 -0
  33. package/dist/{chunk-SNYSVGIU.cjs → chunk-6Z7D7CA3.cjs} +144 -113
  34. package/dist/chunk-6Z7D7CA3.cjs.map +1 -0
  35. package/dist/{chunk-HRPTZGDT.js → chunk-BRNBKCHE.js} +4 -4
  36. package/dist/chunk-BRNBKCHE.js.map +1 -0
  37. package/dist/{chunk-DAJYN7HG.cjs → chunk-CDLIHAX2.cjs} +4 -4
  38. package/dist/{chunk-DAJYN7HG.cjs.map → chunk-CDLIHAX2.cjs.map} +1 -1
  39. package/dist/{chunk-VKJWTAHZ.js → chunk-E3LAPNKY.js} +3 -3
  40. package/dist/{chunk-VKJWTAHZ.js.map → chunk-E3LAPNKY.js.map} +1 -1
  41. package/dist/{chunk-FCFQE5BD.js → chunk-FGCA6CCM.js} +130 -99
  42. package/dist/chunk-FGCA6CCM.js.map +1 -0
  43. package/dist/{chunk-FFGJPMKP.js → chunk-FLXWZUIG.js} +45 -30
  44. package/dist/chunk-FLXWZUIG.js.map +1 -0
  45. package/dist/{chunk-GVMFAUQR.cjs → chunk-GEPX327P.cjs} +12 -2
  46. package/dist/chunk-GEPX327P.cjs.map +1 -0
  47. package/dist/{chunk-DPE6K23N.cjs → chunk-HRDADYVX.cjs} +47 -8
  48. package/dist/chunk-HRDADYVX.cjs.map +1 -0
  49. package/dist/{chunk-UKQI74TN.cjs → chunk-K6UMYGK5.cjs} +17 -2
  50. package/dist/chunk-K6UMYGK5.cjs.map +1 -0
  51. package/dist/{chunk-XJFIB2FO.js → chunk-MKWJKRSX.js} +3 -3
  52. package/dist/{chunk-XJFIB2FO.js.map → chunk-MKWJKRSX.js.map} +1 -1
  53. package/dist/{chunk-7EXGDKNQ.cjs → chunk-QBNRMJAN.cjs} +4 -4
  54. package/dist/{chunk-7EXGDKNQ.cjs.map → chunk-QBNRMJAN.cjs.map} +1 -1
  55. package/dist/{chunk-6NYFECSO.js → chunk-TINMY4WA.js} +43 -4
  56. package/dist/chunk-TINMY4WA.js.map +1 -0
  57. package/dist/{chunk-G6WYC4SF.cjs → chunk-VBAWR62U.cjs} +7 -7
  58. package/dist/chunk-VBAWR62U.cjs.map +1 -0
  59. package/dist/{chunk-7TH2KSEC.js → chunk-WOTBMZCN.js} +645 -101
  60. package/dist/chunk-WOTBMZCN.js.map +1 -0
  61. package/dist/{chunk-ASRKKIW7.cjs → chunk-XEY3CWQW.cjs} +10 -8
  62. package/dist/chunk-XEY3CWQW.cjs.map +1 -0
  63. package/dist/{chunk-Y44DK4T5.js → chunk-YGW2WEJ5.js} +17 -2
  64. package/dist/chunk-YGW2WEJ5.js.map +1 -0
  65. package/dist/{chunk-IKOGUY3M.js → chunk-Z73WO76N.js} +4 -2
  66. package/dist/chunk-Z73WO76N.js.map +1 -0
  67. package/dist/index.cjs +52 -44
  68. package/dist/index.js +11 -10
  69. package/dist/index.js.map +1 -1
  70. package/dist/llm/model/model.d.ts.map +1 -1
  71. package/dist/llm/model/model.loop.d.ts +1 -1
  72. package/dist/llm/model/model.loop.d.ts.map +1 -1
  73. package/dist/loop/index.cjs +2 -2
  74. package/dist/loop/index.js +1 -1
  75. package/dist/loop/types.d.ts +1 -0
  76. package/dist/loop/types.d.ts.map +1 -1
  77. package/dist/mastra/index.cjs +2 -2
  78. package/dist/mastra/index.d.ts +8 -0
  79. package/dist/mastra/index.d.ts.map +1 -1
  80. package/dist/mastra/index.js +1 -1
  81. package/dist/memory/index.cjs +4 -4
  82. package/dist/memory/index.js +1 -1
  83. package/dist/network/index.cjs +2 -2
  84. package/dist/network/index.js +1 -1
  85. package/dist/network/vNext/index.cjs +15 -13
  86. package/dist/network/vNext/index.cjs.map +1 -1
  87. package/dist/network/vNext/index.d.ts.map +1 -1
  88. package/dist/network/vNext/index.js +4 -2
  89. package/dist/network/vNext/index.js.map +1 -1
  90. package/dist/processors/index.cjs +8 -8
  91. package/dist/processors/index.js +2 -2
  92. package/dist/relevance/index.cjs +4 -4
  93. package/dist/relevance/index.js +1 -1
  94. package/dist/scores/index.cjs +282 -88
  95. package/dist/scores/index.cjs.map +1 -1
  96. package/dist/scores/index.d.ts +1 -1
  97. package/dist/scores/index.js +279 -85
  98. package/dist/scores/index.js.map +1 -1
  99. package/dist/scores/run-experiment/index.d.ts +59 -0
  100. package/dist/scores/run-experiment/index.d.ts.map +1 -0
  101. package/dist/scores/run-experiment/scorerAccumulator.d.ts +12 -0
  102. package/dist/scores/run-experiment/scorerAccumulator.d.ts.map +1 -0
  103. package/dist/storage/base.d.ts +9 -0
  104. package/dist/storage/base.d.ts.map +1 -1
  105. package/dist/storage/domains/observability/base.d.ts +9 -0
  106. package/dist/storage/domains/observability/base.d.ts.map +1 -1
  107. package/dist/storage/domains/observability/index.d.ts +1 -0
  108. package/dist/storage/domains/observability/index.d.ts.map +1 -1
  109. package/dist/storage/domains/observability/inmemory.d.ts +5 -0
  110. package/dist/storage/domains/observability/inmemory.d.ts.map +1 -1
  111. package/dist/storage/index.cjs +24 -6
  112. package/dist/storage/index.cjs.map +1 -1
  113. package/dist/storage/index.js +20 -3
  114. package/dist/storage/index.js.map +1 -1
  115. package/dist/stream/index.cjs +3 -3
  116. package/dist/stream/index.js +1 -1
  117. package/dist/test-utils/llm-mock.cjs +2 -2
  118. package/dist/test-utils/llm-mock.js +1 -1
  119. package/dist/tools/tool-builder/builder.d.ts.map +1 -1
  120. package/dist/tools/types.d.ts +2 -2
  121. package/dist/tools/types.d.ts.map +1 -1
  122. package/dist/utils.cjs +16 -16
  123. package/dist/utils.js +1 -1
  124. package/dist/vector/embed.d.ts +3 -0
  125. package/dist/vector/embed.d.ts.map +1 -0
  126. package/dist/vector/index.cjs +10 -2
  127. package/dist/vector/index.d.ts +1 -0
  128. package/dist/vector/index.d.ts.map +1 -1
  129. package/dist/vector/index.js +1 -1
  130. package/dist/vector/vector.d.ts +3 -0
  131. package/dist/vector/vector.d.ts.map +1 -1
  132. package/dist/workflows/default.d.ts +25 -6
  133. package/dist/workflows/default.d.ts.map +1 -1
  134. package/dist/workflows/evented/index.cjs +10 -10
  135. package/dist/workflows/evented/index.js +1 -1
  136. package/dist/workflows/evented/workflow.d.ts.map +1 -1
  137. package/dist/workflows/execution-engine.d.ts +1 -0
  138. package/dist/workflows/execution-engine.d.ts.map +1 -1
  139. package/dist/workflows/index.cjs +10 -10
  140. package/dist/workflows/index.js +1 -1
  141. package/dist/workflows/legacy/index.cjs +22 -22
  142. package/dist/workflows/legacy/index.js +1 -1
  143. package/dist/workflows/workflow.d.ts +7 -0
  144. package/dist/workflows/workflow.d.ts.map +1 -1
  145. package/package.json +4 -4
  146. package/dist/chunk-6NYFECSO.js.map +0 -1
  147. package/dist/chunk-7TH2KSEC.js.map +0 -1
  148. package/dist/chunk-ASRKKIW7.cjs.map +0 -1
  149. package/dist/chunk-DPE6K23N.cjs.map +0 -1
  150. package/dist/chunk-EQLCC3M7.cjs.map +0 -1
  151. package/dist/chunk-FCFQE5BD.js.map +0 -1
  152. package/dist/chunk-FFGJPMKP.js.map +0 -1
  153. package/dist/chunk-G6WYC4SF.cjs.map +0 -1
  154. package/dist/chunk-GVMFAUQR.cjs.map +0 -1
  155. package/dist/chunk-HRPTZGDT.js.map +0 -1
  156. package/dist/chunk-IKOGUY3M.js.map +0 -1
  157. package/dist/chunk-QLRALF4I.js.map +0 -1
  158. package/dist/chunk-RMEG4MOG.cjs.map +0 -1
  159. package/dist/chunk-SNYSVGIU.cjs.map +0 -1
  160. package/dist/chunk-UKQI74TN.cjs.map +0 -1
  161. package/dist/chunk-Y44DK4T5.js.map +0 -1
  162. package/dist/scores/run-experiment.d.ts +0 -35
  163. package/dist/scores/run-experiment.d.ts.map +0 -1
@@ -3,14 +3,14 @@
3
3
  var chunkFBBP67MQ_cjs = require('./chunk-FBBP67MQ.cjs');
4
4
  var chunkNFXTYMWZ_cjs = require('./chunk-NFXTYMWZ.cjs');
5
5
  var chunkZOU4K5MI_cjs = require('./chunk-ZOU4K5MI.cjs');
6
- var chunkG6WYC4SF_cjs = require('./chunk-G6WYC4SF.cjs');
6
+ var chunkVBAWR62U_cjs = require('./chunk-VBAWR62U.cjs');
7
7
  var chunkQA2TWVUS_cjs = require('./chunk-QA2TWVUS.cjs');
8
8
  var chunkTSNDVBUU_cjs = require('./chunk-TSNDVBUU.cjs');
9
- var chunkRMEG4MOG_cjs = require('./chunk-RMEG4MOG.cjs');
9
+ var chunk6VROHRAR_cjs = require('./chunk-6VROHRAR.cjs');
10
10
  var chunkGPWMM745_cjs = require('./chunk-GPWMM745.cjs');
11
11
  var chunkS6MAHT7F_cjs = require('./chunk-S6MAHT7F.cjs');
12
12
  var chunkE4XQMNEI_cjs = require('./chunk-E4XQMNEI.cjs');
13
- var chunkEQLCC3M7_cjs = require('./chunk-EQLCC3M7.cjs');
13
+ var chunk4DKPMUAC_cjs = require('./chunk-4DKPMUAC.cjs');
14
14
  var chunkC73WLCY3_cjs = require('./chunk-C73WLCY3.cjs');
15
15
  var chunkKXCUCBEI_cjs = require('./chunk-KXCUCBEI.cjs');
16
16
  var chunkV5WKCX3G_cjs = require('./chunk-V5WKCX3G.cjs');
@@ -4052,6 +4052,7 @@ var MastraLLMVNext = class extends chunkKXCUCBEI_cjs.MastraBase {
4052
4052
  stream({
4053
4053
  messages,
4054
4054
  stopWhen = aiV5.stepCountIs(5),
4055
+ maxSteps,
4055
4056
  tools = {},
4056
4057
  runId,
4057
4058
  modelSettings,
@@ -4064,6 +4065,12 @@ var MastraLLMVNext = class extends chunkKXCUCBEI_cjs.MastraBase {
4064
4065
  outputProcessors
4065
4066
  // ...rest
4066
4067
  }) {
4068
+ let stopWhenToUse;
4069
+ if (maxSteps && typeof maxSteps === "number") {
4070
+ stopWhenToUse = aiV5.stepCountIs(maxSteps);
4071
+ } else {
4072
+ stopWhenToUse = stopWhen;
4073
+ }
4067
4074
  const model = this.#model;
4068
4075
  this.logger.debug(`[LLM] - Streaming text`, {
4069
4076
  runId,
@@ -4085,7 +4092,7 @@ var MastraLLMVNext = class extends chunkKXCUCBEI_cjs.MastraBase {
4085
4092
  messageList,
4086
4093
  model: this.#model,
4087
4094
  tools,
4088
- stopWhen,
4095
+ stopWhen: stopWhenToUse,
4089
4096
  toolChoice,
4090
4097
  modelSettings,
4091
4098
  telemetry_settings: {
@@ -4134,7 +4141,7 @@ var MastraLLMVNext = class extends chunkKXCUCBEI_cjs.MastraBase {
4134
4141
  this.logger.warn("Rate limit approaching, waiting 10 seconds", {
4135
4142
  runId
4136
4143
  });
4137
- await chunkRMEG4MOG_cjs.delay(10 * 1e3);
4144
+ await chunk6VROHRAR_cjs.delay(10 * 1e3);
4138
4145
  }
4139
4146
  },
4140
4147
  onFinish: async props => {
@@ -5020,7 +5027,7 @@ var Machine = class extends EventEmitter__default.default {
5020
5027
  const logger = this.logger;
5021
5028
  let mastraProxy = void 0;
5022
5029
  if (this.#mastra) {
5023
- mastraProxy = chunkRMEG4MOG_cjs.createMastraProxy({
5030
+ mastraProxy = chunk6VROHRAR_cjs.createMastraProxy({
5024
5031
  mastra: this.#mastra,
5025
5032
  logger
5026
5033
  });
@@ -9178,13 +9185,13 @@ exports.Agent = class Agent extends (_a = chunkKXCUCBEI_cjs.MastraBase) {
9178
9185
  this.logger.error(mastraError.toString());
9179
9186
  throw mastraError;
9180
9187
  }
9181
- return chunkRMEG4MOG_cjs.ensureToolProperties(this.#tools);
9188
+ return chunk6VROHRAR_cjs.ensureToolProperties(this.#tools);
9182
9189
  }
9183
9190
  getTools({
9184
9191
  runtimeContext = new chunkGPWMM745_cjs.RuntimeContext()
9185
9192
  } = {}) {
9186
9193
  if (typeof this.#tools !== "function") {
9187
- return chunkRMEG4MOG_cjs.ensureToolProperties(this.#tools);
9194
+ return chunk6VROHRAR_cjs.ensureToolProperties(this.#tools);
9188
9195
  }
9189
9196
  const result = this.#tools({
9190
9197
  runtimeContext,
@@ -9205,7 +9212,7 @@ exports.Agent = class Agent extends (_a = chunkKXCUCBEI_cjs.MastraBase) {
9205
9212
  this.logger.error(mastraError.toString());
9206
9213
  throw mastraError;
9207
9214
  }
9208
- return chunkRMEG4MOG_cjs.ensureToolProperties(tools);
9215
+ return chunk6VROHRAR_cjs.ensureToolProperties(tools);
9209
9216
  });
9210
9217
  }
9211
9218
  get llm() {
@@ -9249,7 +9256,7 @@ exports.Agent = class Agent extends (_a = chunkKXCUCBEI_cjs.MastraBase) {
9249
9256
  mastra: this.#mastra
9250
9257
  });
9251
9258
  } else {
9252
- llm = new chunkG6WYC4SF_cjs.MastraLLMV1({
9259
+ llm = new chunkVBAWR62U_cjs.MastraLLMV1({
9253
9260
  model: resolvedModel,
9254
9261
  mastra: this.#mastra
9255
9262
  });
@@ -9546,7 +9553,7 @@ exports.Agent = class Agent extends (_a = chunkKXCUCBEI_cjs.MastraBase) {
9546
9553
  }) : this.model,
9547
9554
  agentAISpan
9548
9555
  };
9549
- const convertedToCoreTool = chunkRMEG4MOG_cjs.makeCoreTool(toolObj, options);
9556
+ const convertedToCoreTool = chunk6VROHRAR_cjs.makeCoreTool(toolObj, options);
9550
9557
  convertedMemoryTools[toolName] = convertedToCoreTool;
9551
9558
  }
9552
9559
  }
@@ -9715,7 +9722,7 @@ exports.Agent = class Agent extends (_a = chunkKXCUCBEI_cjs.MastraBase) {
9715
9722
  writableStream,
9716
9723
  agentAISpan
9717
9724
  };
9718
- return [k, chunkRMEG4MOG_cjs.makeCoreTool(tool, options)];
9725
+ return [k, chunk6VROHRAR_cjs.makeCoreTool(tool, options)];
9719
9726
  }));
9720
9727
  const assignedToolEntriesConverted = Object.fromEntries(assignedCoreToolEntries.filter(entry => Boolean(entry)));
9721
9728
  toolsForRequest = {
@@ -9759,7 +9766,7 @@ exports.Agent = class Agent extends (_a = chunkKXCUCBEI_cjs.MastraBase) {
9759
9766
  }) : this.model,
9760
9767
  agentAISpan
9761
9768
  };
9762
- const convertedToCoreTool = chunkRMEG4MOG_cjs.makeCoreTool(toolObj, options, "toolset");
9769
+ const convertedToCoreTool = chunk6VROHRAR_cjs.makeCoreTool(toolObj, options, "toolset");
9763
9770
  toolsForRequest[toolName] = convertedToCoreTool;
9764
9771
  }
9765
9772
  }
@@ -9804,7 +9811,7 @@ exports.Agent = class Agent extends (_a = chunkKXCUCBEI_cjs.MastraBase) {
9804
9811
  }) : this.model,
9805
9812
  agentAISpan
9806
9813
  };
9807
- const convertedToCoreTool = chunkRMEG4MOG_cjs.makeCoreTool(rest, options, "client-tool");
9814
+ const convertedToCoreTool = chunk6VROHRAR_cjs.makeCoreTool(rest, options, "client-tool");
9808
9815
  toolsForRequest[toolName] = convertedToCoreTool;
9809
9816
  }
9810
9817
  }
@@ -9887,42 +9894,6 @@ exports.Agent = class Agent extends (_a = chunkKXCUCBEI_cjs.MastraBase) {
9887
9894
  }
9888
9895
  return convertedWorkflowTools;
9889
9896
  }
9890
- _wrapToolWithAITracing(tool, toolType, aiSpan) {
9891
- if (!aiSpan || !tool.execute) {
9892
- return tool;
9893
- }
9894
- const wrappedExecute = async (params, options) => {
9895
- const toolSpan = aiSpan.createChildSpan({
9896
- type: "tool_call" /* TOOL_CALL */,
9897
- name: `tool: ${tool.id}`,
9898
- input: params,
9899
- attributes: {
9900
- toolId: tool.id,
9901
- toolDescription: tool.description,
9902
- toolType
9903
- }
9904
- });
9905
- try {
9906
- const result = await tool.execute?.(params, options);
9907
- toolSpan.end({
9908
- output: result
9909
- });
9910
- return result;
9911
- } catch (error) {
9912
- toolSpan.error({
9913
- error
9914
- });
9915
- throw error;
9916
- }
9917
- };
9918
- return {
9919
- ...tool,
9920
- execute: wrappedExecute
9921
- };
9922
- }
9923
- _wrapToolsWithAITracing(tools, toolType, agentAISpan) {
9924
- return Object.fromEntries(Object.entries(tools).map(([key, tool]) => [key, this._wrapToolWithAITracing(tool, toolType, agentAISpan)]));
9925
- }
9926
9897
  async convertTools({
9927
9898
  toolsets,
9928
9899
  clientTools,
@@ -9936,7 +9907,7 @@ exports.Agent = class Agent extends (_a = chunkKXCUCBEI_cjs.MastraBase) {
9936
9907
  let mastraProxy = void 0;
9937
9908
  const logger = this.logger;
9938
9909
  if (this.#mastra) {
9939
- mastraProxy = chunkRMEG4MOG_cjs.createMastraProxy({
9910
+ mastraProxy = chunk6VROHRAR_cjs.createMastraProxy({
9940
9911
  mastra: this.#mastra,
9941
9912
  logger
9942
9913
  });
@@ -9984,12 +9955,11 @@ exports.Agent = class Agent extends (_a = chunkKXCUCBEI_cjs.MastraBase) {
9984
9955
  agentAISpan
9985
9956
  });
9986
9957
  return this.formatTools({
9987
- ...this._wrapToolsWithAITracing(assignedTools, "assigned", agentAISpan),
9988
- ...this._wrapToolsWithAITracing(memoryTools, "memory", agentAISpan),
9989
- ...this._wrapToolsWithAITracing(toolsetTools, "toolset", agentAISpan),
9990
- ...this._wrapToolsWithAITracing(clientSideTools, "client", agentAISpan),
9958
+ ...assignedTools,
9959
+ ...memoryTools,
9960
+ ...toolsetTools,
9961
+ ...clientSideTools,
9991
9962
  ...workflowTools
9992
- //workflow tools are already wrapped with AI tracing
9993
9963
  });
9994
9964
  }
9995
9965
  formatTools(tools) {
@@ -10096,7 +10066,7 @@ exports.Agent = class Agent extends (_a = chunkKXCUCBEI_cjs.MastraBase) {
10096
10066
  ...spanArgs
10097
10067
  });
10098
10068
  } else {
10099
- const aiTracing = chunkEQLCC3M7_cjs.getSelectedAITracing({
10069
+ const aiTracing = chunk4DKPMUAC_cjs.getSelectedAITracing({
10100
10070
  runtimeContext
10101
10071
  });
10102
10072
  if (aiTracing) {
@@ -11125,6 +11095,7 @@ Message ${msg.threadId && msg.threadId !== threadObject.id ? "from previous conv
11125
11095
  threadId: result.threadId,
11126
11096
  structuredOutput: result.structuredOutput,
11127
11097
  stopWhen: result.stopWhen,
11098
+ maxSteps: result.maxSteps,
11128
11099
  options: {
11129
11100
  onFinish: async payload => {
11130
11101
  if (payload.finishReason === "error") {
@@ -12180,7 +12151,8 @@ var DefaultExecutionEngine = class extends ExecutionEngine {
12180
12151
  resume,
12181
12152
  retryConfig,
12182
12153
  runtimeContext,
12183
- currentSpan
12154
+ currentSpan,
12155
+ disableScorers
12184
12156
  } = params;
12185
12157
  const {
12186
12158
  attempts = 0,
@@ -12202,7 +12174,7 @@ var DefaultExecutionEngine = class extends ExecutionEngine {
12202
12174
  ...spanArgs
12203
12175
  });
12204
12176
  } else {
12205
- const aiTracing = chunkEQLCC3M7_cjs.getSelectedAITracing({
12177
+ const aiTracing = chunk4DKPMUAC_cjs.getSelectedAITracing({
12206
12178
  runtimeContext
12207
12179
  });
12208
12180
  if (aiTracing) {
@@ -12270,7 +12242,8 @@ var DefaultExecutionEngine = class extends ExecutionEngine {
12270
12242
  abortController: params.abortController,
12271
12243
  emitter: params.emitter,
12272
12244
  runtimeContext: params.runtimeContext,
12273
- writableStream: params.writableStream
12245
+ writableStream: params.writableStream,
12246
+ disableScorers
12274
12247
  });
12275
12248
  if (lastOutput.result.status !== "success") {
12276
12249
  if (lastOutput.result.status === "bailed") {
@@ -12605,6 +12578,7 @@ var DefaultExecutionEngine = class extends ExecutionEngine {
12605
12578
  runtimeContext,
12606
12579
  skipEmits = false,
12607
12580
  writableStream,
12581
+ disableScorers,
12608
12582
  serializedStepGraph,
12609
12583
  tracingContext
12610
12584
  }) {
@@ -12709,7 +12683,7 @@ var DefaultExecutionEngine = class extends ExecutionEngine {
12709
12683
  const result = await runStep({
12710
12684
  runId,
12711
12685
  workflowId,
12712
- mastra: this.mastra ? chunkEQLCC3M7_cjs.wrapMastra(this.mastra, {
12686
+ mastra: this.mastra ? chunk4DKPMUAC_cjs.wrapMastra(this.mastra, {
12713
12687
  currentSpan: stepAISpan
12714
12688
  }) : void 0,
12715
12689
  runtimeContext,
@@ -12760,8 +12734,22 @@ var DefaultExecutionEngine = class extends ExecutionEngine {
12760
12734
  callId: stepCallId,
12761
12735
  name: step.id,
12762
12736
  runId
12763
- }, writableStream)
12737
+ }, writableStream),
12738
+ // Disable scorers must be explicitly set to false they are on by default
12739
+ scorers: disableScorers === false ? void 0 : step.scorers
12764
12740
  });
12741
+ if (step.scorers) {
12742
+ await this.runScorers({
12743
+ scorers: step.scorers,
12744
+ runId,
12745
+ input: prevOutput,
12746
+ output: result,
12747
+ workflowId,
12748
+ stepId: step.id,
12749
+ runtimeContext,
12750
+ disableScorers
12751
+ });
12752
+ }
12765
12753
  if (suspended) {
12766
12754
  execResults = {
12767
12755
  status: "suspended",
@@ -12873,6 +12861,57 @@ var DefaultExecutionEngine = class extends ExecutionEngine {
12873
12861
  ...execResults
12874
12862
  };
12875
12863
  }
12864
+ async runScorers({
12865
+ scorers,
12866
+ runId,
12867
+ input,
12868
+ output,
12869
+ workflowId,
12870
+ stepId,
12871
+ runtimeContext,
12872
+ disableScorers
12873
+ }) {
12874
+ let scorersToUse = scorers;
12875
+ if (typeof scorersToUse === "function") {
12876
+ try {
12877
+ scorersToUse = await scorersToUse({
12878
+ runtimeContext
12879
+ });
12880
+ } catch (error) {
12881
+ const mastraError = new chunkC73WLCY3_cjs.MastraError({
12882
+ id: "WORKFLOW_FAILED_TO_FETCH_SCORERS",
12883
+ domain: "MASTRA_WORKFLOW",
12884
+ category: "USER" /* USER */,
12885
+ details: {
12886
+ runId,
12887
+ workflowId,
12888
+ stepId
12889
+ }
12890
+ }, error);
12891
+ this.logger.trackException(mastraError);
12892
+ this.logger.error(mastraError.toString(), error);
12893
+ }
12894
+ }
12895
+ if (!disableScorers && scorersToUse && Object.keys(scorersToUse || {}).length > 0) {
12896
+ for (const [id, scorerObject] of Object.entries(scorersToUse || {})) {
12897
+ runScorer({
12898
+ scorerId: id,
12899
+ scorerObject,
12900
+ runId,
12901
+ input: [input],
12902
+ output,
12903
+ runtimeContext,
12904
+ entity: {
12905
+ id: workflowId,
12906
+ stepId
12907
+ },
12908
+ structuredOutput: true,
12909
+ source: "LIVE",
12910
+ entityType: "WORKFLOW"
12911
+ });
12912
+ }
12913
+ }
12914
+ }
12876
12915
  async executeParallel({
12877
12916
  workflowId,
12878
12917
  runId,
@@ -12886,7 +12925,8 @@ var DefaultExecutionEngine = class extends ExecutionEngine {
12886
12925
  emitter,
12887
12926
  abortController,
12888
12927
  runtimeContext,
12889
- writableStream
12928
+ writableStream,
12929
+ disableScorers
12890
12930
  }) {
12891
12931
  const parallelSpan = tracingContext.currentSpan?.createChildSpan({
12892
12932
  type: "workflow_parallel" /* WORKFLOW_PARALLEL */,
@@ -12920,7 +12960,8 @@ var DefaultExecutionEngine = class extends ExecutionEngine {
12920
12960
  emitter,
12921
12961
  abortController,
12922
12962
  runtimeContext,
12923
- writableStream
12963
+ writableStream,
12964
+ disableScorers
12924
12965
  })));
12925
12966
  const hasFailed = results.find(result => result.result.status === "failed");
12926
12967
  const hasSuspended = results.find(result => result.result.status === "suspended");
@@ -12974,7 +13015,8 @@ var DefaultExecutionEngine = class extends ExecutionEngine {
12974
13015
  emitter,
12975
13016
  abortController,
12976
13017
  runtimeContext,
12977
- writableStream
13018
+ writableStream,
13019
+ disableScorers
12978
13020
  }) {
12979
13021
  const conditionalSpan = tracingContext.currentSpan?.createChildSpan({
12980
13022
  type: "workflow_conditional" /* WORKFLOW_CONDITIONAL */,
@@ -13096,7 +13138,8 @@ var DefaultExecutionEngine = class extends ExecutionEngine {
13096
13138
  emitter,
13097
13139
  abortController,
13098
13140
  runtimeContext,
13099
- writableStream
13141
+ writableStream,
13142
+ disableScorers
13100
13143
  })));
13101
13144
  const mergedStepResults = {
13102
13145
  ...stepResults
@@ -13173,6 +13216,7 @@ var DefaultExecutionEngine = class extends ExecutionEngine {
13173
13216
  abortController,
13174
13217
  runtimeContext,
13175
13218
  writableStream,
13219
+ disableScorers,
13176
13220
  serializedStepGraph
13177
13221
  }) {
13178
13222
  const {
@@ -13211,6 +13255,7 @@ var DefaultExecutionEngine = class extends ExecutionEngine {
13211
13255
  abortController,
13212
13256
  runtimeContext,
13213
13257
  writableStream,
13258
+ disableScorers,
13214
13259
  serializedStepGraph
13215
13260
  });
13216
13261
  if (currentResume && result.status !== "suspended") {
@@ -13291,6 +13336,7 @@ var DefaultExecutionEngine = class extends ExecutionEngine {
13291
13336
  abortController,
13292
13337
  runtimeContext,
13293
13338
  writableStream,
13339
+ disableScorers,
13294
13340
  serializedStepGraph
13295
13341
  }) {
13296
13342
  const {
@@ -13372,6 +13418,7 @@ var DefaultExecutionEngine = class extends ExecutionEngine {
13372
13418
  runtimeContext,
13373
13419
  skipEmits: true,
13374
13420
  writableStream,
13421
+ disableScorers,
13375
13422
  serializedStepGraph
13376
13423
  });
13377
13424
  }));
@@ -13556,7 +13603,8 @@ var DefaultExecutionEngine = class extends ExecutionEngine {
13556
13603
  emitter,
13557
13604
  abortController,
13558
13605
  runtimeContext,
13559
- writableStream
13606
+ writableStream,
13607
+ disableScorers
13560
13608
  }) {
13561
13609
  const prevOutput = this.getStepOutput(stepResults, prevStep);
13562
13610
  let execResults;
@@ -13577,6 +13625,7 @@ var DefaultExecutionEngine = class extends ExecutionEngine {
13577
13625
  abortController,
13578
13626
  runtimeContext,
13579
13627
  writableStream,
13628
+ disableScorers,
13580
13629
  serializedStepGraph
13581
13630
  });
13582
13631
  } else if (resume?.resumePath?.length && entry.type === "parallel") {
@@ -13601,7 +13650,8 @@ var DefaultExecutionEngine = class extends ExecutionEngine {
13601
13650
  emitter,
13602
13651
  abortController,
13603
13652
  runtimeContext,
13604
- writableStream
13653
+ writableStream,
13654
+ disableScorers
13605
13655
  });
13606
13656
  if (resumedStepResult.stepResults) {
13607
13657
  Object.assign(stepResults, resumedStepResult.stepResults);
@@ -13676,7 +13726,8 @@ var DefaultExecutionEngine = class extends ExecutionEngine {
13676
13726
  emitter,
13677
13727
  abortController,
13678
13728
  runtimeContext,
13679
- writableStream
13729
+ writableStream,
13730
+ disableScorers
13680
13731
  });
13681
13732
  } else if (entry.type === "conditional") {
13682
13733
  execResults = await this.executeConditional({
@@ -13693,7 +13744,8 @@ var DefaultExecutionEngine = class extends ExecutionEngine {
13693
13744
  emitter,
13694
13745
  abortController,
13695
13746
  runtimeContext,
13696
- writableStream
13747
+ writableStream,
13748
+ disableScorers
13697
13749
  });
13698
13750
  } else if (entry.type === "loop") {
13699
13751
  execResults = await this.executeLoop({
@@ -13710,6 +13762,7 @@ var DefaultExecutionEngine = class extends ExecutionEngine {
13710
13762
  abortController,
13711
13763
  runtimeContext,
13712
13764
  writableStream,
13765
+ disableScorers,
13713
13766
  serializedStepGraph
13714
13767
  });
13715
13768
  } else if (entry.type === "foreach") {
@@ -13727,6 +13780,7 @@ var DefaultExecutionEngine = class extends ExecutionEngine {
13727
13780
  abortController,
13728
13781
  runtimeContext,
13729
13782
  writableStream,
13783
+ disableScorers,
13730
13784
  serializedStepGraph
13731
13785
  });
13732
13786
  } else if (entry.type === "sleep") {
@@ -14047,6 +14101,7 @@ var DefaultExecutionEngine = class extends ExecutionEngine {
14047
14101
  abortController,
14048
14102
  runtimeContext,
14049
14103
  writableStream,
14104
+ disableScorers,
14050
14105
  serializedStepGraph
14051
14106
  });
14052
14107
  } catch (error) {
@@ -14097,40 +14152,6 @@ function mapVariable(config) {
14097
14152
  return config;
14098
14153
  }
14099
14154
  function createStep(params) {
14100
- const wrapExecute = execute2 => {
14101
- return async executeParams => {
14102
- const executeResult = await execute2(executeParams);
14103
- if (params instanceof exports.Agent || params instanceof chunkE4XQMNEI_cjs.Tool) {
14104
- return executeResult;
14105
- }
14106
- let scorersToUse = params.scorers;
14107
- if (typeof scorersToUse === "function") {
14108
- scorersToUse = await scorersToUse({
14109
- runtimeContext: executeParams.runtimeContext
14110
- });
14111
- }
14112
- if (scorersToUse && Object.keys(scorersToUse || {}).length > 0) {
14113
- for (const [id, scorerObject] of Object.entries(scorersToUse || {})) {
14114
- runScorer({
14115
- scorerId: id,
14116
- scorerObject,
14117
- runId: executeParams.runId,
14118
- input: [executeParams.inputData],
14119
- output: executeResult,
14120
- runtimeContext: executeParams.runtimeContext,
14121
- entity: {
14122
- id: executeParams.workflowId,
14123
- stepId: params.id
14124
- },
14125
- structuredOutput: true,
14126
- source: "LIVE",
14127
- entityType: "WORKFLOW"
14128
- });
14129
- }
14130
- }
14131
- return executeResult;
14132
- };
14133
- };
14134
14155
  if (params instanceof exports.Agent) {
14135
14156
  return {
14136
14157
  id: params.name,
@@ -14144,7 +14165,7 @@ function createStep(params) {
14144
14165
  outputSchema: z.z.object({
14145
14166
  text: z.z.string()
14146
14167
  }),
14147
- execute: wrapExecute(async ({
14168
+ execute: async ({
14148
14169
  inputData,
14149
14170
  [chunkNFXTYMWZ_cjs.EMITTER_SYMBOL]: emitter,
14150
14171
  runtimeContext,
@@ -14205,7 +14226,7 @@ function createStep(params) {
14205
14226
  return {
14206
14227
  text: await streamPromise.promise
14207
14228
  };
14208
- })
14229
+ }
14209
14230
  };
14210
14231
  }
14211
14232
  if (params instanceof chunkE4XQMNEI_cjs.Tool) {
@@ -14218,17 +14239,19 @@ function createStep(params) {
14218
14239
  id: params.id,
14219
14240
  inputSchema: params.inputSchema,
14220
14241
  outputSchema: params.outputSchema,
14221
- execute: wrapExecute(async ({
14242
+ execute: async ({
14222
14243
  inputData,
14223
14244
  mastra,
14224
- runtimeContext
14245
+ runtimeContext,
14246
+ tracingContext
14225
14247
  }) => {
14226
14248
  return params.execute({
14227
14249
  context: inputData,
14228
14250
  mastra,
14229
- runtimeContext
14251
+ runtimeContext,
14252
+ tracingContext
14230
14253
  });
14231
- })
14254
+ }
14232
14255
  };
14233
14256
  }
14234
14257
  return {
@@ -14240,7 +14263,7 @@ function createStep(params) {
14240
14263
  suspendSchema: params.suspendSchema,
14241
14264
  scorers: params.scorers,
14242
14265
  retries: params.retries,
14243
- execute: wrapExecute(params.execute)
14266
+ execute: params.execute
14244
14267
  };
14245
14268
  }
14246
14269
  function cloneStep(step, opts) {
@@ -14743,6 +14766,7 @@ var Workflow = class extends chunkKXCUCBEI_cjs.MastraBase {
14743
14766
  mastra: this.#mastra,
14744
14767
  retryConfig: this.retryConfig,
14745
14768
  serializedStepGraph: this.serializedStepGraph,
14769
+ disableScorers: options?.disableScorers,
14746
14770
  cleanup: () => this.#runs.delete(runIdToUse)
14747
14771
  });
14748
14772
  this.#runs.set(runIdToUse, run);
@@ -14770,6 +14794,7 @@ var Workflow = class extends chunkKXCUCBEI_cjs.MastraBase {
14770
14794
  mastra: this.#mastra,
14771
14795
  retryConfig: this.retryConfig,
14772
14796
  serializedStepGraph: this.serializedStepGraph,
14797
+ disableScorers: options?.disableScorers,
14773
14798
  cleanup: () => this.#runs.delete(runIdToUse)
14774
14799
  });
14775
14800
  this.#runs.set(runIdToUse, run);
@@ -14969,6 +14994,10 @@ var Run = class {
14969
14994
  * Unique identifier for this run
14970
14995
  */
14971
14996
  runId;
14997
+ /**
14998
+ * Whether to disable scorers for this run
14999
+ */
15000
+ disableScorers;
14972
15001
  /**
14973
15002
  * Internal state of the workflow run
14974
15003
  */
@@ -15006,6 +15035,7 @@ var Run = class {
15006
15035
  this.emitter = new EventEmitter__default.default();
15007
15036
  this.retryConfig = params.retryConfig;
15008
15037
  this.cleanup = params.cleanup;
15038
+ this.disableScorers = params.disableScorers;
15009
15039
  }
15010
15040
  get abortController() {
15011
15041
  if (!this.#abortController) {
@@ -15036,6 +15066,7 @@ var Run = class {
15036
15066
  const result = await this.executionEngine.execute({
15037
15067
  workflowId: this.workflowId,
15038
15068
  runId: this.runId,
15069
+ disableScorers: this.disableScorers,
15039
15070
  graph: this.executionGraph,
15040
15071
  serializedStepGraph: this.serializedStepGraph,
15041
15072
  input: inputData,
@@ -15499,5 +15530,5 @@ exports.recursivelyCheckForFinalState = recursivelyCheckForFinalState;
15499
15530
  exports.resolveVariables = resolveVariables;
15500
15531
  exports.updateStepInHierarchy = updateStepInHierarchy;
15501
15532
  exports.workflowToStep = workflowToStep;
15502
- //# sourceMappingURL=chunk-SNYSVGIU.cjs.map
15503
- //# sourceMappingURL=chunk-SNYSVGIU.cjs.map
15533
+ //# sourceMappingURL=chunk-6Z7D7CA3.cjs.map
15534
+ //# sourceMappingURL=chunk-6Z7D7CA3.cjs.map