@mastra/core 1.0.0-beta.3 → 1.0.0-beta.4

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 (146) hide show
  1. package/CHANGELOG.md +44 -0
  2. package/dist/agent/index.cjs +9 -9
  3. package/dist/agent/index.js +2 -2
  4. package/dist/agent/message-list/index.cjs +3 -3
  5. package/dist/agent/message-list/index.d.ts +5 -0
  6. package/dist/agent/message-list/index.d.ts.map +1 -1
  7. package/dist/agent/message-list/index.js +1 -1
  8. package/dist/{chunk-OWX2PUFH.cjs → chunk-2NVBZKZI.cjs} +161 -129
  9. package/dist/chunk-2NVBZKZI.cjs.map +1 -0
  10. package/dist/{chunk-OQF4H5Y2.js → chunk-2OTDXX73.js} +4 -4
  11. package/dist/{chunk-OQF4H5Y2.js.map → chunk-2OTDXX73.js.map} +1 -1
  12. package/dist/{chunk-4DWZ4Z6H.js → chunk-3RW5EMSB.js} +3 -4
  13. package/dist/chunk-3RW5EMSB.js.map +1 -0
  14. package/dist/{chunk-N4SJ4YX7.cjs → chunk-3W5RQCCY.cjs} +40 -24
  15. package/dist/chunk-3W5RQCCY.cjs.map +1 -0
  16. package/dist/{chunk-XRIVPHXV.cjs → chunk-4RXG622P.cjs} +5 -5
  17. package/dist/{chunk-XRIVPHXV.cjs.map → chunk-4RXG622P.cjs.map} +1 -1
  18. package/dist/{chunk-VZGBVYXA.cjs → chunk-5WXEYDFI.cjs} +22 -23
  19. package/dist/chunk-5WXEYDFI.cjs.map +1 -0
  20. package/dist/{chunk-EZVRSZMK.cjs → chunk-CYVNOIXS.cjs} +11 -11
  21. package/dist/{chunk-EZVRSZMK.cjs.map → chunk-CYVNOIXS.cjs.map} +1 -1
  22. package/dist/{chunk-MCUX2D5Q.js → chunk-FVNT7VTO.js} +29 -13
  23. package/dist/chunk-FVNT7VTO.js.map +1 -0
  24. package/dist/{chunk-T3WZCEC4.js → chunk-IHJDOC3A.js} +34 -587
  25. package/dist/chunk-IHJDOC3A.js.map +1 -0
  26. package/dist/{chunk-QUKUN6NR.cjs → chunk-ISMGVGUM.cjs} +105 -5
  27. package/dist/chunk-ISMGVGUM.cjs.map +1 -0
  28. package/dist/{chunk-4RSHBKDJ.cjs → chunk-IWB65P37.cjs} +5 -5
  29. package/dist/{chunk-4RSHBKDJ.cjs.map → chunk-IWB65P37.cjs.map} +1 -1
  30. package/dist/{chunk-5CWWU22H.js → chunk-IWQDBVJK.js} +3 -3
  31. package/dist/{chunk-5CWWU22H.js.map → chunk-IWQDBVJK.js.map} +1 -1
  32. package/dist/{chunk-KOSW5PP5.js → chunk-MDKPL2R2.js} +464 -124
  33. package/dist/chunk-MDKPL2R2.js.map +1 -0
  34. package/dist/{chunk-UIZSWUKP.js → chunk-NZAXAFI3.js} +104 -6
  35. package/dist/chunk-NZAXAFI3.js.map +1 -0
  36. package/dist/{chunk-GRGPQ32U.js → chunk-RXDJL5QT.js} +3 -3
  37. package/dist/{chunk-GRGPQ32U.js.map → chunk-RXDJL5QT.js.map} +1 -1
  38. package/dist/{chunk-YQ7NLZZ3.cjs → chunk-S6OEQHEI.cjs} +61 -614
  39. package/dist/chunk-S6OEQHEI.cjs.map +1 -0
  40. package/dist/{chunk-G3OOCXAI.js → chunk-U7VECK2G.js} +4 -4
  41. package/dist/{chunk-G3OOCXAI.js.map → chunk-U7VECK2G.js.map} +1 -1
  42. package/dist/{chunk-G36A2JRR.cjs → chunk-VSM3NLUX.cjs} +296 -199
  43. package/dist/chunk-VSM3NLUX.cjs.map +1 -0
  44. package/dist/{chunk-3VOUB4ZU.cjs → chunk-VZC4BWWH.cjs} +8 -8
  45. package/dist/{chunk-3VOUB4ZU.cjs.map → chunk-VZC4BWWH.cjs.map} +1 -1
  46. package/dist/{chunk-BAMR7HKO.js → chunk-W3DD3XP5.js} +296 -199
  47. package/dist/chunk-W3DD3XP5.js.map +1 -0
  48. package/dist/{chunk-JTXVR2RA.cjs → chunk-WQSGX6XA.cjs} +5 -5
  49. package/dist/{chunk-JTXVR2RA.cjs.map → chunk-WQSGX6XA.cjs.map} +1 -1
  50. package/dist/{chunk-VU6DVS7J.js → chunk-WTYNK7Q4.js} +4 -4
  51. package/dist/{chunk-VU6DVS7J.js.map → chunk-WTYNK7Q4.js.map} +1 -1
  52. package/dist/{chunk-CKGIPST2.js → chunk-XXBWX7DT.js} +138 -106
  53. package/dist/chunk-XXBWX7DT.js.map +1 -0
  54. package/dist/{chunk-ZPMFINU2.cjs → chunk-ZCVTH3CH.cjs} +464 -130
  55. package/dist/chunk-ZCVTH3CH.cjs.map +1 -0
  56. package/dist/evals/index.cjs +4 -4
  57. package/dist/evals/index.js +1 -1
  58. package/dist/evals/scoreTraces/index.cjs +3 -3
  59. package/dist/evals/scoreTraces/index.js +1 -1
  60. package/dist/index.cjs +2 -2
  61. package/dist/index.js +1 -1
  62. package/dist/llm/index.cjs +14 -14
  63. package/dist/llm/index.js +5 -5
  64. package/dist/llm/model/aisdk/v5/model.d.ts.map +1 -1
  65. package/dist/loop/index.cjs +2 -2
  66. package/dist/loop/index.js +1 -1
  67. package/dist/loop/test-utils/generateText.d.ts.map +1 -1
  68. package/dist/loop/test-utils/resultObject.d.ts.map +1 -1
  69. package/dist/loop/test-utils/toUIMessageStream.d.ts.map +1 -1
  70. package/dist/loop/test-utils/utils.d.ts.map +1 -1
  71. package/dist/loop/workflows/agentic-execution/llm-execution-step.d.ts.map +1 -1
  72. package/dist/loop/workflows/agentic-execution/llm-mapping-step.d.ts.map +1 -1
  73. package/dist/mastra/index.cjs +2 -2
  74. package/dist/mastra/index.js +1 -1
  75. package/dist/memory/index.cjs +6 -6
  76. package/dist/memory/index.js +3 -3
  77. package/dist/models-dev-6PRLJKVZ.js +3 -0
  78. package/dist/{models-dev-GCVENVWA.js.map → models-dev-6PRLJKVZ.js.map} +1 -1
  79. package/dist/models-dev-WHMI5G6Y.cjs +12 -0
  80. package/dist/{models-dev-TIBJR6IG.cjs.map → models-dev-WHMI5G6Y.cjs.map} +1 -1
  81. package/dist/netlify-46I3SNNV.cjs +12 -0
  82. package/dist/{netlify-NTSNNT6F.cjs.map → netlify-46I3SNNV.cjs.map} +1 -1
  83. package/dist/netlify-EBQ6YUC6.js +3 -0
  84. package/dist/{netlify-O5NJW7CF.js.map → netlify-EBQ6YUC6.js.map} +1 -1
  85. package/dist/processors/index.cjs +11 -11
  86. package/dist/processors/index.js +1 -1
  87. package/dist/provider-registry-HDG6UMUC.js +3 -0
  88. package/dist/{provider-registry-74GMFZKT.js.map → provider-registry-HDG6UMUC.js.map} +1 -1
  89. package/dist/provider-registry-RP2W4B24.cjs +40 -0
  90. package/dist/{provider-registry-BZP3DIIV.cjs.map → provider-registry-RP2W4B24.cjs.map} +1 -1
  91. package/dist/relevance/index.cjs +2 -2
  92. package/dist/relevance/index.js +1 -1
  93. package/dist/server/auth.d.ts +11 -0
  94. package/dist/server/auth.d.ts.map +1 -1
  95. package/dist/server/index.cjs +10 -0
  96. package/dist/server/index.cjs.map +1 -1
  97. package/dist/server/index.js +10 -0
  98. package/dist/server/index.js.map +1 -1
  99. package/dist/storage/index.cjs +29 -29
  100. package/dist/storage/index.js +1 -1
  101. package/dist/stream/aisdk/v5/compat/prepare-tools.d.ts.map +1 -1
  102. package/dist/stream/index.cjs +11 -11
  103. package/dist/stream/index.js +2 -2
  104. package/dist/test-utils/llm-mock.cjs +66 -29
  105. package/dist/test-utils/llm-mock.cjs.map +1 -1
  106. package/dist/test-utils/llm-mock.d.ts +4 -2
  107. package/dist/test-utils/llm-mock.d.ts.map +1 -1
  108. package/dist/test-utils/llm-mock.js +66 -29
  109. package/dist/test-utils/llm-mock.js.map +1 -1
  110. package/dist/voice/aisdk/index.d.ts +3 -0
  111. package/dist/voice/aisdk/index.d.ts.map +1 -0
  112. package/dist/voice/aisdk/speech.d.ts +23 -0
  113. package/dist/voice/aisdk/speech.d.ts.map +1 -0
  114. package/dist/voice/aisdk/transcription.d.ts +22 -0
  115. package/dist/voice/aisdk/transcription.d.ts.map +1 -0
  116. package/dist/voice/composite-voice.d.ts +4 -3
  117. package/dist/voice/composite-voice.d.ts.map +1 -1
  118. package/dist/voice/index.cjs +12 -4
  119. package/dist/voice/index.d.ts +1 -0
  120. package/dist/voice/index.d.ts.map +1 -1
  121. package/dist/voice/index.js +1 -1
  122. package/dist/workflows/evented/index.cjs +10 -10
  123. package/dist/workflows/evented/index.js +1 -1
  124. package/dist/workflows/index.cjs +19 -19
  125. package/dist/workflows/index.js +1 -1
  126. package/package.json +10 -10
  127. package/dist/chunk-4DWZ4Z6H.js.map +0 -1
  128. package/dist/chunk-BAMR7HKO.js.map +0 -1
  129. package/dist/chunk-CKGIPST2.js.map +0 -1
  130. package/dist/chunk-G36A2JRR.cjs.map +0 -1
  131. package/dist/chunk-KOSW5PP5.js.map +0 -1
  132. package/dist/chunk-MCUX2D5Q.js.map +0 -1
  133. package/dist/chunk-N4SJ4YX7.cjs.map +0 -1
  134. package/dist/chunk-OWX2PUFH.cjs.map +0 -1
  135. package/dist/chunk-QUKUN6NR.cjs.map +0 -1
  136. package/dist/chunk-T3WZCEC4.js.map +0 -1
  137. package/dist/chunk-UIZSWUKP.js.map +0 -1
  138. package/dist/chunk-VZGBVYXA.cjs.map +0 -1
  139. package/dist/chunk-YQ7NLZZ3.cjs.map +0 -1
  140. package/dist/chunk-ZPMFINU2.cjs.map +0 -1
  141. package/dist/models-dev-GCVENVWA.js +0 -3
  142. package/dist/models-dev-TIBJR6IG.cjs +0 -12
  143. package/dist/netlify-NTSNNT6F.cjs +0 -12
  144. package/dist/netlify-O5NJW7CF.js +0 -3
  145. package/dist/provider-registry-74GMFZKT.js +0 -3
  146. package/dist/provider-registry-BZP3DIIV.cjs +0 -40
@@ -1,9 +1,9 @@
1
1
  'use strict';
2
2
 
3
- var chunkQUKUN6NR_cjs = require('./chunk-QUKUN6NR.cjs');
3
+ var chunkISMGVGUM_cjs = require('./chunk-ISMGVGUM.cjs');
4
4
  var chunkABJOUEVA_cjs = require('./chunk-ABJOUEVA.cjs');
5
- var chunkG36A2JRR_cjs = require('./chunk-G36A2JRR.cjs');
6
- var chunkN4SJ4YX7_cjs = require('./chunk-N4SJ4YX7.cjs');
5
+ var chunkVSM3NLUX_cjs = require('./chunk-VSM3NLUX.cjs');
6
+ var chunk3W5RQCCY_cjs = require('./chunk-3W5RQCCY.cjs');
7
7
  var chunkO6NA3Z43_cjs = require('./chunk-O6NA3Z43.cjs');
8
8
  var chunkMR7ZWBL6_cjs = require('./chunk-MR7ZWBL6.cjs');
9
9
  var chunkHBJPYQRN_cjs = require('./chunk-HBJPYQRN.cjs');
@@ -449,14 +449,22 @@ function prepareToolsAndToolChoice({
449
449
  inputSchema: aiV5.asSchema(sdkTool.inputSchema).jsonSchema,
450
450
  providerOptions: sdkTool.providerOptions
451
451
  };
452
- case "provider-defined":
452
+ case "provider-defined": {
453
+ const providerId = sdkTool.id;
454
+ let providerToolName = name;
455
+ if (providerId && providerId.includes(".")) {
456
+ providerToolName = providerId.split(".").slice(1).join(".");
457
+ } else if (providerId) {
458
+ providerToolName = providerId;
459
+ }
453
460
  return {
454
461
  type: "provider-defined",
455
- name,
462
+ name: providerToolName,
456
463
  // TODO: as any seems wrong here. are there cases where we don't have an id?
457
- id: sdkTool.id,
464
+ id: providerId,
458
465
  args: sdkTool.args
459
466
  };
467
+ }
460
468
  default: {
461
469
  const exhaustiveCheck = toolType;
462
470
  throw new Error(`Unsupported tool type: ${exhaustiveCheck}`);
@@ -5356,7 +5364,7 @@ function convertMastraChunkToAISDKv5({
5356
5364
  if (mode === "generate") {
5357
5365
  return {
5358
5366
  type: "file",
5359
- file: new chunkG36A2JRR_cjs.DefaultGeneratedFile({
5367
+ file: new chunkVSM3NLUX_cjs.DefaultGeneratedFile({
5360
5368
  data: chunk.payload.data,
5361
5369
  mediaType: chunk.payload.mimeType
5362
5370
  })
@@ -5364,7 +5372,7 @@ function convertMastraChunkToAISDKv5({
5364
5372
  }
5365
5373
  return {
5366
5374
  type: "file",
5367
- file: new chunkG36A2JRR_cjs.DefaultGeneratedFileWithType({
5375
+ file: new chunkVSM3NLUX_cjs.DefaultGeneratedFileWithType({
5368
5376
  data: chunk.payload.data,
5369
5377
  mediaType: chunk.payload.mimeType
5370
5378
  })
@@ -5748,23 +5756,22 @@ async function processOutputStream({
5748
5756
  if (runState.state.textDeltas.length) {
5749
5757
  const textStartPayload = chunk.payload;
5750
5758
  const providerMetadata = textStartPayload.providerMetadata ?? runState.state.providerOptions;
5751
- messageList.add(
5752
- {
5753
- id: messageId,
5754
- role: "assistant",
5755
- content: [
5756
- providerMetadata ? {
5759
+ const message = {
5760
+ id: messageId,
5761
+ role: "assistant",
5762
+ content: {
5763
+ format: 2,
5764
+ parts: [
5765
+ {
5757
5766
  type: "text",
5758
5767
  text: runState.state.textDeltas.join(""),
5759
- providerOptions: providerMetadata
5760
- } : {
5761
- type: "text",
5762
- text: runState.state.textDeltas.join("")
5768
+ ...providerMetadata ? { providerMetadata } : {}
5763
5769
  }
5764
5770
  ]
5765
5771
  },
5766
- "response"
5767
- );
5772
+ createdAt: /* @__PURE__ */ new Date()
5773
+ };
5774
+ messageList.add(message, "response");
5768
5775
  }
5769
5776
  runState.setState({
5770
5777
  isStreaming: false,
@@ -5844,20 +5851,23 @@ async function processOutputStream({
5844
5851
  providerOptions: chunk.payload.providerMetadata ?? runState.state.providerOptions
5845
5852
  });
5846
5853
  if (Object.values(chunk.payload.providerMetadata || {}).find((v) => v?.redactedData)) {
5847
- messageList.add(
5848
- {
5849
- id: messageId,
5850
- role: "assistant",
5851
- content: [
5854
+ const message = {
5855
+ id: messageId,
5856
+ role: "assistant",
5857
+ content: {
5858
+ format: 2,
5859
+ parts: [
5852
5860
  {
5853
5861
  type: "reasoning",
5854
- text: "",
5855
- providerOptions: chunk.payload.providerMetadata ?? runState.state.providerOptions
5862
+ reasoning: "",
5863
+ details: [{ type: "redacted", data: "" }],
5864
+ providerMetadata: chunk.payload.providerMetadata ?? runState.state.providerOptions
5856
5865
  }
5857
5866
  ]
5858
5867
  },
5859
- "response"
5860
- );
5868
+ createdAt: /* @__PURE__ */ new Date()
5869
+ };
5870
+ messageList.add(message, "response");
5861
5871
  if (isControllerOpen(controller)) {
5862
5872
  controller.enqueue(chunk);
5863
5873
  }
@@ -5883,20 +5893,23 @@ async function processOutputStream({
5883
5893
  }
5884
5894
  case "reasoning-end": {
5885
5895
  if (runState.state.reasoningDeltas.length > 0) {
5886
- messageList.add(
5887
- {
5888
- id: messageId,
5889
- role: "assistant",
5890
- content: [
5896
+ const message = {
5897
+ id: messageId,
5898
+ role: "assistant",
5899
+ content: {
5900
+ format: 2,
5901
+ parts: [
5891
5902
  {
5892
5903
  type: "reasoning",
5893
- text: runState.state.reasoningDeltas.join(""),
5894
- providerOptions: chunk.payload.providerMetadata ?? runState.state.providerOptions
5904
+ reasoning: "",
5905
+ details: [{ type: "text", text: runState.state.reasoningDeltas.join("") }],
5906
+ providerMetadata: chunk.payload.providerMetadata ?? runState.state.providerOptions
5895
5907
  }
5896
5908
  ]
5897
5909
  },
5898
- "response"
5899
- );
5910
+ createdAt: /* @__PURE__ */ new Date()
5911
+ };
5912
+ messageList.add(message, "response");
5900
5913
  }
5901
5914
  runState.setState({
5902
5915
  isReasoning: false,
@@ -5908,25 +5921,31 @@ async function processOutputStream({
5908
5921
  break;
5909
5922
  }
5910
5923
  case "file":
5911
- messageList.add(
5912
- {
5924
+ {
5925
+ const message = {
5913
5926
  id: messageId,
5914
5927
  role: "assistant",
5915
- content: [
5916
- {
5917
- type: "file",
5918
- data: chunk.payload.data,
5919
- mimeType: chunk.payload.mimeType
5920
- }
5921
- ]
5922
- },
5923
- "response"
5924
- );
5925
- controller.enqueue(chunk);
5928
+ content: {
5929
+ format: 2,
5930
+ parts: [
5931
+ {
5932
+ type: "file",
5933
+ // @ts-expect-error
5934
+ data: chunk.payload.data,
5935
+ // TODO: incorrect string type
5936
+ mimeType: chunk.payload.mimeType
5937
+ }
5938
+ ]
5939
+ },
5940
+ createdAt: /* @__PURE__ */ new Date()
5941
+ };
5942
+ messageList.add(message, "response");
5943
+ controller.enqueue(chunk);
5944
+ }
5926
5945
  break;
5927
5946
  case "source":
5928
- messageList.add(
5929
- {
5947
+ {
5948
+ const message = {
5930
5949
  id: messageId,
5931
5950
  role: "assistant",
5932
5951
  content: {
@@ -5945,10 +5964,10 @@ async function processOutputStream({
5945
5964
  ]
5946
5965
  },
5947
5966
  createdAt: /* @__PURE__ */ new Date()
5948
- },
5949
- "response"
5950
- );
5951
- controller.enqueue(chunk);
5967
+ };
5968
+ messageList.add(message, "response");
5969
+ controller.enqueue(chunk);
5970
+ }
5952
5971
  break;
5953
5972
  case "finish":
5954
5973
  runState.setState({
@@ -6115,7 +6134,7 @@ function createLLMExecutionStep({
6115
6134
  }
6116
6135
  if (prepareStepResult.messages) {
6117
6136
  const newMessages = prepareStepResult.messages;
6118
- const newMessageList = new chunkG36A2JRR_cjs.MessageList();
6137
+ const newMessageList = new chunkVSM3NLUX_cjs.MessageList();
6119
6138
  for (const message of newMessages) {
6120
6139
  if (message.role === "system") {
6121
6140
  newMessageList.addSystem(message);
@@ -6287,24 +6306,27 @@ function createLLMExecutionStep({
6287
6306
  return chunk.payload;
6288
6307
  });
6289
6308
  if (toolCalls.length > 0) {
6290
- const assistantContent = [
6291
- ...toolCalls.map((toolCall) => {
6292
- return {
6293
- type: "tool-call",
6294
- toolCallId: toolCall.toolCallId,
6295
- toolName: toolCall.toolName,
6296
- args: toolCall.args
6297
- };
6298
- })
6299
- ];
6300
- messageList.add(
6301
- {
6302
- id: messageId,
6303
- role: "assistant",
6304
- content: assistantContent
6309
+ const message = {
6310
+ id: messageId,
6311
+ role: "assistant",
6312
+ content: {
6313
+ format: 2,
6314
+ parts: toolCalls.map((toolCall) => {
6315
+ return {
6316
+ type: "tool-invocation",
6317
+ toolInvocation: {
6318
+ state: "call",
6319
+ toolCallId: toolCall.toolCallId,
6320
+ toolName: toolCall.toolName,
6321
+ args: toolCall.args
6322
+ },
6323
+ ...toolCall.providerMetadata ? { providerMetadata: toolCall.providerMetadata } : {}
6324
+ };
6325
+ })
6305
6326
  },
6306
- "response"
6307
- );
6327
+ createdAt: /* @__PURE__ */ new Date()
6328
+ };
6329
+ messageList.add(message, "response");
6308
6330
  }
6309
6331
  const finishReason = runState?.state?.stepResult?.reason ?? outputStream._getImmediateFinishReason();
6310
6332
  const hasErrored = runState.state.hasErrored;
@@ -6386,24 +6408,28 @@ function createLLMMappingStep({ models, _internal, ...rest }, llmExecutionStep)
6386
6408
  };
6387
6409
  rest.controller.enqueue(chunk);
6388
6410
  });
6389
- rest.messageList.add(
6390
- {
6391
- id: toolResultMessageId,
6392
- role: "tool",
6393
- content: errorResults.map((toolCall) => {
6411
+ const msg = {
6412
+ id: toolResultMessageId || "",
6413
+ role: "assistant",
6414
+ content: {
6415
+ format: 2,
6416
+ parts: errorResults.map((toolCallErrorResult) => {
6394
6417
  return {
6395
- type: "tool-result",
6396
- args: toolCall.args,
6397
- toolCallId: toolCall.toolCallId,
6398
- toolName: toolCall.toolName,
6399
- result: {
6400
- tool_execution_error: toolCall.error?.message ?? toolCall.error
6401
- }
6418
+ type: "tool-invocation",
6419
+ toolInvocation: {
6420
+ state: "result",
6421
+ toolCallId: toolCallErrorResult.toolCallId,
6422
+ toolName: toolCallErrorResult.toolName,
6423
+ args: toolCallErrorResult.args,
6424
+ result: toolCallErrorResult.error?.message ?? toolCallErrorResult.error
6425
+ },
6426
+ ...toolCallErrorResult.providerMetadata ? { providerMetadata: toolCallErrorResult.providerMetadata } : {}
6402
6427
  };
6403
6428
  })
6404
6429
  },
6405
- "response"
6406
- );
6430
+ createdAt: /* @__PURE__ */ new Date()
6431
+ };
6432
+ rest.messageList.add(msg, "response");
6407
6433
  }
6408
6434
  initialResult.stepResult.isContinued = false;
6409
6435
  return bail(initialResult);
@@ -6431,24 +6457,30 @@ function createLLMMappingStep({ models, _internal, ...rest }, llmExecutionStep)
6431
6457
  })
6432
6458
  });
6433
6459
  }
6434
- const toolResultMessageId = rest.experimental_generateMessageId?.() || _internal?.generateId?.();
6435
- rest.messageList.add(
6436
- {
6437
- id: toolResultMessageId,
6438
- role: "tool",
6439
- content: inputData.map((toolCall2) => {
6440
- return {
6441
- type: "tool-result",
6442
- args: toolCall2.args,
6443
- toolCallId: toolCall2.toolCallId,
6444
- toolName: toolCall2.toolName,
6445
- result: toolCall2.result
6446
- };
6447
- })
6448
- },
6449
- "response"
6450
- );
6451
6460
  }
6461
+ const toolResultMessageId = rest.experimental_generateMessageId?.() || _internal?.generateId?.();
6462
+ const toolResultMessage = {
6463
+ id: toolResultMessageId || "",
6464
+ role: "assistant",
6465
+ content: {
6466
+ format: 2,
6467
+ parts: inputData.map((toolCall) => {
6468
+ return {
6469
+ type: "tool-invocation",
6470
+ toolInvocation: {
6471
+ state: "result",
6472
+ toolCallId: toolCall.toolCallId,
6473
+ toolName: toolCall.toolName,
6474
+ args: toolCall.args,
6475
+ result: toolCall.result
6476
+ },
6477
+ ...toolCall.providerMetadata ? { providerMetadata: toolCall.providerMetadata } : {}
6478
+ };
6479
+ })
6480
+ },
6481
+ createdAt: /* @__PURE__ */ new Date()
6482
+ };
6483
+ rest.messageList.add(toolResultMessage, "response");
6452
6484
  return {
6453
6485
  ...initialResult,
6454
6486
  messages: {
@@ -7459,7 +7491,7 @@ async function prepareMemoryStep({
7459
7491
  );
7460
7492
  }
7461
7493
  } else {
7462
- const messageList = new chunkG36A2JRR_cjs.MessageList({
7494
+ const messageList = new chunkVSM3NLUX_cjs.MessageList({
7463
7495
  threadId: thread?.id,
7464
7496
  resourceId: thread?.resourceId
7465
7497
  });
@@ -7954,7 +7986,7 @@ ${completionResult?.object?.finalResult}` : ""}
7954
7986
  requestContext
7955
7987
  });
7956
7988
  let chunks = [];
7957
- for await (const chunk of stream) {
7989
+ for await (const chunk of stream.fullStream) {
7958
7990
  chunks.push(chunk);
7959
7991
  await writer?.write({
7960
7992
  type: `workflow-execution-event-${chunk.type}`,
@@ -8911,7 +8943,7 @@ var AgentLegacyHandler = class {
8911
8943
  writableStream,
8912
8944
  methodType: methodType === "generate" ? "generateLegacy" : "streamLegacy"
8913
8945
  });
8914
- const messageList = new chunkG36A2JRR_cjs.MessageList({
8946
+ const messageList = new chunkVSM3NLUX_cjs.MessageList({
8915
8947
  threadId,
8916
8948
  resourceId,
8917
8949
  generateMessageId: this.capabilities.mastra?.generateId?.bind(this.capabilities.mastra),
@@ -8992,7 +9024,7 @@ var AgentLegacyHandler = class {
8992
9024
  existingThread || hasResourceScopeSemanticRecall ? this.capabilities.getMemoryMessages({
8993
9025
  resourceId,
8994
9026
  threadId: threadObject.id,
8995
- vectorMessageSearch: new chunkG36A2JRR_cjs.MessageList().add(messages, `user`).getLatestUserContent() || "",
9027
+ vectorMessageSearch: new chunkVSM3NLUX_cjs.MessageList().add(messages, `user`).getLatestUserContent() || "",
8996
9028
  memoryConfig,
8997
9029
  requestContext
8998
9030
  }) : { messages: [] },
@@ -9014,7 +9046,7 @@ The following messages were remembered from a different conversation:
9014
9046
  <remembered_from_other_conversation>
9015
9047
  ${(() => {
9016
9048
  let result = ``;
9017
- const messages2 = new chunkG36A2JRR_cjs.MessageList().add(resultsFromOtherThreads, "memory").get.all.v1();
9049
+ const messages2 = new chunkVSM3NLUX_cjs.MessageList().add(resultsFromOtherThreads, "memory").get.all.v1();
9018
9050
  let lastYmd = null;
9019
9051
  for (const msg of messages2) {
9020
9052
  const date = msg.createdAt;
@@ -9065,7 +9097,7 @@ the following messages are from ${ymd}
9065
9097
  systemMessage,
9066
9098
  memorySystemMessage: memorySystemMessage || void 0
9067
9099
  });
9068
- const processedList = new chunkG36A2JRR_cjs.MessageList({
9100
+ const processedList = new chunkVSM3NLUX_cjs.MessageList({
9069
9101
  threadId: threadObject.id,
9070
9102
  resourceId,
9071
9103
  generateMessageId: this.capabilities.mastra?.generateId?.bind(this.capabilities.mastra),
@@ -9121,7 +9153,7 @@ the following messages are from ${ymd}
9121
9153
  result: resToLog,
9122
9154
  threadId
9123
9155
  });
9124
- const messageListResponses = new chunkG36A2JRR_cjs.MessageList({
9156
+ const messageListResponses = new chunkVSM3NLUX_cjs.MessageList({
9125
9157
  threadId,
9126
9158
  resourceId,
9127
9159
  generateMessageId: this.capabilities.mastra?.generateId?.bind(this.capabilities.mastra),
@@ -9481,7 +9513,7 @@ the following messages are from ${ymd}
9481
9513
  requestContext: mergedGenerateOptions.requestContext || new chunkJ7O6WENZ_cjs.RequestContext(),
9482
9514
  tracingContext,
9483
9515
  outputProcessorOverrides: finalOutputProcessors,
9484
- messageList: new chunkG36A2JRR_cjs.MessageList({
9516
+ messageList: new chunkVSM3NLUX_cjs.MessageList({
9485
9517
  threadId: llmOptions.threadId || "",
9486
9518
  resourceId: llmOptions.resourceId || ""
9487
9519
  }).add(
@@ -9571,7 +9603,7 @@ the following messages are from ${ymd}
9571
9603
  const outputProcessorResult = await this.capabilities.__runOutputProcessors({
9572
9604
  requestContext: mergedGenerateOptions.requestContext || new chunkJ7O6WENZ_cjs.RequestContext(),
9573
9605
  tracingContext,
9574
- messageList: new chunkG36A2JRR_cjs.MessageList({
9606
+ messageList: new chunkVSM3NLUX_cjs.MessageList({
9575
9607
  threadId: llmOptions.threadId || "",
9576
9608
  resourceId: llmOptions.resourceId || ""
9577
9609
  }).add(
@@ -11966,7 +11998,7 @@ var prepareToolsStepOutputSchema = z5.z.object({
11966
11998
  var prepareMemoryStepOutputSchema = z5.z.object({
11967
11999
  threadExists: z5.z.boolean(),
11968
12000
  thread: storageThreadSchema.optional(),
11969
- messageList: z5.z.instanceof(chunkG36A2JRR_cjs.MessageList),
12001
+ messageList: z5.z.instanceof(chunkVSM3NLUX_cjs.MessageList),
11970
12002
  tripwire: z5.z.boolean().optional(),
11971
12003
  tripwireReason: z5.z.string().optional()
11972
12004
  });
@@ -11999,7 +12031,7 @@ function createPrepareMemoryStep({
11999
12031
  outputSchema: prepareMemoryStepOutputSchema,
12000
12032
  execute: async ({ tracingContext }) => {
12001
12033
  const thread = threadFromArgs;
12002
- const messageList = new chunkG36A2JRR_cjs.MessageList({
12034
+ const messageList = new chunkVSM3NLUX_cjs.MessageList({
12003
12035
  threadId: thread?.id,
12004
12036
  resourceId,
12005
12037
  generateMessageId: capabilities.generateMessageId,
@@ -12080,7 +12112,7 @@ function createPrepareMemoryStep({
12080
12112
  existingThread || hasResourceScopeSemanticRecall ? capabilities.getMemoryMessages({
12081
12113
  resourceId,
12082
12114
  threadId: threadObject.id,
12083
- vectorMessageSearch: new chunkG36A2JRR_cjs.MessageList().add(options.messages, `user`).getLatestUserContent() || "",
12115
+ vectorMessageSearch: new chunkVSM3NLUX_cjs.MessageList().add(options.messages, `user`).getLatestUserContent() || "",
12084
12116
  memoryConfig,
12085
12117
  requestContext
12086
12118
  }) : { messages: [] },
@@ -12106,7 +12138,7 @@ The following messages were remembered from a different conversation:
12106
12138
  <remembered_from_other_conversation>
12107
12139
  ${(() => {
12108
12140
  let result = ``;
12109
- const messages = new chunkG36A2JRR_cjs.MessageList().add(resultsFromOtherThreads, "memory").get.all.v1();
12141
+ const messages = new chunkVSM3NLUX_cjs.MessageList().add(resultsFromOtherThreads, "memory").get.all.v1();
12110
12142
  let lastYmd = null;
12111
12143
  for (const msg of messages) {
12112
12144
  const date = msg.createdAt;
@@ -12153,7 +12185,7 @@ the following messages are from ${ymd}
12153
12185
  systemMessage,
12154
12186
  memorySystemMessage: memorySystemMessage || void 0
12155
12187
  });
12156
- const processedList = new chunkG36A2JRR_cjs.MessageList({
12188
+ const processedList = new chunkVSM3NLUX_cjs.MessageList({
12157
12189
  threadId: threadObject.id,
12158
12190
  resourceId,
12159
12191
  generateMessageId: capabilities.generateMessageId,
@@ -12474,7 +12506,7 @@ var Agent = class extends chunkKEXGB7FK_cjs.MastraBase {
12474
12506
  this.#voice?.addInstructions(config.instructions);
12475
12507
  }
12476
12508
  } else {
12477
- this.#voice = new chunkQUKUN6NR_cjs.DefaultVoice();
12509
+ this.#voice = new chunkISMGVGUM_cjs.DefaultVoice();
12478
12510
  }
12479
12511
  if (config.inputProcessors) {
12480
12512
  this.#inputProcessors = config.inputProcessors;
@@ -12721,7 +12753,7 @@ var Agent = class extends chunkKEXGB7FK_cjs.MastraBase {
12721
12753
  voice?.addInstructions(this.#convertInstructionsToString(instructions));
12722
12754
  return voice;
12723
12755
  } else {
12724
- return new chunkQUKUN6NR_cjs.DefaultVoice();
12756
+ return new chunkISMGVGUM_cjs.DefaultVoice();
12725
12757
  }
12726
12758
  }
12727
12759
  /**
@@ -13017,7 +13049,7 @@ var Agent = class extends chunkKEXGB7FK_cjs.MastraBase {
13017
13049
  */
13018
13050
  async resolveModelConfig(modelConfig, requestContext) {
13019
13051
  try {
13020
- return await chunkN4SJ4YX7_cjs.resolveModelConfig(modelConfig, requestContext, this.#mastra);
13052
+ return await chunk3W5RQCCY_cjs.resolveModelConfig(modelConfig, requestContext, this.#mastra);
13021
13053
  } catch (error) {
13022
13054
  const mastraError = new chunkTWH4PTDG_cjs.MastraError({
13023
13055
  id: "AGENT_GET_MODEL_MISSING_MODEL_INSTANCE",
@@ -13223,7 +13255,7 @@ var Agent = class extends chunkKEXGB7FK_cjs.MastraBase {
13223
13255
  instructions
13224
13256
  }) {
13225
13257
  const llm = await this.getLLM({ requestContext, model });
13226
- const normMessage = new chunkG36A2JRR_cjs.MessageList().add(message, "user").get.all.ui().at(-1);
13258
+ const normMessage = new chunkVSM3NLUX_cjs.MessageList().add(message, "user").get.all.ui().at(-1);
13227
13259
  if (!normMessage) {
13228
13260
  throw new Error(`Could not generate title from input ${JSON.stringify(message)}`);
13229
13261
  }
@@ -13246,7 +13278,7 @@ var Agent = class extends chunkKEXGB7FK_cjs.MastraBase {
13246
13278
  const systemInstructions = await this.resolveTitleInstructions(requestContext, instructions);
13247
13279
  let text = "";
13248
13280
  if (llm.getModel().specificationVersion === "v2") {
13249
- const messageList = new chunkG36A2JRR_cjs.MessageList().add(
13281
+ const messageList = new chunkVSM3NLUX_cjs.MessageList().add(
13250
13282
  [
13251
13283
  {
13252
13284
  role: "system",
@@ -13298,7 +13330,7 @@ var Agent = class extends chunkKEXGB7FK_cjs.MastraBase {
13298
13330
  async genTitle(userMessage, requestContext, tracingContext, model, instructions) {
13299
13331
  try {
13300
13332
  if (userMessage) {
13301
- const normMessage = new chunkG36A2JRR_cjs.MessageList().add(userMessage, "user").get.all.ui().at(-1);
13333
+ const normMessage = new chunkVSM3NLUX_cjs.MessageList().add(userMessage, "user").get.all.ui().at(-1);
13302
13334
  if (normMessage) {
13303
13335
  return await this.generateTitleFromUserMessage({
13304
13336
  message: normMessage,
@@ -15924,7 +15956,7 @@ var MastraModelOutput = class extends chunkKEXGB7FK_cjs.MastraBase {
15924
15956
  self.messageList,
15925
15957
  options.tracingContext
15926
15958
  );
15927
- const outputText = self.messageList.get.response.aiV4.core().map((m) => chunkG36A2JRR_cjs.MessageList.coreContentToString(m.content)).join("\n");
15959
+ const outputText = self.messageList.get.response.aiV4.core().map((m) => chunkVSM3NLUX_cjs.MessageList.coreContentToString(m.content)).join("\n");
15928
15960
  self.#delayedPromises.text.resolve(outputText);
15929
15961
  self.#delayedPromises.finishReason.resolve(self.#finishReason);
15930
15962
  if (chunk.payload.metadata) {
@@ -16561,5 +16593,5 @@ exports.tryGenerateWithJsonFallback = tryGenerateWithJsonFallback;
16561
16593
  exports.tryStreamWithJsonFallback = tryStreamWithJsonFallback;
16562
16594
  exports.validateStepInput = validateStepInput;
16563
16595
  exports.validateStepResumeData = validateStepResumeData;
16564
- //# sourceMappingURL=chunk-OWX2PUFH.cjs.map
16565
- //# sourceMappingURL=chunk-OWX2PUFH.cjs.map
16596
+ //# sourceMappingURL=chunk-2NVBZKZI.cjs.map
16597
+ //# sourceMappingURL=chunk-2NVBZKZI.cjs.map