@mastra/core 1.55.0-alpha.2 → 1.55.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 (141) hide show
  1. package/CHANGELOG.md +86 -0
  2. package/dist/agent/agent.d.ts.map +1 -1
  3. package/dist/agent/durable/index.cjs +1 -1
  4. package/dist/agent/durable/index.js +1 -1
  5. package/dist/agent/index.cjs +2 -2
  6. package/dist/agent/index.js +2 -2
  7. package/dist/{agent-BvRfRKIt.js → agent-0y2cApTZ.js} +57 -82
  8. package/dist/agent-0y2cApTZ.js.map +1 -0
  9. package/dist/agent-builder/ee/index.cjs +1 -1
  10. package/dist/agent-builder/ee/index.js +1 -1
  11. package/dist/agent-controller/index.cjs +1 -1
  12. package/dist/agent-controller/index.js +1 -1
  13. package/dist/{agent-controller-CM6tQSMj.js → agent-controller-ByW51eCC.js} +5 -5
  14. package/dist/{agent-controller-CM6tQSMj.js.map → agent-controller-ByW51eCC.js.map} +1 -1
  15. package/dist/{agent-controller-C75dc544.cjs → agent-controller-DahKlMET.cjs} +5 -5
  16. package/dist/{agent-controller-C75dc544.cjs.map → agent-controller-DahKlMET.cjs.map} +1 -1
  17. package/dist/{agent-CwUYflGG.cjs → agent-um2LJs-0.cjs} +57 -82
  18. package/dist/agent-um2LJs-0.cjs.map +1 -0
  19. package/dist/background-tasks/index.cjs +1 -1
  20. package/dist/background-tasks/index.js +1 -1
  21. package/dist/{background-tasks-AKlv5tIo.js → background-tasks-CM94BIj8.js} +2 -2
  22. package/dist/{background-tasks-AKlv5tIo.js.map → background-tasks-CM94BIj8.js.map} +1 -1
  23. package/dist/{background-tasks-Chpan7PB.cjs → background-tasks-CobPW4Z3.cjs} +2 -2
  24. package/dist/{background-tasks-Chpan7PB.cjs.map → background-tasks-CobPW4Z3.cjs.map} +1 -1
  25. package/dist/browser/index.cjs +1 -1
  26. package/dist/browser/index.js +1 -1
  27. package/dist/channels/index.cjs +2 -2
  28. package/dist/channels/index.js +2 -2
  29. package/dist/{channels-BW52ccH_.cjs → channels-BgbloDjB.cjs} +2 -2
  30. package/dist/{channels-BW52ccH_.cjs.map → channels-BgbloDjB.cjs.map} +1 -1
  31. package/dist/{channels-Da9lEAi1.js → channels-MegO_4KL.js} +2 -2
  32. package/dist/{channels-Da9lEAi1.js.map → channels-MegO_4KL.js.map} +1 -1
  33. package/dist/coding-agent/index.cjs +1 -1
  34. package/dist/coding-agent/index.js +1 -1
  35. package/dist/{create-durable-agent-DmTTvoGi.cjs → create-durable-agent-ChmjQwzE.cjs} +8 -8
  36. package/dist/{create-durable-agent-DmTTvoGi.cjs.map → create-durable-agent-ChmjQwzE.cjs.map} +1 -1
  37. package/dist/{create-durable-agent-Bd4Bm5FV.js → create-durable-agent-DH_dWTMR.js} +8 -8
  38. package/dist/{create-durable-agent-Bd4Bm5FV.js.map → create-durable-agent-DH_dWTMR.js.map} +1 -1
  39. package/dist/datasets/index.cjs +1 -1
  40. package/dist/datasets/index.js +1 -1
  41. package/dist/{dist-C077BlAN.js → dist-BZBxELZo.js} +2 -2
  42. package/dist/{dist-C077BlAN.js.map → dist-BZBxELZo.js.map} +1 -1
  43. package/dist/{dist-CsR_D1uk.cjs → dist-ftJxyNRx.cjs} +2 -2
  44. package/dist/{dist-CsR_D1uk.cjs.map → dist-ftJxyNRx.cjs.map} +1 -1
  45. package/dist/docs/SKILL.md +1 -1
  46. package/dist/docs/assets/SOURCE_MAP.json +1 -1
  47. package/dist/evals/index.cjs +1 -1
  48. package/dist/evals/index.js +1 -1
  49. package/dist/evals/scoreTraces/index.cjs +1 -1
  50. package/dist/evals/scoreTraces/index.js +1 -1
  51. package/dist/harness/index.cjs +1 -1
  52. package/dist/harness/index.js +1 -1
  53. package/dist/index.cjs +1 -1
  54. package/dist/index.js +1 -1
  55. package/dist/llm/index.cjs +5 -5
  56. package/dist/llm/index.js +5 -5
  57. package/dist/{llm-DlVyw1cX.js → llm-DGuYy_Nx.js} +5 -5
  58. package/dist/{llm-DlVyw1cX.js.map → llm-DGuYy_Nx.js.map} +1 -1
  59. package/dist/{llm-Bjt2hZ3f.cjs → llm-DmAhSSgh.cjs} +5 -5
  60. package/dist/{llm-Bjt2hZ3f.cjs.map → llm-DmAhSSgh.cjs.map} +1 -1
  61. package/dist/loop/index.cjs +1 -1
  62. package/dist/loop/index.js +1 -1
  63. package/dist/{manager-CYGpXJfK.js → manager-DDRcONBK.js} +3 -3
  64. package/dist/{manager-CYGpXJfK.js.map → manager-DDRcONBK.js.map} +1 -1
  65. package/dist/{manager-BjrFnt_A.cjs → manager-DqHiikx1.cjs} +3 -3
  66. package/dist/{manager-BjrFnt_A.cjs.map → manager-DqHiikx1.cjs.map} +1 -1
  67. package/dist/mastra/index.cjs +1 -1
  68. package/dist/mastra/index.js +1 -1
  69. package/dist/{mastra-CVLF1dWt.js → mastra-B6CffFOC.js} +9 -9
  70. package/dist/{mastra-CVLF1dWt.js.map → mastra-B6CffFOC.js.map} +1 -1
  71. package/dist/{mastra-Bxx9WPf6.cjs → mastra-BlT9srQJ.cjs} +9 -9
  72. package/dist/{mastra-Bxx9WPf6.cjs.map → mastra-BlT9srQJ.cjs.map} +1 -1
  73. package/dist/memory/index.cjs +1 -1
  74. package/dist/memory/index.js +1 -1
  75. package/dist/{model-CA0WLISt.js → model-DQzxkQqM.js} +2 -2
  76. package/dist/{model-CA0WLISt.js.map → model-DQzxkQqM.js.map} +1 -1
  77. package/dist/{model-DMVq6nAS.cjs → model-Iow-mV9i.cjs} +2 -2
  78. package/dist/{model-DMVq6nAS.cjs.map → model-Iow-mV9i.cjs.map} +1 -1
  79. package/dist/{models-dev-Cbus1Uh2.js → models-dev-BFOUCgyS.js} +2 -2
  80. package/dist/{models-dev-Cbus1Uh2.js.map → models-dev-BFOUCgyS.js.map} +1 -1
  81. package/dist/{models-dev-D_X4VMSu.cjs → models-dev-BUEaCBxL.cjs} +2 -2
  82. package/dist/{models-dev-D_X4VMSu.cjs.map → models-dev-BUEaCBxL.cjs.map} +1 -1
  83. package/dist/{netlify-C-nnPVSj.js → netlify-7eHXUkln.js} +2 -2
  84. package/dist/{netlify-C-nnPVSj.js.map → netlify-7eHXUkln.js.map} +1 -1
  85. package/dist/{netlify-CUuCnmtd.cjs → netlify-Db5icdAJ.cjs} +2 -2
  86. package/dist/{netlify-CUuCnmtd.cjs.map → netlify-Db5icdAJ.cjs.map} +1 -1
  87. package/dist/processor-provider/index.cjs +1 -1
  88. package/dist/processor-provider/index.js +1 -1
  89. package/dist/processors/index.cjs +2 -2
  90. package/dist/processors/index.js +2 -2
  91. package/dist/processors/processors/index.d.ts +1 -1
  92. package/dist/processors/processors/index.d.ts.map +1 -1
  93. package/dist/processors/tool-result-reminder.d.ts +23 -0
  94. package/dist/processors/tool-result-reminder.d.ts.map +1 -1
  95. package/dist/{provider-registry-BFknh6Fu.cjs → provider-registry-DRJihW5_.cjs} +6 -6
  96. package/dist/{provider-registry-BFknh6Fu.cjs.map → provider-registry-DRJihW5_.cjs.map} +1 -1
  97. package/dist/{provider-registry-DIbls44Z.js → provider-registry-DzSSAz1R.js} +6 -6
  98. package/dist/{provider-registry-DIbls44Z.js.map → provider-registry-DzSSAz1R.js.map} +1 -1
  99. package/dist/relevance/index.cjs +2 -2
  100. package/dist/relevance/index.js +2 -2
  101. package/dist/stream/index.cjs +3 -3
  102. package/dist/stream/index.js +3 -3
  103. package/dist/{stream-tlVjYkAO.cjs → stream-D-cHV05r.cjs} +3 -3
  104. package/dist/{stream-tlVjYkAO.cjs.map → stream-D-cHV05r.cjs.map} +1 -1
  105. package/dist/{stream-Cd_isEZJ.js → stream-DJaosaeO.js} +3 -3
  106. package/dist/{stream-Cd_isEZJ.js.map → stream-DJaosaeO.js.map} +1 -1
  107. package/dist/test-utils/llm-mock.cjs +1 -1
  108. package/dist/test-utils/llm-mock.js +1 -1
  109. package/dist/tool-loop-agent/index.cjs +1 -1
  110. package/dist/tool-loop-agent/index.js +1 -1
  111. package/dist/{tool-loop-agent-th9L-ls9.cjs → tool-loop-agent-ByrutV2Q.cjs} +4 -4
  112. package/dist/{tool-loop-agent-th9L-ls9.cjs.map → tool-loop-agent-ByrutV2Q.cjs.map} +1 -1
  113. package/dist/{tool-loop-agent-CcT-TTcT.js → tool-loop-agent-BzHXZDL3.js} +4 -4
  114. package/dist/{tool-loop-agent-CcT-TTcT.js.map → tool-loop-agent-BzHXZDL3.js.map} +1 -1
  115. package/dist/{trip-wire-Cj0cJivR.js → trip-wire-DxpTS3jV.js} +2 -2
  116. package/dist/{trip-wire-Cj0cJivR.js.map → trip-wire-DxpTS3jV.js.map} +1 -1
  117. package/dist/{trip-wire-BNzxirr0.cjs → trip-wire-utCESgMt.cjs} +2 -2
  118. package/dist/{trip-wire-BNzxirr0.cjs.map → trip-wire-utCESgMt.cjs.map} +1 -1
  119. package/dist/{utils-BoQofieM.cjs → utils-CPUQn5dX.cjs} +2 -2
  120. package/dist/{utils-BoQofieM.cjs.map → utils-CPUQn5dX.cjs.map} +1 -1
  121. package/dist/{utils-DUfAZ4gr.js → utils-CrKEOVUo.js} +2 -2
  122. package/dist/{utils-DUfAZ4gr.js.map → utils-CrKEOVUo.js.map} +1 -1
  123. package/dist/utils.cjs +1 -1
  124. package/dist/utils.js +1 -1
  125. package/dist/worker/index.cjs +1 -1
  126. package/dist/worker/index.js +1 -1
  127. package/dist/{worker-DwlyX5l8.js → worker-Ciya6mfo.js} +3 -3
  128. package/dist/{worker-DwlyX5l8.js.map → worker-Ciya6mfo.js.map} +1 -1
  129. package/dist/{worker-CsbZPhWb.cjs → worker-YT_pMttZ.cjs} +3 -3
  130. package/dist/{worker-CsbZPhWb.cjs.map → worker-YT_pMttZ.cjs.map} +1 -1
  131. package/dist/{workflow-BR5D6ij_.cjs → workflow-DcS_0R0Z.cjs} +3 -3
  132. package/dist/{workflow-BR5D6ij_.cjs.map → workflow-DcS_0R0Z.cjs.map} +1 -1
  133. package/dist/{workflow-OjZRiiCG.js → workflow-k6s0ESOR.js} +3 -3
  134. package/dist/{workflow-OjZRiiCG.js.map → workflow-k6s0ESOR.js.map} +1 -1
  135. package/dist/workflows/evented/index.cjs +1 -1
  136. package/dist/workflows/evented/index.js +1 -1
  137. package/dist/workflows/index.cjs +1 -1
  138. package/dist/workflows/index.js +1 -1
  139. package/package.json +12 -12
  140. package/dist/agent-BvRfRKIt.js.map +0 -1
  141. package/dist/agent-CwUYflGG.cjs.map +0 -1
@@ -7,24 +7,24 @@ const require_observability = require("./observability-Dc_G1cXD.cjs");
7
7
  const require_utils = require("./utils-tMAiLKfb.cjs");
8
8
  require("./tracing-lPEd0a_y.cjs");
9
9
  const require_request_context = require("./request-context-C6X9IcNF.cjs");
10
- const require_llm = require("./llm-Bjt2hZ3f.cjs");
10
+ const require_llm = require("./llm-DmAhSSgh.cjs");
11
11
  const require_tool = require("./tool-Ch0RJiLS.cjs");
12
12
  const require_ee_C8o0LZ3r = require("./ee-C8o0LZ3r-D6EDXh8B.cjs");
13
- const require_background_tasks = require("./background-tasks-Chpan7PB.cjs");
13
+ const require_background_tasks = require("./background-tasks-CobPW4Z3.cjs");
14
14
  const require_toolchecks = require("./toolchecks-D843gAZS.cjs");
15
15
  const require_types = require("./types-CepZ83u8.cjs");
16
- const require_utils$1 = require("./utils-BoQofieM.cjs");
16
+ const require_utils$1 = require("./utils-CPUQn5dX.cjs");
17
17
  const require_deep_equal = require("./deep-equal-BvQBG8wE.cjs");
18
18
  const require_utils_safe_stringify = require("./utils/safe-stringify.cjs");
19
- const require_trip_wire = require("./trip-wire-BNzxirr0.cjs");
19
+ const require_trip_wire = require("./trip-wire-utCESgMt.cjs");
20
20
  const require_payload_transform = require("./payload-transform-DJzDdfpE.cjs");
21
21
  const require_signals = require("./signals-BnC2UJth.cjs");
22
22
  const require_message_list = require("./message-list-CvuPcMsx.cjs");
23
23
  const require_dist = require("./dist-DZhmZ2Ix.cjs");
24
- const require_stream = require("./stream-tlVjYkAO.cjs");
24
+ const require_stream = require("./stream-D-cHV05r.cjs");
25
25
  const require_types$1 = require("./types-CkUC9wkJ.cjs");
26
- const require_provider_registry = require("./provider-registry-BFknh6Fu.cjs");
27
- const require_model = require("./model-DMVq6nAS.cjs");
26
+ const require_provider_registry = require("./provider-registry-DRJihW5_.cjs");
27
+ const require_model = require("./model-Iow-mV9i.cjs");
28
28
  const require_signal_provider = require("./signal-provider-cWozsCPk.cjs");
29
29
  const require_schedules = require("./schedules-dsrvt_6g.cjs");
30
30
  const require_task_state_processor = require("./task-state-processor-Dh_GxiNX.cjs");
@@ -16669,6 +16669,8 @@ var AgentsMDInjector = class {
16669
16669
  isDirectory;
16670
16670
  readFile;
16671
16671
  getIgnoredInstructionPaths;
16672
+ isEnabled;
16673
+ getReader;
16672
16674
  constructor(options) {
16673
16675
  this.reminderText = options.reminderText;
16674
16676
  this.maxTokens = options.maxTokens ?? 1e3;
@@ -16682,14 +16684,22 @@ var AgentsMDInjector = class {
16682
16684
  });
16683
16685
  this.readFile = options.readFile ?? ((path$2) => (0, fs.readFileSync)(path$2, "utf-8"));
16684
16686
  this.getIgnoredInstructionPaths = options.getIgnoredInstructionPaths;
16687
+ this.isEnabled = options.isEnabled;
16688
+ this.getReader = options.getReader;
16685
16689
  }
16686
16690
  async processInputStep(args) {
16687
16691
  const { messageList } = args;
16692
+ if (this.isEnabled && !this.isEnabled(args)) return messageList;
16693
+ const reader = this.getReader?.(args) ?? {
16694
+ pathExists: this.pathExists,
16695
+ isDirectory: this.isDirectory,
16696
+ readFile: this.readFile
16697
+ };
16688
16698
  const messages = messageList.get.all.db();
16689
16699
  const completedToolCalls = getCompletedToolCalls(getCurrentStepResponseMessages(messageList));
16690
- const instructionPath = this.findReferencedInstructionPath(completedToolCalls);
16700
+ const instructionPath = this.findReferencedInstructionPath(completedToolCalls, reader);
16691
16701
  if (!instructionPath || this.isIgnoredInstructionPath(args, instructionPath)) return messageList;
16692
- const reminderText = this.getReminderText(instructionPath);
16702
+ const reminderText = this.getReminderText(instructionPath, reader);
16693
16703
  if (!reminderText) return messageList;
16694
16704
  const reminderMarkup = getReminderMarkup(reminderText, instructionPath);
16695
16705
  if (this.hasReminderAlready(messages, reminderMarkup)) return messageList;
@@ -16705,9 +16715,9 @@ var AgentsMDInjector = class {
16705
16715
  });
16706
16716
  return messageList;
16707
16717
  }
16708
- getReminderText(instructionPath) {
16718
+ getReminderText(instructionPath, reader) {
16709
16719
  try {
16710
- const content = this.readFile(instructionPath).trim();
16720
+ const content = reader.readFile(instructionPath).trim();
16711
16721
  if (content.length > 0) return truncateToTokenLimit(content, this.maxTokens);
16712
16722
  } catch {}
16713
16723
  return this.reminderText?.trim() || void 0;
@@ -16717,21 +16727,21 @@ var AgentsMDInjector = class {
16717
16727
  const normalizedInstructionPath = toAbsolutePath(instructionPath);
16718
16728
  return ignoredPaths.some((path$3) => toAbsolutePath(path$3) === normalizedInstructionPath);
16719
16729
  }
16720
- findReferencedInstructionPath(toolCalls) {
16730
+ findReferencedInstructionPath(toolCalls, reader) {
16721
16731
  if (!Array.isArray(toolCalls)) return;
16722
16732
  for (const toolCall of toolCalls) {
16723
- const path$4 = this.findInstructionPathInInvocation(toolCall);
16733
+ const path$4 = this.findInstructionPathInInvocation(toolCall, reader);
16724
16734
  if (path$4) return path$4;
16725
16735
  }
16726
16736
  }
16727
- findInstructionPathInInvocation(invocation) {
16737
+ findInstructionPathInInvocation(invocation, reader) {
16728
16738
  if (!isRecord$2(invocation)) return;
16729
16739
  const args = parseInvocationArgs(invocation.args);
16730
16740
  if (!args) return;
16731
16741
  for (const field of PATH_FIELDS) {
16732
16742
  const value = args[field];
16733
16743
  if (typeof value !== "string" || value.trim().length === 0) continue;
16734
- const instructionPath = findInstructionFileForPath(value, this.pathExists, this.isDirectory);
16744
+ const instructionPath = findInstructionFileForPath(value, reader.pathExists, reader.isDirectory);
16735
16745
  if (instructionPath) return instructionPath;
16736
16746
  }
16737
16747
  }
@@ -33129,7 +33139,7 @@ var Agent = class Agent extends require_base.MastraBase {
33129
33139
  if (!this.#durable) return void 0;
33130
33140
  if (this.#mastra) return void 0;
33131
33141
  if (this.#standaloneDurable) return this.#standaloneDurable;
33132
- const { createDurableAgent } = await Promise.resolve().then(() => require("./create-durable-agent-DmTTvoGi.cjs")).then((n) => n.create_durable_agent_exports);
33142
+ const { createDurableAgent } = await Promise.resolve().then(() => require("./create-durable-agent-ChmjQwzE.cjs")).then((n) => n.create_durable_agent_exports);
33133
33143
  const opts = this.#durable === true ? {} : this.#durable;
33134
33144
  const wrapper = createDurableAgent({
33135
33145
  agent: this,
@@ -35457,11 +35467,33 @@ var Agent = class Agent extends require_base.MastraBase {
35457
35467
  error: filterError
35458
35468
  });
35459
35469
  }
35460
- const messagesForSubAgent = [{
35470
+ const injectSupervisorMemory = Boolean(resourceId && threadId && !resolvedHasOwnMemoryConfig);
35471
+ const subAgentMemoryOption = injectSupervisorMemory ? { memory: {
35472
+ resource: subAgentResourceId,
35473
+ thread: subAgentThreadId,
35474
+ options: {
35475
+ lastMessages: false,
35476
+ generateTitle: false
35477
+ }
35478
+ } } : {};
35479
+ const subAgentUserMessage = {
35480
+ id: this.#mastra?.generateId() || (0, crypto$1.randomUUID)(),
35481
+ role: "user",
35482
+ createdAt: /* @__PURE__ */ new Date(),
35483
+ threadId: subAgentThreadId,
35484
+ resourceId: subAgentResourceId,
35485
+ content: {
35486
+ format: 2,
35487
+ parts: [{
35488
+ type: "text",
35489
+ text: effectivePrompt
35490
+ }]
35491
+ }
35492
+ };
35493
+ const messagesForSubAgent = injectSupervisorMemory ? [subAgentUserMessage] : [{
35461
35494
  role: "user",
35462
35495
  content: effectivePrompt
35463
35496
  }];
35464
- const subAgentPromptCreatedAt = /* @__PURE__ */ new Date();
35465
35497
  const subAgentAbortOptions = context?.abortSignal ? { abortSignal: context.abortSignal } : {};
35466
35498
  if ((methodType === "generate" || methodType === "generateLegacy") && require_trip_wire.supportedLanguageModelSpecifications.includes(resolvedModelVersion)) {
35467
35499
  const generateResult = resumeData ? await resolvedAgent.resumeGenerate(resumeData, {
@@ -35472,14 +35504,7 @@ var Agent = class Agent extends require_base.MastraBase {
35472
35504
  ...effectiveInstructions && { instructions: effectiveInstructions },
35473
35505
  ...effectiveMaxSteps && { maxSteps: effectiveMaxSteps },
35474
35506
  context: filteredContextMessages,
35475
- ...resourceId && threadId && !resolvedHasOwnMemoryConfig ? { memory: {
35476
- resource: subAgentResourceId,
35477
- thread: subAgentThreadId,
35478
- options: {
35479
- lastMessages: false,
35480
- generateTitle: false
35481
- }
35482
- } } : {},
35507
+ ...subAgentMemoryOption,
35483
35508
  ...subAgentAbortOptions,
35484
35509
  disableBackgroundTasks: true
35485
35510
  }) : await resolvedAgent.generate(messagesForSubAgent, {
@@ -35489,14 +35514,7 @@ var Agent = class Agent extends require_base.MastraBase {
35489
35514
  ...effectiveInstructions && { instructions: effectiveInstructions },
35490
35515
  ...effectiveMaxSteps && { maxSteps: effectiveMaxSteps },
35491
35516
  context: filteredContextMessages,
35492
- ...resourceId && threadId && !resolvedHasOwnMemoryConfig ? { memory: {
35493
- resource: subAgentResourceId,
35494
- thread: subAgentThreadId,
35495
- options: {
35496
- lastMessages: false,
35497
- generateTitle: false
35498
- }
35499
- } } : {},
35517
+ ...subAgentMemoryOption,
35500
35518
  ...subAgentAbortOptions,
35501
35519
  disableBackgroundTasks: true
35502
35520
  });
@@ -35508,21 +35526,7 @@ var Agent = class Agent extends require_base.MastraBase {
35508
35526
  args: toolResult.payload.args,
35509
35527
  isError: toolResult.payload.isError
35510
35528
  }));
35511
- fullSubAgentMessages = [{
35512
- id: this.#mastra?.generateId() || (0, crypto$1.randomUUID)(),
35513
- role: "user",
35514
- type: "text",
35515
- createdAt: subAgentPromptCreatedAt,
35516
- threadId: subAgentThreadId,
35517
- resourceId: subAgentResourceId,
35518
- content: {
35519
- format: 2,
35520
- parts: [{
35521
- type: "text",
35522
- text: effectivePrompt
35523
- }]
35524
- }
35525
- }, ...agentResponseMessages];
35529
+ fullSubAgentMessages = [subAgentUserMessage, ...agentResponseMessages];
35526
35530
  const memory = await resolvedAgent.getMemory({ requestContext });
35527
35531
  if (memory) try {
35528
35532
  await memory.createThread({
@@ -35574,14 +35578,7 @@ var Agent = class Agent extends require_base.MastraBase {
35574
35578
  ...effectiveInstructions && { instructions: effectiveInstructions },
35575
35579
  ...effectiveMaxSteps && { maxSteps: effectiveMaxSteps },
35576
35580
  context: filteredContextMessages,
35577
- ...resourceId && threadId && !resolvedHasOwnMemoryConfig ? { memory: {
35578
- resource: subAgentResourceId,
35579
- thread: subAgentThreadId,
35580
- options: {
35581
- lastMessages: false,
35582
- generateTitle: false
35583
- }
35584
- } } : {},
35581
+ ...subAgentMemoryOption,
35585
35582
  ...subAgentAbortOptions,
35586
35583
  disableBackgroundTasks: true
35587
35584
  }) : await resolvedAgent.stream(messagesForSubAgent, {
@@ -35591,14 +35588,7 @@ var Agent = class Agent extends require_base.MastraBase {
35591
35588
  ...effectiveInstructions && { instructions: effectiveInstructions },
35592
35589
  ...effectiveMaxSteps && { maxSteps: effectiveMaxSteps },
35593
35590
  context: filteredContextMessages,
35594
- ...resourceId && threadId && !resolvedHasOwnMemoryConfig ? { memory: {
35595
- resource: subAgentResourceId,
35596
- thread: subAgentThreadId,
35597
- options: {
35598
- lastMessages: false,
35599
- generateTitle: false
35600
- }
35601
- } } : {},
35591
+ ...subAgentMemoryOption,
35602
35592
  ...subAgentAbortOptions,
35603
35593
  disableBackgroundTasks: true
35604
35594
  });
@@ -35633,22 +35623,7 @@ var Agent = class Agent extends require_base.MastraBase {
35633
35623
  args: toolResult.payload.args,
35634
35624
  isError: toolResult.payload.isError
35635
35625
  }));
35636
- const agentResponseMessages = streamResult.messageList.get.response.db();
35637
- fullSubAgentMessages = [{
35638
- id: this.#mastra?.generateId() || (0, crypto$1.randomUUID)(),
35639
- role: "user",
35640
- type: "text",
35641
- createdAt: subAgentPromptCreatedAt,
35642
- threadId: subAgentThreadId,
35643
- resourceId: subAgentResourceId,
35644
- content: {
35645
- format: 2,
35646
- parts: [{
35647
- type: "text",
35648
- text: effectivePrompt
35649
- }]
35650
- }
35651
- }, ...agentResponseMessages];
35626
+ fullSubAgentMessages = [subAgentUserMessage, ...streamResult.messageList.get.response.db()];
35652
35627
  const streamMemory = await resolvedAgent.getMemory({ requestContext });
35653
35628
  if (streamMemory) try {
35654
35629
  await streamMemory.createThread({
@@ -39049,4 +39024,4 @@ Object.defineProperty(exports, "waitForSuspendedSnapshot", {
39049
39024
  }
39050
39025
  });
39051
39026
 
39052
- //# sourceMappingURL=agent-CwUYflGG.cjs.map
39027
+ //# sourceMappingURL=agent-um2LJs-0.cjs.map