@mastra/core 1.0.0-beta.15 → 1.0.0-beta.17

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 (188) hide show
  1. package/CHANGELOG.md +178 -0
  2. package/dist/agent/index.cjs +8 -8
  3. package/dist/agent/index.js +1 -1
  4. package/dist/agent/workflows/prepare-stream/map-results-step.d.ts.map +1 -1
  5. package/dist/{chunk-DRJTNGI4.cjs → chunk-3AISNGWY.cjs} +7 -7
  6. package/dist/{chunk-DRJTNGI4.cjs.map → chunk-3AISNGWY.cjs.map} +1 -1
  7. package/dist/{chunk-GXMJ5URG.cjs → chunk-4M75INXO.cjs} +14 -14
  8. package/dist/{chunk-GXMJ5URG.cjs.map → chunk-4M75INXO.cjs.map} +1 -1
  9. package/dist/{chunk-RA2CHJCY.cjs → chunk-4QYTF4ZB.cjs} +36 -36
  10. package/dist/chunk-4QYTF4ZB.cjs.map +1 -0
  11. package/dist/{chunk-4HP7CS6L.js → chunk-5YYAQUEF.js} +3 -3
  12. package/dist/chunk-5YYAQUEF.js.map +1 -0
  13. package/dist/{chunk-YV43YEZ6.js → chunk-6RFJWX4V.js} +4 -4
  14. package/dist/chunk-6RFJWX4V.js.map +1 -0
  15. package/dist/{chunk-DDK3URK2.cjs → chunk-6ZKYNY3H.cjs} +105 -84
  16. package/dist/chunk-6ZKYNY3H.cjs.map +1 -0
  17. package/dist/{chunk-D2IFWD7A.js → chunk-7CDELQD6.js} +10 -10
  18. package/dist/chunk-7CDELQD6.js.map +1 -0
  19. package/dist/{chunk-4J4M2Q5R.js → chunk-ABMWK6JU.js} +5 -5
  20. package/dist/{chunk-4J4M2Q5R.js.map → chunk-ABMWK6JU.js.map} +1 -1
  21. package/dist/{chunk-37YWZMBX.js → chunk-AIJLACR2.js} +9 -5
  22. package/dist/chunk-AIJLACR2.js.map +1 -0
  23. package/dist/chunk-DMX7MC4N.js +3 -0
  24. package/dist/{chunk-GXSERFAG.js.map → chunk-DMX7MC4N.js.map} +1 -1
  25. package/dist/{chunk-LOV5NNGK.cjs → chunk-G6YCU7HJ.cjs} +31 -54
  26. package/dist/chunk-G6YCU7HJ.cjs.map +1 -0
  27. package/dist/{chunk-CBQ6WDUJ.js → chunk-GPC7WOLN.js} +4 -4
  28. package/dist/{chunk-CBQ6WDUJ.js.map → chunk-GPC7WOLN.js.map} +1 -1
  29. package/dist/{chunk-BCUKD2XG.js → chunk-HGWVTZWK.js} +12 -34
  30. package/dist/chunk-HGWVTZWK.js.map +1 -0
  31. package/dist/{chunk-BAZHNX5P.js → chunk-I55X7FYN.js} +6 -6
  32. package/dist/{chunk-BAZHNX5P.js.map → chunk-I55X7FYN.js.map} +1 -1
  33. package/dist/{chunk-XJB7J4UT.js → chunk-JBEKXEX6.js} +5 -5
  34. package/dist/{chunk-XJB7J4UT.js.map → chunk-JBEKXEX6.js.map} +1 -1
  35. package/dist/{chunk-ZGIVAQRI.js → chunk-JQM64OZF.js} +2 -2
  36. package/dist/chunk-JQM64OZF.js.map +1 -0
  37. package/dist/{chunk-CBY37FTP.cjs → chunk-N6HPK6I3.cjs} +15 -15
  38. package/dist/{chunk-CBY37FTP.cjs.map → chunk-N6HPK6I3.cjs.map} +1 -1
  39. package/dist/{chunk-6HJFCSJ4.cjs → chunk-O4YSWWLB.cjs} +5 -5
  40. package/dist/chunk-O4YSWWLB.cjs.map +1 -0
  41. package/dist/{chunk-IRTICXRZ.cjs → chunk-OHQ4PC6P.cjs} +22 -44
  42. package/dist/chunk-OHQ4PC6P.cjs.map +1 -0
  43. package/dist/{chunk-3HDRO3GG.js → chunk-RC7RN5MY.js} +26 -49
  44. package/dist/chunk-RC7RN5MY.js.map +1 -0
  45. package/dist/{chunk-S23TNDXG.cjs → chunk-RGX4NX5L.cjs} +190 -98
  46. package/dist/chunk-RGX4NX5L.cjs.map +1 -0
  47. package/dist/chunk-ROOVGRNA.cjs +4 -0
  48. package/dist/{chunk-X4RMXTXF.cjs.map → chunk-ROOVGRNA.cjs.map} +1 -1
  49. package/dist/{chunk-BC2VKOH4.cjs → chunk-SDR22R4D.cjs} +20 -20
  50. package/dist/{chunk-BC2VKOH4.cjs.map → chunk-SDR22R4D.cjs.map} +1 -1
  51. package/dist/{chunk-T2LVULCK.cjs → chunk-SGRMJZMJ.cjs} +18 -18
  52. package/dist/{chunk-T2LVULCK.cjs.map → chunk-SGRMJZMJ.cjs.map} +1 -1
  53. package/dist/{chunk-HAYBGFPA.js → chunk-SJ3MF5G2.js} +4 -4
  54. package/dist/{chunk-HAYBGFPA.js.map → chunk-SJ3MF5G2.js.map} +1 -1
  55. package/dist/{chunk-IHISDRFV.js → chunk-SRQTDHF5.js} +189 -97
  56. package/dist/chunk-SRQTDHF5.js.map +1 -0
  57. package/dist/{chunk-2OOMJRXZ.cjs → chunk-UT6MASE5.cjs} +3 -3
  58. package/dist/{chunk-2OOMJRXZ.cjs.map → chunk-UT6MASE5.cjs.map} +1 -1
  59. package/dist/{chunk-H2NHG7QL.cjs → chunk-VW7YQWDW.cjs} +9 -5
  60. package/dist/chunk-VW7YQWDW.cjs.map +1 -0
  61. package/dist/{chunk-AR5CF3IN.js → chunk-WDXYPI3P.js} +3 -3
  62. package/dist/{chunk-AR5CF3IN.js.map → chunk-WDXYPI3P.js.map} +1 -1
  63. package/dist/{chunk-CBVHOGXX.cjs → chunk-XR7RX2PS.cjs} +9 -9
  64. package/dist/chunk-XR7RX2PS.cjs.map +1 -0
  65. package/dist/{chunk-NGWTSHNA.js → chunk-YORDI4E7.js} +70 -49
  66. package/dist/chunk-YORDI4E7.js.map +1 -0
  67. package/dist/{chunk-O2CAMK4A.cjs → chunk-ZSZOYPSJ.cjs} +2 -2
  68. package/dist/chunk-ZSZOYPSJ.cjs.map +1 -0
  69. package/dist/evals/index.cjs +19 -19
  70. package/dist/evals/index.js +2 -2
  71. package/dist/evals/scoreTraces/index.cjs +5 -5
  72. package/dist/evals/scoreTraces/index.cjs.map +1 -1
  73. package/dist/evals/scoreTraces/index.js +2 -2
  74. package/dist/evals/scoreTraces/index.js.map +1 -1
  75. package/dist/evals/types.d.ts +0 -2
  76. package/dist/evals/types.d.ts.map +1 -1
  77. package/dist/index.cjs +2 -2
  78. package/dist/index.js +1 -1
  79. package/dist/integration/index.cjs +2 -2
  80. package/dist/integration/index.js +1 -1
  81. package/dist/llm/index.cjs +11 -11
  82. package/dist/llm/index.js +3 -3
  83. package/dist/llm/model/provider-types.generated.d.ts +89 -43
  84. package/dist/loop/index.cjs +2 -2
  85. package/dist/loop/index.js +1 -1
  86. package/dist/loop/workflows/agentic-execution/llm-execution-step.d.ts.map +1 -1
  87. package/dist/loop/workflows/agentic-execution/tool-call-step.d.ts +1 -1
  88. package/dist/loop/workflows/agentic-execution/tool-call-step.d.ts.map +1 -1
  89. package/dist/mastra/hooks.d.ts.map +1 -1
  90. package/dist/mastra/index.cjs +2 -2
  91. package/dist/mastra/index.d.ts.map +1 -1
  92. package/dist/mastra/index.js +1 -1
  93. package/dist/mcp/index.cjs +3 -0
  94. package/dist/mcp/index.cjs.map +1 -1
  95. package/dist/mcp/index.d.ts +2 -0
  96. package/dist/mcp/index.d.ts.map +1 -1
  97. package/dist/mcp/index.js +3 -0
  98. package/dist/mcp/index.js.map +1 -1
  99. package/dist/mcp/types.d.ts +2 -0
  100. package/dist/mcp/types.d.ts.map +1 -1
  101. package/dist/memory/index.cjs +11 -11
  102. package/dist/memory/index.js +1 -1
  103. package/dist/netlify-3MHHJG2E.js +3 -0
  104. package/dist/{netlify-J4QPOROO.js.map → netlify-3MHHJG2E.js.map} +1 -1
  105. package/dist/netlify-5Y33S7WL.cjs +12 -0
  106. package/dist/{netlify-CUYK2MZ2.cjs.map → netlify-5Y33S7WL.cjs.map} +1 -1
  107. package/dist/observability/index.cjs +11 -11
  108. package/dist/observability/index.js +1 -1
  109. package/dist/observability/types/tracing.d.ts +2 -1
  110. package/dist/observability/types/tracing.d.ts.map +1 -1
  111. package/dist/processors/index.cjs +37 -37
  112. package/dist/processors/index.js +1 -1
  113. package/dist/processors/processors/structured-output.d.ts +1 -0
  114. package/dist/processors/processors/structured-output.d.ts.map +1 -1
  115. package/dist/provider-registry-AUJKATCF.cjs +40 -0
  116. package/dist/{provider-registry-7O7FJ4BS.cjs.map → provider-registry-AUJKATCF.cjs.map} +1 -1
  117. package/dist/provider-registry-LUBC7RIO.js +3 -0
  118. package/dist/{provider-registry-6CIGRQVZ.js.map → provider-registry-LUBC7RIO.js.map} +1 -1
  119. package/dist/provider-registry.json +186 -94
  120. package/dist/relevance/index.cjs +3 -3
  121. package/dist/relevance/index.js +1 -1
  122. package/dist/server/types.d.ts +28 -0
  123. package/dist/server/types.d.ts.map +1 -1
  124. package/dist/storage/base.d.ts +76 -29
  125. package/dist/storage/base.d.ts.map +1 -1
  126. package/dist/storage/constants.cjs +14 -14
  127. package/dist/storage/constants.js +1 -1
  128. package/dist/storage/index.cjs +92 -92
  129. package/dist/storage/index.js +2 -2
  130. package/dist/storage/mock.d.ts +0 -2
  131. package/dist/storage/mock.d.ts.map +1 -1
  132. package/dist/storage/types.d.ts +0 -24
  133. package/dist/storage/types.d.ts.map +1 -1
  134. package/dist/stream/aisdk/v5/compat/consume-stream.d.ts +4 -1
  135. package/dist/stream/aisdk/v5/compat/consume-stream.d.ts.map +1 -1
  136. package/dist/stream/aisdk/v5/output.d.ts.map +1 -1
  137. package/dist/stream/base/output.d.ts.map +1 -1
  138. package/dist/stream/index.cjs +9 -9
  139. package/dist/stream/index.js +1 -1
  140. package/dist/test-utils/llm-mock.cjs +4 -4
  141. package/dist/test-utils/llm-mock.js +1 -1
  142. package/dist/tool-loop-agent/index.cjs +4 -4
  143. package/dist/tool-loop-agent/index.js +1 -1
  144. package/dist/tools/index.cjs +4 -4
  145. package/dist/tools/index.d.ts +1 -0
  146. package/dist/tools/index.d.ts.map +1 -1
  147. package/dist/tools/index.js +1 -1
  148. package/dist/tools/is-vercel-tool.cjs +2 -2
  149. package/dist/tools/is-vercel-tool.js +1 -1
  150. package/dist/tools/tool.d.ts +4 -4
  151. package/dist/tools/tool.d.ts.map +1 -1
  152. package/dist/tools/types.d.ts +3 -1
  153. package/dist/tools/types.d.ts.map +1 -1
  154. package/dist/utils/zod-utils.d.ts +7 -1
  155. package/dist/utils/zod-utils.d.ts.map +1 -1
  156. package/dist/utils.cjs +27 -27
  157. package/dist/utils.js +2 -2
  158. package/dist/workflows/evented/index.cjs +10 -10
  159. package/dist/workflows/evented/index.js +1 -1
  160. package/dist/workflows/index.cjs +23 -23
  161. package/dist/workflows/index.js +1 -1
  162. package/dist/workflows/workflow.d.ts.map +1 -1
  163. package/package.json +4 -4
  164. package/src/llm/model/provider-types.generated.d.ts +89 -43
  165. package/dist/chunk-37YWZMBX.js.map +0 -1
  166. package/dist/chunk-3HDRO3GG.js.map +0 -1
  167. package/dist/chunk-4HP7CS6L.js.map +0 -1
  168. package/dist/chunk-6HJFCSJ4.cjs.map +0 -1
  169. package/dist/chunk-BCUKD2XG.js.map +0 -1
  170. package/dist/chunk-CBVHOGXX.cjs.map +0 -1
  171. package/dist/chunk-D2IFWD7A.js.map +0 -1
  172. package/dist/chunk-DDK3URK2.cjs.map +0 -1
  173. package/dist/chunk-GXSERFAG.js +0 -3
  174. package/dist/chunk-H2NHG7QL.cjs.map +0 -1
  175. package/dist/chunk-IHISDRFV.js.map +0 -1
  176. package/dist/chunk-IRTICXRZ.cjs.map +0 -1
  177. package/dist/chunk-LOV5NNGK.cjs.map +0 -1
  178. package/dist/chunk-NGWTSHNA.js.map +0 -1
  179. package/dist/chunk-O2CAMK4A.cjs.map +0 -1
  180. package/dist/chunk-RA2CHJCY.cjs.map +0 -1
  181. package/dist/chunk-S23TNDXG.cjs.map +0 -1
  182. package/dist/chunk-X4RMXTXF.cjs +0 -4
  183. package/dist/chunk-YV43YEZ6.js.map +0 -1
  184. package/dist/chunk-ZGIVAQRI.js.map +0 -1
  185. package/dist/netlify-CUYK2MZ2.cjs +0 -12
  186. package/dist/netlify-J4QPOROO.js +0 -3
  187. package/dist/provider-registry-6CIGRQVZ.js +0 -3
  188. package/dist/provider-registry-7O7FJ4BS.cjs +0 -40
@@ -1,18 +1,18 @@
1
- import { DefaultVoice } from './chunk-O7M7DR4E.js';
2
1
  import { PUBSUB_SYMBOL, STREAM_FORMAT_SYMBOL } from './chunk-6PMMP3FR.js';
3
- import { InMemoryStore } from './chunk-3HDRO3GG.js';
2
+ import { DefaultVoice } from './chunk-O7M7DR4E.js';
3
+ import { InMemoryStore } from './chunk-RC7RN5MY.js';
4
4
  import { MessageList, DefaultGeneratedFile, DefaultGeneratedFileWithType } from './chunk-QXL3F3T2.js';
5
5
  import { createTextStreamResponse, createUIMessageStreamResponse, createUIMessageStream, parsePartialJson, isDeepEqualData, stepCountIs } from './chunk-2SQB3WBT.js';
6
6
  import { generateId, asSchema, jsonSchema, APICallError, tool } from './chunk-G6E6V2Z4.js';
7
- import { resolveModelConfig, ModelRouterEmbeddingModel, ModelRouterLanguageModel } from './chunk-BAZHNX5P.js';
8
- import { MastraLLMV1 } from './chunk-4J4M2Q5R.js';
7
+ import { resolveModelConfig, ModelRouterEmbeddingModel, ModelRouterLanguageModel } from './chunk-I55X7FYN.js';
8
+ import { MastraLLMV1 } from './chunk-ABMWK6JU.js';
9
9
  import { PubSub } from './chunk-BVUMKER5.js';
10
10
  import { executeHook } from './chunk-L54GIUCB.js';
11
- import { removeUndefinedValues, ensureToolProperties, makeCoreTool, createMastraProxy, isZodType, deepMerge, selectFields, delay } from './chunk-XJB7J4UT.js';
12
- import { getOrCreateSpan, wrapMastra, executeWithContextSync } from './chunk-ZGIVAQRI.js';
11
+ import { removeUndefinedValues, ensureToolProperties, makeCoreTool, createMastraProxy, isZodType, deepMerge, selectFields, delay } from './chunk-JBEKXEX6.js';
12
+ import { getOrCreateSpan, wrapMastra, executeWithContextSync } from './chunk-JQM64OZF.js';
13
13
  import { MastraError, getErrorFromUnknown } from './chunk-FJEVLHJT.js';
14
14
  import { ToolStream } from './chunk-DD2VNRQM.js';
15
- import { Tool, createTool } from './chunk-4HP7CS6L.js';
15
+ import { Tool, createTool } from './chunk-5YYAQUEF.js';
16
16
  import { RequestContext, MASTRA_RESOURCE_ID_KEY, MASTRA_THREAD_ID_KEY } from './chunk-6TBWJV35.js';
17
17
  import { zodToJsonSchema as zodToJsonSchema$1 } from './chunk-PJKCPRYF.js';
18
18
  import { MastraBase } from './chunk-LSHPJWM5.js';
@@ -501,7 +501,8 @@ function prepareToolsAndToolChoice({
501
501
  // src/stream/aisdk/v5/compat/consume-stream.ts
502
502
  async function consumeStream({
503
503
  stream,
504
- onError
504
+ onError,
505
+ logger
505
506
  }) {
506
507
  const reader = stream.getReader();
507
508
  try {
@@ -510,7 +511,7 @@ async function consumeStream({
510
511
  if (done) break;
511
512
  }
512
513
  } catch (error) {
513
- console.error("consumeStream error", error);
514
+ logger?.error("consumeStream error", error);
514
515
  onError?.(error);
515
516
  } finally {
516
517
  reader.releaseLock();
@@ -529,6 +530,7 @@ var StructuredOutputProcessor = class {
529
530
  isStructuringAgentStreamStarted = false;
530
531
  jsonPromptInjection;
531
532
  providerOptions;
533
+ logger;
532
534
  constructor(options) {
533
535
  if (!options.schema) {
534
536
  throw new MastraError({
@@ -551,6 +553,7 @@ var StructuredOutputProcessor = class {
551
553
  this.fallbackValue = options.fallbackValue;
552
554
  this.jsonPromptInjection = options.jsonPromptInjection;
553
555
  this.providerOptions = options.providerOptions;
556
+ this.logger = options.logger;
554
557
  this.structuringAgent = new Agent({
555
558
  id: "structured-output-structurer",
556
559
  name: "structured-output-structurer",
@@ -716,14 +719,14 @@ The input text may be in any format (sentences, bullet points, paragraphs, etc.)
716
719
  const message = `[StructuredOutputProcessor] ${context}: ${error}`;
717
720
  switch (this.errorStrategy) {
718
721
  case "strict":
719
- console.error(message);
722
+ this.logger?.error(message);
720
723
  abort(message);
721
724
  break;
722
725
  case "warn":
723
- console.warn(message);
726
+ this.logger?.warn(message);
724
727
  break;
725
728
  case "fallback":
726
- console.info(`${message} (using fallback)`);
729
+ this.logger?.info(`${message} (using fallback)`);
727
730
  break;
728
731
  }
729
732
  }
@@ -2456,7 +2459,6 @@ var AISDKV5OutputStream = class {
2456
2459
  async getFullOutput() {
2457
2460
  await this.consumeStream({
2458
2461
  onError: (error) => {
2459
- console.error(error);
2460
2462
  throw error;
2461
2463
  }
2462
2464
  });
@@ -3873,7 +3875,8 @@ var MastraModelOutput = class extends MastraBase {
3873
3875
  try {
3874
3876
  await consumeStream({
3875
3877
  stream: this.#baseStream,
3876
- onError: options?.onError
3878
+ onError: options?.onError,
3879
+ logger: this.logger
3877
3880
  });
3878
3881
  } catch (error) {
3879
3882
  options?.onError?.(error);
@@ -3885,7 +3888,7 @@ var MastraModelOutput = class extends MastraBase {
3885
3888
  async getFullOutput() {
3886
3889
  await this.consumeStream({
3887
3890
  onError: (error) => {
3888
- console.error(error);
3891
+ this.logger.error("Error consuming stream", error);
3889
3892
  throw error;
3890
3893
  }
3891
3894
  });
@@ -9253,7 +9256,7 @@ var Run = class {
9253
9256
  */
9254
9257
  async startAsync(args) {
9255
9258
  this._start(args).catch((err) => {
9256
- console.error(`[Workflow ${this.workflowId}] Background execution failed:`, err);
9259
+ this.mastra?.getLogger()?.error(`[Workflow ${this.workflowId}] Background execution failed:`, err);
9257
9260
  });
9258
9261
  return { runId: this.runId };
9259
9262
  }
@@ -9302,7 +9305,7 @@ var Run = class {
9302
9305
  try {
9303
9306
  await writer.close();
9304
9307
  } catch (err) {
9305
- console.error("Error closing stream:", err);
9308
+ this.mastra?.getLogger()?.error("Error closing stream:", err);
9306
9309
  } finally {
9307
9310
  writer.releaseLock();
9308
9311
  }
@@ -9360,7 +9363,7 @@ var Run = class {
9360
9363
  try {
9361
9364
  await writer.close();
9362
9365
  } catch (err) {
9363
- console.error("Error closing stream:", err);
9366
+ this.mastra?.getLogger()?.error("Error closing stream:", err);
9364
9367
  } finally {
9365
9368
  writer.releaseLock();
9366
9369
  }
@@ -9452,7 +9455,7 @@ var Run = class {
9452
9455
  controller.close();
9453
9456
  }
9454
9457
  } catch (err) {
9455
- console.error("Error closing stream:", err);
9458
+ self.mastra?.getLogger()?.error("Error closing stream:", err);
9456
9459
  }
9457
9460
  };
9458
9461
  const executionResultsPromise = self._start({
@@ -9573,7 +9576,7 @@ var Run = class {
9573
9576
  controller.close();
9574
9577
  }
9575
9578
  } catch (err) {
9576
- console.error("Error closing stream:", err);
9579
+ self.mastra?.getLogger()?.error("Error closing stream:", err);
9577
9580
  }
9578
9581
  };
9579
9582
  const executionResultsPromise = self._resume({
@@ -9625,14 +9628,22 @@ var Run = class {
9625
9628
  const nestedWatchCb = (event) => {
9626
9629
  if (event.runId === this.runId) {
9627
9630
  const { event: nestedEvent, workflowId } = event.data;
9628
- void this.pubsub.publish(`workflow.events.v2.${this.runId}`, {
9629
- type: "watch",
9630
- runId: this.runId,
9631
- data: {
9632
- ...nestedEvent,
9633
- ...nestedEvent.payload?.id ? { payload: { ...nestedEvent.payload, id: `${workflowId}.${nestedEvent.payload.id}` } } : {}
9634
- }
9635
- });
9631
+ if (nestedEvent.type.startsWith("data-") && nestedEvent.data !== void 0) {
9632
+ void this.pubsub.publish(`workflow.events.v2.${this.runId}`, {
9633
+ type: "watch",
9634
+ runId: this.runId,
9635
+ data: nestedEvent
9636
+ });
9637
+ } else {
9638
+ void this.pubsub.publish(`workflow.events.v2.${this.runId}`, {
9639
+ type: "watch",
9640
+ runId: this.runId,
9641
+ data: {
9642
+ ...nestedEvent,
9643
+ ...nestedEvent.payload?.id ? { payload: { ...nestedEvent.payload, id: `${workflowId}.${nestedEvent.payload.id}` } } : {}
9644
+ }
9645
+ });
9646
+ }
9636
9647
  }
9637
9648
  };
9638
9649
  void this.pubsub.subscribe(`workflow.events.v2.${this.runId}`, wrappedCb);
@@ -10017,7 +10028,7 @@ var Run = class {
10017
10028
  controller.close();
10018
10029
  }
10019
10030
  } catch (err) {
10020
- console.error("Error closing stream:", err);
10031
+ self.mastra?.getLogger()?.error("Error closing stream:", err);
10021
10032
  }
10022
10033
  };
10023
10034
  const executionResultsPromise = self._timeTravel({
@@ -10462,7 +10473,8 @@ async function processOutputStream({
10462
10473
  options,
10463
10474
  controller,
10464
10475
  responseFromModel,
10465
- includeRawChunks
10476
+ includeRawChunks,
10477
+ logger
10466
10478
  }) {
10467
10479
  for await (const chunk of outputStream._getBaseStream()) {
10468
10480
  if (!chunk) {
@@ -10545,7 +10557,7 @@ async function processOutputStream({
10545
10557
  abortSignal: options?.abortSignal
10546
10558
  });
10547
10559
  } catch (error2) {
10548
- console.error("Error calling onInputStart", error2);
10560
+ logger?.error("Error calling onInputStart", error2);
10549
10561
  }
10550
10562
  }
10551
10563
  if (isControllerOpen(controller)) {
@@ -10564,7 +10576,7 @@ async function processOutputStream({
10564
10576
  abortSignal: options?.abortSignal
10565
10577
  });
10566
10578
  } catch (error2) {
10567
- console.error("Error calling onInputDelta", error2);
10579
+ logger?.error("Error calling onInputDelta", error2);
10568
10580
  }
10569
10581
  }
10570
10582
  if (isControllerOpen(controller)) {
@@ -10754,7 +10766,7 @@ async function processOutputStream({
10754
10766
  }
10755
10767
  }
10756
10768
  }
10757
- function executeStreamWithFallbackModels(models) {
10769
+ function executeStreamWithFallbackModels(models, logger) {
10758
10770
  return async (callback) => {
10759
10771
  let index = 0;
10760
10772
  let finalResult;
@@ -10778,7 +10790,7 @@ function executeStreamWithFallbackModels(models) {
10778
10790
  throw err;
10779
10791
  }
10780
10792
  attempt++;
10781
- console.error(`Error executing model ${modelConfig.model.modelId}, attempt ${attempt}====`, err);
10793
+ logger?.error(`Error executing model ${modelConfig.model.modelId}, attempt ${attempt}====`, err);
10782
10794
  if (attempt > maxRetries) {
10783
10795
  break;
10784
10796
  }
@@ -10788,7 +10800,7 @@ function executeStreamWithFallbackModels(models) {
10788
10800
  }
10789
10801
  }
10790
10802
  if (typeof finalResult === "undefined") {
10791
- console.error("Exhausted all fallback models and reached the maximum number of retries.");
10803
+ logger?.error("Exhausted all fallback models and reached the maximum number of retries.");
10792
10804
  throw new Error("Exhausted all fallback models and reached the maximum number of retries.");
10793
10805
  }
10794
10806
  return finalResult;
@@ -10829,11 +10841,15 @@ function createLLMExecutionStep({
10829
10841
  inputSchema: llmIterationOutputSchema,
10830
10842
  outputSchema: llmIterationOutputSchema,
10831
10843
  execute: async ({ inputData, bail, tracingContext }) => {
10844
+ modelSpanTracker?.startStep();
10832
10845
  let modelResult;
10833
10846
  let warnings;
10834
10847
  let request;
10835
10848
  let rawResponse;
10836
- const { outputStream, callBail, runState, stepTools } = await executeStreamWithFallbackModels(models)(async (modelConfig, isLastModel) => {
10849
+ const { outputStream, callBail, runState, stepTools } = await executeStreamWithFallbackModels(
10850
+ models,
10851
+ logger
10852
+ )(async (modelConfig, isLastModel) => {
10837
10853
  const model = modelConfig.model;
10838
10854
  const modelHeaders = modelConfig.headers;
10839
10855
  if (initialSystemMessages) {
@@ -10919,7 +10935,7 @@ function createLLMExecutionStep({
10919
10935
  stepTools: tools
10920
10936
  };
10921
10937
  }
10922
- console.error("Error in processInputStep processors:", error);
10938
+ logger?.error("Error in processInputStep processors:", error);
10923
10939
  throw error;
10924
10940
  }
10925
10941
  }
@@ -11045,10 +11061,11 @@ Analyse the suspended tools: ${JSON.stringify(suspendedTools)}, using the messag
11045
11061
  warnings,
11046
11062
  request,
11047
11063
  rawResponse
11048
- }
11064
+ },
11065
+ logger
11049
11066
  });
11050
11067
  } catch (error) {
11051
- console.error("Error in LLM Execution Step", error);
11068
+ logger?.error("Error in LLM Execution Step", error);
11052
11069
  if (isAbortError(error) && options?.abortSignal?.aborted) {
11053
11070
  await options?.onAbort?.({
11054
11071
  steps: inputData?.output?.steps ?? []
@@ -11182,7 +11199,7 @@ Analyse the suspended tools: ${JSON.stringify(suspendedTools)}, using the messag
11182
11199
  if (error instanceof TripWire) {
11183
11200
  processOutputStepTripwire = error;
11184
11201
  } else {
11185
- console.error("Error in processOutputStep processors:", error);
11202
+ logger?.error("Error in processOutputStep processors:", error);
11186
11203
  throw error;
11187
11204
  }
11188
11205
  }
@@ -11448,7 +11465,8 @@ function createToolCallStep({
11448
11465
  runId,
11449
11466
  streamState,
11450
11467
  modelSpanTracker,
11451
- _internal
11468
+ _internal,
11469
+ logger
11452
11470
  }) {
11453
11471
  return createStep({
11454
11472
  id: "toolCallStep",
@@ -11515,7 +11533,7 @@ function createToolCallStep({
11515
11533
  try {
11516
11534
  await saveQueueManager.flushMessages(messageList, threadId, memoryConfig);
11517
11535
  } catch (error) {
11518
- console.error("Error removing tool suspension metadata:", error);
11536
+ logger?.error("Error removing tool suspension metadata:", error);
11519
11537
  }
11520
11538
  }
11521
11539
  }
@@ -11539,7 +11557,7 @@ function createToolCallStep({
11539
11557
  }
11540
11558
  await saveQueueManager.flushMessages(messageList, threadId, memoryConfig);
11541
11559
  } catch (error) {
11542
- console.error("Error flushing messages before suspension:", error);
11560
+ logger?.error("Error flushing messages before suspension:", error);
11543
11561
  }
11544
11562
  };
11545
11563
  if (inputData.providerExecuted) {
@@ -11560,7 +11578,7 @@ function createToolCallStep({
11560
11578
  abortSignal: options?.abortSignal
11561
11579
  });
11562
11580
  } catch (error) {
11563
- console.error("Error calling onInputAvailable", error);
11581
+ logger?.error("Error calling onInputAvailable", error);
11564
11582
  }
11565
11583
  }
11566
11584
  if (!tool2.execute) {
@@ -11583,7 +11601,7 @@ function createToolCallStep({
11583
11601
  const needsApprovalResult = await tool2.needsApprovalFn(args);
11584
11602
  toolRequiresApproval = needsApprovalResult;
11585
11603
  } catch (error) {
11586
- console.error(`Error evaluating needsApprovalFn for tool ${inputData.toolName}:`, error);
11604
+ logger?.error(`Error evaluating needsApprovalFn for tool ${inputData.toolName}:`, error);
11587
11605
  toolRequiresApproval = true;
11588
11606
  }
11589
11607
  }
@@ -11688,7 +11706,7 @@ function createToolCallStep({
11688
11706
  abortSignal: options?.abortSignal
11689
11707
  });
11690
11708
  } catch (error) {
11691
- console.error("Error calling onOutput", error);
11709
+ logger?.error("Error calling onOutput", error);
11692
11710
  }
11693
11711
  }
11694
11712
  return { result, ...inputData };
@@ -14662,7 +14680,10 @@ function createMapResultsStep({
14662
14680
  requestContext: result.requestContext
14663
14681
  }) : capabilities.outputProcessors : []);
14664
14682
  if (options.structuredOutput?.model) {
14665
- const structuredProcessor = new StructuredOutputProcessor(options.structuredOutput);
14683
+ const structuredProcessor = new StructuredOutputProcessor({
14684
+ ...options.structuredOutput,
14685
+ logger: capabilities.logger
14686
+ });
14666
14687
  effectiveOutputProcessors = effectiveOutputProcessors ? [...effectiveOutputProcessors, structuredProcessor] : [structuredProcessor];
14667
14688
  }
14668
14689
  const effectiveInputProcessors = options.inputProcessors || (capabilities.inputProcessors ? typeof capabilities.inputProcessors === "function" ? await capabilities.inputProcessors({
@@ -21029,5 +21050,5 @@ var MockMemory = class extends MastraMemory {
21029
21050
  };
21030
21051
 
21031
21052
  export { AISDKV5OutputStream, Agent, BatchPartsProcessor, ChunkFrom, DefaultExecutionEngine, EventEmitterPubSub, ExecutionEngine, FilePartSchema, ImagePartSchema, LanguageDetector, MastraAgentNetworkStream, MastraMemory, MastraModelOutput, MemoryProcessor, MessageContentSchema, MessageHistory, MessagePartSchema, MockMemory, ModerationProcessor, PIIDetector, ProcessorInputPhaseSchema, ProcessorInputStepPhaseSchema, ProcessorMessageContentSchema, ProcessorMessageSchema, ProcessorOutputResultPhaseSchema, ProcessorOutputStepPhaseSchema, ProcessorOutputStreamPhaseSchema, ProcessorRunner, ProcessorState, ProcessorStepInputSchema, ProcessorStepOutputSchema, ProcessorStepSchema, PromptInjectionDetector, ReasoningPartSchema, Run, SemanticRecall, SourcePartSchema, StepStartPartSchema, StructuredOutputProcessor, SystemPromptScrubber, TextPartSchema, TokenLimiterProcessor, ToolCallFilter, ToolInvocationPartSchema, TripWire, UnicodeNormalizer, WORKING_MEMORY_END_TAG, WORKING_MEMORY_START_TAG, Workflow, WorkflowRunOutput, WorkingMemory, augmentWithInit, cloneStep, cloneWorkflow, convertFullStreamChunkToMastra, convertFullStreamChunkToUIMessageStream, convertMastraChunkToAISDKv5, createDeprecationProxy, createStep, createTimeTravelExecutionParams, createWorkflow, extractWorkingMemoryContent, extractWorkingMemoryTags, getResumeLabelsByStepId, getStepIds, getStepResult, getZodErrors, hydrateSerializedStepErrors, isProcessor, isProcessorWorkflow, isSupportedLanguageModel, loop, mapVariable, memoryDefaultOptions, parseMemoryRequestContext, removeWorkingMemoryTags, resolveThreadIdFromArgs, runCountDeprecationMessage, supportedLanguageModelSpecifications, tryGenerateWithJsonFallback, tryStreamWithJsonFallback, validateStepInput, validateStepResumeData, validateStepStateData, validateStepSuspendData };
21032
- //# sourceMappingURL=chunk-NGWTSHNA.js.map
21033
- //# sourceMappingURL=chunk-NGWTSHNA.js.map
21053
+ //# sourceMappingURL=chunk-YORDI4E7.js.map
21054
+ //# sourceMappingURL=chunk-YORDI4E7.js.map