@mastra/core 0.15.2 → 0.15.3-alpha.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 (145) 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-DPE6K23N.cjs → chunk-2KK7QQH2.cjs} +47 -8
  28. package/dist/chunk-2KK7QQH2.cjs.map +1 -0
  29. package/dist/{chunk-EQLCC3M7.cjs → chunk-4DKPMUAC.cjs} +646 -101
  30. package/dist/chunk-4DKPMUAC.cjs.map +1 -0
  31. package/dist/{chunk-FCFQE5BD.js → chunk-6JAIHLZY.js} +130 -99
  32. package/dist/chunk-6JAIHLZY.js.map +1 -0
  33. package/dist/{chunk-RMEG4MOG.cjs → chunk-6VROHRAR.cjs} +45 -30
  34. package/dist/chunk-6VROHRAR.cjs.map +1 -0
  35. package/dist/{chunk-DAJYN7HG.cjs → chunk-7U76TYYN.cjs} +4 -4
  36. package/dist/{chunk-DAJYN7HG.cjs.map → chunk-7U76TYYN.cjs.map} +1 -1
  37. package/dist/{chunk-VKJWTAHZ.js → chunk-E3LAPNKY.js} +3 -3
  38. package/dist/{chunk-VKJWTAHZ.js.map → chunk-E3LAPNKY.js.map} +1 -1
  39. package/dist/{chunk-QLRALF4I.js → chunk-EEGBKQYC.js} +6 -4
  40. package/dist/chunk-EEGBKQYC.js.map +1 -0
  41. package/dist/{chunk-FFGJPMKP.js → chunk-FLXWZUIG.js} +45 -30
  42. package/dist/chunk-FLXWZUIG.js.map +1 -0
  43. package/dist/{chunk-SNYSVGIU.cjs → chunk-I2YGYG3Y.cjs} +144 -113
  44. package/dist/chunk-I2YGYG3Y.cjs.map +1 -0
  45. package/dist/{chunk-HRPTZGDT.js → chunk-IAOFOXVA.js} +3 -3
  46. package/dist/{chunk-HRPTZGDT.js.map → chunk-IAOFOXVA.js.map} +1 -1
  47. package/dist/{chunk-UKQI74TN.cjs → chunk-K6UMYGK5.cjs} +17 -2
  48. package/dist/chunk-K6UMYGK5.cjs.map +1 -0
  49. package/dist/{chunk-XJFIB2FO.js → chunk-Q67FV4QB.js} +3 -3
  50. package/dist/{chunk-XJFIB2FO.js.map → chunk-Q67FV4QB.js.map} +1 -1
  51. package/dist/{chunk-7EXGDKNQ.cjs → chunk-QBNRMJAN.cjs} +4 -4
  52. package/dist/{chunk-7EXGDKNQ.cjs.map → chunk-QBNRMJAN.cjs.map} +1 -1
  53. package/dist/{chunk-G6WYC4SF.cjs → chunk-SFLYVXLG.cjs} +6 -6
  54. package/dist/{chunk-G6WYC4SF.cjs.map → chunk-SFLYVXLG.cjs.map} +1 -1
  55. package/dist/{chunk-7TH2KSEC.js → chunk-WOTBMZCN.js} +645 -101
  56. package/dist/chunk-WOTBMZCN.js.map +1 -0
  57. package/dist/{chunk-6NYFECSO.js → chunk-Y3WIANDM.js} +43 -4
  58. package/dist/chunk-Y3WIANDM.js.map +1 -0
  59. package/dist/{chunk-Y44DK4T5.js → chunk-YGW2WEJ5.js} +17 -2
  60. package/dist/chunk-YGW2WEJ5.js.map +1 -0
  61. package/dist/{chunk-ASRKKIW7.cjs → chunk-YPT3YX6U.cjs} +10 -8
  62. package/dist/chunk-YPT3YX6U.cjs.map +1 -0
  63. package/dist/index.cjs +42 -42
  64. package/dist/index.js +9 -9
  65. package/dist/llm/model/model.loop.d.ts +1 -1
  66. package/dist/llm/model/model.loop.d.ts.map +1 -1
  67. package/dist/loop/index.cjs +2 -2
  68. package/dist/loop/index.js +1 -1
  69. package/dist/loop/types.d.ts +1 -0
  70. package/dist/loop/types.d.ts.map +1 -1
  71. package/dist/mastra/index.cjs +2 -2
  72. package/dist/mastra/index.d.ts +8 -0
  73. package/dist/mastra/index.d.ts.map +1 -1
  74. package/dist/mastra/index.js +1 -1
  75. package/dist/memory/index.cjs +4 -4
  76. package/dist/memory/index.js +1 -1
  77. package/dist/network/index.cjs +2 -2
  78. package/dist/network/index.js +1 -1
  79. package/dist/network/vNext/index.cjs +15 -13
  80. package/dist/network/vNext/index.cjs.map +1 -1
  81. package/dist/network/vNext/index.d.ts.map +1 -1
  82. package/dist/network/vNext/index.js +4 -2
  83. package/dist/network/vNext/index.js.map +1 -1
  84. package/dist/processors/index.cjs +8 -8
  85. package/dist/processors/index.js +2 -2
  86. package/dist/relevance/index.cjs +4 -4
  87. package/dist/relevance/index.js +1 -1
  88. package/dist/scores/index.cjs +282 -88
  89. package/dist/scores/index.cjs.map +1 -1
  90. package/dist/scores/index.d.ts +1 -1
  91. package/dist/scores/index.js +279 -85
  92. package/dist/scores/index.js.map +1 -1
  93. package/dist/scores/run-experiment/index.d.ts +59 -0
  94. package/dist/scores/run-experiment/index.d.ts.map +1 -0
  95. package/dist/scores/run-experiment/scorerAccumulator.d.ts +12 -0
  96. package/dist/scores/run-experiment/scorerAccumulator.d.ts.map +1 -0
  97. package/dist/storage/base.d.ts +9 -0
  98. package/dist/storage/base.d.ts.map +1 -1
  99. package/dist/storage/domains/observability/base.d.ts +9 -0
  100. package/dist/storage/domains/observability/base.d.ts.map +1 -1
  101. package/dist/storage/domains/observability/index.d.ts +1 -0
  102. package/dist/storage/domains/observability/index.d.ts.map +1 -1
  103. package/dist/storage/domains/observability/inmemory.d.ts +5 -0
  104. package/dist/storage/domains/observability/inmemory.d.ts.map +1 -1
  105. package/dist/storage/index.cjs +24 -6
  106. package/dist/storage/index.cjs.map +1 -1
  107. package/dist/storage/index.js +20 -3
  108. package/dist/storage/index.js.map +1 -1
  109. package/dist/stream/index.cjs +3 -3
  110. package/dist/stream/index.js +1 -1
  111. package/dist/test-utils/llm-mock.cjs +2 -2
  112. package/dist/test-utils/llm-mock.js +1 -1
  113. package/dist/tools/tool-builder/builder.d.ts.map +1 -1
  114. package/dist/tools/types.d.ts +2 -2
  115. package/dist/tools/types.d.ts.map +1 -1
  116. package/dist/utils.cjs +16 -16
  117. package/dist/utils.js +1 -1
  118. package/dist/workflows/default.d.ts +25 -6
  119. package/dist/workflows/default.d.ts.map +1 -1
  120. package/dist/workflows/evented/index.cjs +10 -10
  121. package/dist/workflows/evented/index.js +1 -1
  122. package/dist/workflows/evented/workflow.d.ts.map +1 -1
  123. package/dist/workflows/execution-engine.d.ts +1 -0
  124. package/dist/workflows/execution-engine.d.ts.map +1 -1
  125. package/dist/workflows/index.cjs +10 -10
  126. package/dist/workflows/index.js +1 -1
  127. package/dist/workflows/legacy/index.cjs +22 -22
  128. package/dist/workflows/legacy/index.js +1 -1
  129. package/dist/workflows/workflow.d.ts +7 -0
  130. package/dist/workflows/workflow.d.ts.map +1 -1
  131. package/package.json +1 -1
  132. package/dist/chunk-6NYFECSO.js.map +0 -1
  133. package/dist/chunk-7TH2KSEC.js.map +0 -1
  134. package/dist/chunk-ASRKKIW7.cjs.map +0 -1
  135. package/dist/chunk-DPE6K23N.cjs.map +0 -1
  136. package/dist/chunk-EQLCC3M7.cjs.map +0 -1
  137. package/dist/chunk-FCFQE5BD.js.map +0 -1
  138. package/dist/chunk-FFGJPMKP.js.map +0 -1
  139. package/dist/chunk-QLRALF4I.js.map +0 -1
  140. package/dist/chunk-RMEG4MOG.cjs.map +0 -1
  141. package/dist/chunk-SNYSVGIU.cjs.map +0 -1
  142. package/dist/chunk-UKQI74TN.cjs.map +0 -1
  143. package/dist/chunk-Y44DK4T5.js.map +0 -1
  144. package/dist/scores/run-experiment.d.ts +0 -35
  145. package/dist/scores/run-experiment.d.ts.map +0 -1
@@ -1,14 +1,14 @@
1
1
  import { DefaultVoice } from './chunk-XM2ASGWH.js';
2
2
  import { EMITTER_SYMBOL } from './chunk-GK5V7YTQ.js';
3
3
  import { InstrumentClass, Telemetry } from './chunk-76MWMAR7.js';
4
- import { MastraLLMV1 } from './chunk-HRPTZGDT.js';
4
+ import { MastraLLMV1 } from './chunk-IAOFOXVA.js';
5
5
  import { MessageList, DefaultGeneratedFile, DefaultGeneratedFileWithType } from './chunk-C5C4PN54.js';
6
6
  import { executeHook } from './chunk-TTELJD4F.js';
7
- import { ensureToolProperties, makeCoreTool, createMastraProxy, delay } from './chunk-FFGJPMKP.js';
7
+ import { ensureToolProperties, makeCoreTool, createMastraProxy, delay } from './chunk-FLXWZUIG.js';
8
8
  import { RuntimeContext } from './chunk-HLRWYUFN.js';
9
9
  import { ToolStream } from './chunk-YW7UILPE.js';
10
10
  import { Tool } from './chunk-IVGAHFAJ.js';
11
- import { getSelectedAITracing, wrapMastra } from './chunk-7TH2KSEC.js';
11
+ import { getSelectedAITracing, wrapMastra } from './chunk-WOTBMZCN.js';
12
12
  import { MastraError } from './chunk-MCOVMKIS.js';
13
13
  import { MastraBase } from './chunk-6GF5M4GX.js';
14
14
  import { ConsoleLogger, RegisteredLogger } from './chunk-X3GXU6TZ.js';
@@ -4026,6 +4026,7 @@ var MastraLLMVNext = class extends MastraBase {
4026
4026
  stream({
4027
4027
  messages,
4028
4028
  stopWhen = stepCountIs(5),
4029
+ maxSteps,
4029
4030
  tools = {},
4030
4031
  runId,
4031
4032
  modelSettings,
@@ -4038,6 +4039,12 @@ var MastraLLMVNext = class extends MastraBase {
4038
4039
  outputProcessors
4039
4040
  // ...rest
4040
4041
  }) {
4042
+ let stopWhenToUse;
4043
+ if (maxSteps && typeof maxSteps === "number") {
4044
+ stopWhenToUse = stepCountIs(maxSteps);
4045
+ } else {
4046
+ stopWhenToUse = stopWhen;
4047
+ }
4041
4048
  const model = this.#model;
4042
4049
  this.logger.debug(`[LLM] - Streaming text`, {
4043
4050
  runId,
@@ -4059,7 +4066,7 @@ var MastraLLMVNext = class extends MastraBase {
4059
4066
  messageList,
4060
4067
  model: this.#model,
4061
4068
  tools,
4062
- stopWhen,
4069
+ stopWhen: stopWhenToUse,
4063
4070
  toolChoice,
4064
4071
  modelSettings,
4065
4072
  telemetry_settings: {
@@ -9861,42 +9868,6 @@ var Agent = class extends (_a = MastraBase) {
9861
9868
  }
9862
9869
  return convertedWorkflowTools;
9863
9870
  }
9864
- _wrapToolWithAITracing(tool, toolType, aiSpan) {
9865
- if (!aiSpan || !tool.execute) {
9866
- return tool;
9867
- }
9868
- const wrappedExecute = async (params, options) => {
9869
- const toolSpan = aiSpan.createChildSpan({
9870
- type: "tool_call" /* TOOL_CALL */,
9871
- name: `tool: ${tool.id}`,
9872
- input: params,
9873
- attributes: {
9874
- toolId: tool.id,
9875
- toolDescription: tool.description,
9876
- toolType
9877
- }
9878
- });
9879
- try {
9880
- const result = await tool.execute?.(params, options);
9881
- toolSpan.end({
9882
- output: result
9883
- });
9884
- return result;
9885
- } catch (error) {
9886
- toolSpan.error({
9887
- error
9888
- });
9889
- throw error;
9890
- }
9891
- };
9892
- return {
9893
- ...tool,
9894
- execute: wrappedExecute
9895
- };
9896
- }
9897
- _wrapToolsWithAITracing(tools, toolType, agentAISpan) {
9898
- return Object.fromEntries(Object.entries(tools).map(([key, tool]) => [key, this._wrapToolWithAITracing(tool, toolType, agentAISpan)]));
9899
- }
9900
9871
  async convertTools({
9901
9872
  toolsets,
9902
9873
  clientTools,
@@ -9958,12 +9929,11 @@ var Agent = class extends (_a = MastraBase) {
9958
9929
  agentAISpan
9959
9930
  });
9960
9931
  return this.formatTools({
9961
- ...this._wrapToolsWithAITracing(assignedTools, "assigned", agentAISpan),
9962
- ...this._wrapToolsWithAITracing(memoryTools, "memory", agentAISpan),
9963
- ...this._wrapToolsWithAITracing(toolsetTools, "toolset", agentAISpan),
9964
- ...this._wrapToolsWithAITracing(clientSideTools, "client", agentAISpan),
9932
+ ...assignedTools,
9933
+ ...memoryTools,
9934
+ ...toolsetTools,
9935
+ ...clientSideTools,
9965
9936
  ...workflowTools
9966
- //workflow tools are already wrapped with AI tracing
9967
9937
  });
9968
9938
  }
9969
9939
  formatTools(tools) {
@@ -11099,6 +11069,7 @@ Message ${msg.threadId && msg.threadId !== threadObject.id ? "from previous conv
11099
11069
  threadId: result.threadId,
11100
11070
  structuredOutput: result.structuredOutput,
11101
11071
  stopWhen: result.stopWhen,
11072
+ maxSteps: result.maxSteps,
11102
11073
  options: {
11103
11074
  onFinish: async payload => {
11104
11075
  if (payload.finishReason === "error") {
@@ -12154,7 +12125,8 @@ var DefaultExecutionEngine = class extends ExecutionEngine {
12154
12125
  resume,
12155
12126
  retryConfig,
12156
12127
  runtimeContext,
12157
- currentSpan
12128
+ currentSpan,
12129
+ disableScorers
12158
12130
  } = params;
12159
12131
  const {
12160
12132
  attempts = 0,
@@ -12244,7 +12216,8 @@ var DefaultExecutionEngine = class extends ExecutionEngine {
12244
12216
  abortController: params.abortController,
12245
12217
  emitter: params.emitter,
12246
12218
  runtimeContext: params.runtimeContext,
12247
- writableStream: params.writableStream
12219
+ writableStream: params.writableStream,
12220
+ disableScorers
12248
12221
  });
12249
12222
  if (lastOutput.result.status !== "success") {
12250
12223
  if (lastOutput.result.status === "bailed") {
@@ -12579,6 +12552,7 @@ var DefaultExecutionEngine = class extends ExecutionEngine {
12579
12552
  runtimeContext,
12580
12553
  skipEmits = false,
12581
12554
  writableStream,
12555
+ disableScorers,
12582
12556
  serializedStepGraph,
12583
12557
  tracingContext
12584
12558
  }) {
@@ -12734,8 +12708,22 @@ var DefaultExecutionEngine = class extends ExecutionEngine {
12734
12708
  callId: stepCallId,
12735
12709
  name: step.id,
12736
12710
  runId
12737
- }, writableStream)
12711
+ }, writableStream),
12712
+ // Disable scorers must be explicitly set to false they are on by default
12713
+ scorers: disableScorers === false ? void 0 : step.scorers
12738
12714
  });
12715
+ if (step.scorers) {
12716
+ await this.runScorers({
12717
+ scorers: step.scorers,
12718
+ runId,
12719
+ input: prevOutput,
12720
+ output: result,
12721
+ workflowId,
12722
+ stepId: step.id,
12723
+ runtimeContext,
12724
+ disableScorers
12725
+ });
12726
+ }
12739
12727
  if (suspended) {
12740
12728
  execResults = {
12741
12729
  status: "suspended",
@@ -12847,6 +12835,57 @@ var DefaultExecutionEngine = class extends ExecutionEngine {
12847
12835
  ...execResults
12848
12836
  };
12849
12837
  }
12838
+ async runScorers({
12839
+ scorers,
12840
+ runId,
12841
+ input,
12842
+ output,
12843
+ workflowId,
12844
+ stepId,
12845
+ runtimeContext,
12846
+ disableScorers
12847
+ }) {
12848
+ let scorersToUse = scorers;
12849
+ if (typeof scorersToUse === "function") {
12850
+ try {
12851
+ scorersToUse = await scorersToUse({
12852
+ runtimeContext
12853
+ });
12854
+ } catch (error) {
12855
+ const mastraError = new MastraError({
12856
+ id: "WORKFLOW_FAILED_TO_FETCH_SCORERS",
12857
+ domain: "MASTRA_WORKFLOW",
12858
+ category: "USER" /* USER */,
12859
+ details: {
12860
+ runId,
12861
+ workflowId,
12862
+ stepId
12863
+ }
12864
+ }, error);
12865
+ this.logger.trackException(mastraError);
12866
+ this.logger.error(mastraError.toString(), error);
12867
+ }
12868
+ }
12869
+ if (!disableScorers && scorersToUse && Object.keys(scorersToUse || {}).length > 0) {
12870
+ for (const [id, scorerObject] of Object.entries(scorersToUse || {})) {
12871
+ runScorer({
12872
+ scorerId: id,
12873
+ scorerObject,
12874
+ runId,
12875
+ input: [input],
12876
+ output,
12877
+ runtimeContext,
12878
+ entity: {
12879
+ id: workflowId,
12880
+ stepId
12881
+ },
12882
+ structuredOutput: true,
12883
+ source: "LIVE",
12884
+ entityType: "WORKFLOW"
12885
+ });
12886
+ }
12887
+ }
12888
+ }
12850
12889
  async executeParallel({
12851
12890
  workflowId,
12852
12891
  runId,
@@ -12860,7 +12899,8 @@ var DefaultExecutionEngine = class extends ExecutionEngine {
12860
12899
  emitter,
12861
12900
  abortController,
12862
12901
  runtimeContext,
12863
- writableStream
12902
+ writableStream,
12903
+ disableScorers
12864
12904
  }) {
12865
12905
  const parallelSpan = tracingContext.currentSpan?.createChildSpan({
12866
12906
  type: "workflow_parallel" /* WORKFLOW_PARALLEL */,
@@ -12894,7 +12934,8 @@ var DefaultExecutionEngine = class extends ExecutionEngine {
12894
12934
  emitter,
12895
12935
  abortController,
12896
12936
  runtimeContext,
12897
- writableStream
12937
+ writableStream,
12938
+ disableScorers
12898
12939
  })));
12899
12940
  const hasFailed = results.find(result => result.result.status === "failed");
12900
12941
  const hasSuspended = results.find(result => result.result.status === "suspended");
@@ -12948,7 +12989,8 @@ var DefaultExecutionEngine = class extends ExecutionEngine {
12948
12989
  emitter,
12949
12990
  abortController,
12950
12991
  runtimeContext,
12951
- writableStream
12992
+ writableStream,
12993
+ disableScorers
12952
12994
  }) {
12953
12995
  const conditionalSpan = tracingContext.currentSpan?.createChildSpan({
12954
12996
  type: "workflow_conditional" /* WORKFLOW_CONDITIONAL */,
@@ -13070,7 +13112,8 @@ var DefaultExecutionEngine = class extends ExecutionEngine {
13070
13112
  emitter,
13071
13113
  abortController,
13072
13114
  runtimeContext,
13073
- writableStream
13115
+ writableStream,
13116
+ disableScorers
13074
13117
  })));
13075
13118
  const mergedStepResults = {
13076
13119
  ...stepResults
@@ -13147,6 +13190,7 @@ var DefaultExecutionEngine = class extends ExecutionEngine {
13147
13190
  abortController,
13148
13191
  runtimeContext,
13149
13192
  writableStream,
13193
+ disableScorers,
13150
13194
  serializedStepGraph
13151
13195
  }) {
13152
13196
  const {
@@ -13185,6 +13229,7 @@ var DefaultExecutionEngine = class extends ExecutionEngine {
13185
13229
  abortController,
13186
13230
  runtimeContext,
13187
13231
  writableStream,
13232
+ disableScorers,
13188
13233
  serializedStepGraph
13189
13234
  });
13190
13235
  if (currentResume && result.status !== "suspended") {
@@ -13265,6 +13310,7 @@ var DefaultExecutionEngine = class extends ExecutionEngine {
13265
13310
  abortController,
13266
13311
  runtimeContext,
13267
13312
  writableStream,
13313
+ disableScorers,
13268
13314
  serializedStepGraph
13269
13315
  }) {
13270
13316
  const {
@@ -13346,6 +13392,7 @@ var DefaultExecutionEngine = class extends ExecutionEngine {
13346
13392
  runtimeContext,
13347
13393
  skipEmits: true,
13348
13394
  writableStream,
13395
+ disableScorers,
13349
13396
  serializedStepGraph
13350
13397
  });
13351
13398
  }));
@@ -13530,7 +13577,8 @@ var DefaultExecutionEngine = class extends ExecutionEngine {
13530
13577
  emitter,
13531
13578
  abortController,
13532
13579
  runtimeContext,
13533
- writableStream
13580
+ writableStream,
13581
+ disableScorers
13534
13582
  }) {
13535
13583
  const prevOutput = this.getStepOutput(stepResults, prevStep);
13536
13584
  let execResults;
@@ -13551,6 +13599,7 @@ var DefaultExecutionEngine = class extends ExecutionEngine {
13551
13599
  abortController,
13552
13600
  runtimeContext,
13553
13601
  writableStream,
13602
+ disableScorers,
13554
13603
  serializedStepGraph
13555
13604
  });
13556
13605
  } else if (resume?.resumePath?.length && entry.type === "parallel") {
@@ -13575,7 +13624,8 @@ var DefaultExecutionEngine = class extends ExecutionEngine {
13575
13624
  emitter,
13576
13625
  abortController,
13577
13626
  runtimeContext,
13578
- writableStream
13627
+ writableStream,
13628
+ disableScorers
13579
13629
  });
13580
13630
  if (resumedStepResult.stepResults) {
13581
13631
  Object.assign(stepResults, resumedStepResult.stepResults);
@@ -13650,7 +13700,8 @@ var DefaultExecutionEngine = class extends ExecutionEngine {
13650
13700
  emitter,
13651
13701
  abortController,
13652
13702
  runtimeContext,
13653
- writableStream
13703
+ writableStream,
13704
+ disableScorers
13654
13705
  });
13655
13706
  } else if (entry.type === "conditional") {
13656
13707
  execResults = await this.executeConditional({
@@ -13667,7 +13718,8 @@ var DefaultExecutionEngine = class extends ExecutionEngine {
13667
13718
  emitter,
13668
13719
  abortController,
13669
13720
  runtimeContext,
13670
- writableStream
13721
+ writableStream,
13722
+ disableScorers
13671
13723
  });
13672
13724
  } else if (entry.type === "loop") {
13673
13725
  execResults = await this.executeLoop({
@@ -13684,6 +13736,7 @@ var DefaultExecutionEngine = class extends ExecutionEngine {
13684
13736
  abortController,
13685
13737
  runtimeContext,
13686
13738
  writableStream,
13739
+ disableScorers,
13687
13740
  serializedStepGraph
13688
13741
  });
13689
13742
  } else if (entry.type === "foreach") {
@@ -13701,6 +13754,7 @@ var DefaultExecutionEngine = class extends ExecutionEngine {
13701
13754
  abortController,
13702
13755
  runtimeContext,
13703
13756
  writableStream,
13757
+ disableScorers,
13704
13758
  serializedStepGraph
13705
13759
  });
13706
13760
  } else if (entry.type === "sleep") {
@@ -14021,6 +14075,7 @@ var DefaultExecutionEngine = class extends ExecutionEngine {
14021
14075
  abortController,
14022
14076
  runtimeContext,
14023
14077
  writableStream,
14078
+ disableScorers,
14024
14079
  serializedStepGraph
14025
14080
  });
14026
14081
  } catch (error) {
@@ -14071,40 +14126,6 @@ function mapVariable(config) {
14071
14126
  return config;
14072
14127
  }
14073
14128
  function createStep(params) {
14074
- const wrapExecute = execute2 => {
14075
- return async executeParams => {
14076
- const executeResult = await execute2(executeParams);
14077
- if (params instanceof Agent || params instanceof Tool) {
14078
- return executeResult;
14079
- }
14080
- let scorersToUse = params.scorers;
14081
- if (typeof scorersToUse === "function") {
14082
- scorersToUse = await scorersToUse({
14083
- runtimeContext: executeParams.runtimeContext
14084
- });
14085
- }
14086
- if (scorersToUse && Object.keys(scorersToUse || {}).length > 0) {
14087
- for (const [id, scorerObject] of Object.entries(scorersToUse || {})) {
14088
- runScorer({
14089
- scorerId: id,
14090
- scorerObject,
14091
- runId: executeParams.runId,
14092
- input: [executeParams.inputData],
14093
- output: executeResult,
14094
- runtimeContext: executeParams.runtimeContext,
14095
- entity: {
14096
- id: executeParams.workflowId,
14097
- stepId: params.id
14098
- },
14099
- structuredOutput: true,
14100
- source: "LIVE",
14101
- entityType: "WORKFLOW"
14102
- });
14103
- }
14104
- }
14105
- return executeResult;
14106
- };
14107
- };
14108
14129
  if (params instanceof Agent) {
14109
14130
  return {
14110
14131
  id: params.name,
@@ -14118,7 +14139,7 @@ function createStep(params) {
14118
14139
  outputSchema: z$1.object({
14119
14140
  text: z$1.string()
14120
14141
  }),
14121
- execute: wrapExecute(async ({
14142
+ execute: async ({
14122
14143
  inputData,
14123
14144
  [EMITTER_SYMBOL]: emitter,
14124
14145
  runtimeContext,
@@ -14179,7 +14200,7 @@ function createStep(params) {
14179
14200
  return {
14180
14201
  text: await streamPromise.promise
14181
14202
  };
14182
- })
14203
+ }
14183
14204
  };
14184
14205
  }
14185
14206
  if (params instanceof Tool) {
@@ -14192,17 +14213,19 @@ function createStep(params) {
14192
14213
  id: params.id,
14193
14214
  inputSchema: params.inputSchema,
14194
14215
  outputSchema: params.outputSchema,
14195
- execute: wrapExecute(async ({
14216
+ execute: async ({
14196
14217
  inputData,
14197
14218
  mastra,
14198
- runtimeContext
14219
+ runtimeContext,
14220
+ tracingContext
14199
14221
  }) => {
14200
14222
  return params.execute({
14201
14223
  context: inputData,
14202
14224
  mastra,
14203
- runtimeContext
14225
+ runtimeContext,
14226
+ tracingContext
14204
14227
  });
14205
- })
14228
+ }
14206
14229
  };
14207
14230
  }
14208
14231
  return {
@@ -14214,7 +14237,7 @@ function createStep(params) {
14214
14237
  suspendSchema: params.suspendSchema,
14215
14238
  scorers: params.scorers,
14216
14239
  retries: params.retries,
14217
- execute: wrapExecute(params.execute)
14240
+ execute: params.execute
14218
14241
  };
14219
14242
  }
14220
14243
  function cloneStep(step, opts) {
@@ -14717,6 +14740,7 @@ var Workflow = class extends MastraBase {
14717
14740
  mastra: this.#mastra,
14718
14741
  retryConfig: this.retryConfig,
14719
14742
  serializedStepGraph: this.serializedStepGraph,
14743
+ disableScorers: options?.disableScorers,
14720
14744
  cleanup: () => this.#runs.delete(runIdToUse)
14721
14745
  });
14722
14746
  this.#runs.set(runIdToUse, run);
@@ -14744,6 +14768,7 @@ var Workflow = class extends MastraBase {
14744
14768
  mastra: this.#mastra,
14745
14769
  retryConfig: this.retryConfig,
14746
14770
  serializedStepGraph: this.serializedStepGraph,
14771
+ disableScorers: options?.disableScorers,
14747
14772
  cleanup: () => this.#runs.delete(runIdToUse)
14748
14773
  });
14749
14774
  this.#runs.set(runIdToUse, run);
@@ -14943,6 +14968,10 @@ var Run = class {
14943
14968
  * Unique identifier for this run
14944
14969
  */
14945
14970
  runId;
14971
+ /**
14972
+ * Whether to disable scorers for this run
14973
+ */
14974
+ disableScorers;
14946
14975
  /**
14947
14976
  * Internal state of the workflow run
14948
14977
  */
@@ -14980,6 +15009,7 @@ var Run = class {
14980
15009
  this.emitter = new EventEmitter();
14981
15010
  this.retryConfig = params.retryConfig;
14982
15011
  this.cleanup = params.cleanup;
15012
+ this.disableScorers = params.disableScorers;
14983
15013
  }
14984
15014
  get abortController() {
14985
15015
  if (!this.#abortController) {
@@ -15010,6 +15040,7 @@ var Run = class {
15010
15040
  const result = await this.executionEngine.execute({
15011
15041
  workflowId: this.workflowId,
15012
15042
  runId: this.runId,
15043
+ disableScorers: this.disableScorers,
15013
15044
  graph: this.executionGraph,
15014
15045
  serializedStepGraph: this.serializedStepGraph,
15015
15046
  input: inputData,
@@ -15429,5 +15460,5 @@ function deepMergeWorkflowState(a, b) {
15429
15460
  }
15430
15461
 
15431
15462
  export { AISDKV5OutputStream, Agent, DefaultExecutionEngine, ExecutionEngine, LanguageDetector, LanguageDetectorInputProcessor, LegacyStep, LegacyWorkflow, MastraModelOutput, ModerationInputProcessor, ModerationProcessor, PIIDetector, PIIDetectorInputProcessor, PromptInjectionDetector, PromptInjectionDetectorInputProcessor, Run, StructuredOutputProcessor, TripWire, UnicodeNormalizer, UnicodeNormalizerInputProcessor, WhenConditionReturnValue, Workflow, agentToStep, cloneStep, cloneWorkflow, createStep, createWorkflow, getActivePathsAndStatus, getResultActivePaths, getStepResult, getSuspendedPaths, isAgent, isConditionalKey, isErrorEvent, isFinalState, isLimboState, isTransitionEvent, isVariableReference, isWorkflow, loop, mapVariable, mergeChildValue, recursivelyCheckForFinalState, resolveVariables, updateStepInHierarchy, workflowToStep };
15432
- //# sourceMappingURL=chunk-FCFQE5BD.js.map
15433
- //# sourceMappingURL=chunk-FCFQE5BD.js.map
15463
+ //# sourceMappingURL=chunk-6JAIHLZY.js.map
15464
+ //# sourceMappingURL=chunk-6JAIHLZY.js.map