@mastra/core 1.23.0-alpha.5 → 1.23.0-alpha.7

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 (149) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/agent/agent.d.ts +13 -0
  3. package/dist/agent/agent.d.ts.map +1 -1
  4. package/dist/agent/index.cjs +8 -8
  5. package/dist/agent/index.js +1 -1
  6. package/dist/agent/workflows/prepare-stream/index.d.ts.map +1 -1
  7. package/dist/agent/workflows/prepare-stream/map-results-step.d.ts +2 -1
  8. package/dist/agent/workflows/prepare-stream/map-results-step.d.ts.map +1 -1
  9. package/dist/browser/index.cjs +2 -2
  10. package/dist/browser/index.js +1 -1
  11. package/dist/channels/index.cjs +4 -4
  12. package/dist/channels/index.js +1 -1
  13. package/dist/{chunk-XFLQVMNH.cjs → chunk-2COMJWSP.cjs} +18 -18
  14. package/dist/{chunk-XFLQVMNH.cjs.map → chunk-2COMJWSP.cjs.map} +1 -1
  15. package/dist/{chunk-I6XSSR4Z.js → chunk-2DOJSEKM.js} +20 -14
  16. package/dist/chunk-2DOJSEKM.js.map +1 -0
  17. package/dist/{chunk-Z63F3XHK.js → chunk-37G434JU.js} +3 -3
  18. package/dist/{chunk-Z63F3XHK.js.map → chunk-37G434JU.js.map} +1 -1
  19. package/dist/{chunk-VO6R5RZT.js → chunk-3PX4NVO4.js} +5 -5
  20. package/dist/{chunk-VO6R5RZT.js.map → chunk-3PX4NVO4.js.map} +1 -1
  21. package/dist/{chunk-QIJFD7ZC.js → chunk-4GR73476.js} +3 -3
  22. package/dist/{chunk-QIJFD7ZC.js.map → chunk-4GR73476.js.map} +1 -1
  23. package/dist/{chunk-QRK2HWHI.js → chunk-7R6CUMCQ.js} +7 -7
  24. package/dist/{chunk-QRK2HWHI.js.map → chunk-7R6CUMCQ.js.map} +1 -1
  25. package/dist/{chunk-TKH2A57J.cjs → chunk-AC4BKIH4.cjs} +185 -185
  26. package/dist/{chunk-TKH2A57J.cjs.map → chunk-AC4BKIH4.cjs.map} +1 -1
  27. package/dist/{chunk-UENWRQLR.cjs → chunk-AESXHP7M.cjs} +5 -5
  28. package/dist/{chunk-UENWRQLR.cjs.map → chunk-AESXHP7M.cjs.map} +1 -1
  29. package/dist/{chunk-YR7XRMDN.cjs → chunk-DUKZTMIA.cjs} +6 -6
  30. package/dist/{chunk-YR7XRMDN.cjs.map → chunk-DUKZTMIA.cjs.map} +1 -1
  31. package/dist/{chunk-HWAEQSOO.js → chunk-EBLC3SZU.js} +10 -10
  32. package/dist/{chunk-HWAEQSOO.js.map → chunk-EBLC3SZU.js.map} +1 -1
  33. package/dist/{chunk-Z34TVGNZ.js → chunk-EC7FJWDQ.js} +4 -4
  34. package/dist/{chunk-Z34TVGNZ.js.map → chunk-EC7FJWDQ.js.map} +1 -1
  35. package/dist/{chunk-ZHYPWNWS.js → chunk-EFX7OKPD.js} +4 -4
  36. package/dist/{chunk-ZHYPWNWS.js.map → chunk-EFX7OKPD.js.map} +1 -1
  37. package/dist/{chunk-QYQSXRFZ.js → chunk-FEUHTHXS.js} +35 -10
  38. package/dist/chunk-FEUHTHXS.js.map +1 -0
  39. package/dist/{chunk-L2MCWEEX.js → chunk-H4DMZG2G.js} +3 -3
  40. package/dist/{chunk-L2MCWEEX.js.map → chunk-H4DMZG2G.js.map} +1 -1
  41. package/dist/{chunk-V7AX2MSJ.cjs → chunk-J2R537Z7.cjs} +32 -26
  42. package/dist/chunk-J2R537Z7.cjs.map +1 -0
  43. package/dist/{chunk-EXORPYDN.js → chunk-JI4PAFKP.js} +3 -3
  44. package/dist/{chunk-EXORPYDN.js.map → chunk-JI4PAFKP.js.map} +1 -1
  45. package/dist/{chunk-JJFGNYVY.cjs → chunk-KYH7NFDR.cjs} +7 -7
  46. package/dist/{chunk-JJFGNYVY.cjs.map → chunk-KYH7NFDR.cjs.map} +1 -1
  47. package/dist/{chunk-JNXWDPCZ.js → chunk-N4QQVYW3.js} +4 -4
  48. package/dist/{chunk-JNXWDPCZ.js.map → chunk-N4QQVYW3.js.map} +1 -1
  49. package/dist/{chunk-XZCYFQ4N.cjs → chunk-OFMVPJGK.cjs} +51 -51
  50. package/dist/{chunk-XZCYFQ4N.cjs.map → chunk-OFMVPJGK.cjs.map} +1 -1
  51. package/dist/{chunk-ZUN5CMDY.cjs → chunk-OROK2RQF.cjs} +84 -84
  52. package/dist/{chunk-ZUN5CMDY.cjs.map → chunk-OROK2RQF.cjs.map} +1 -1
  53. package/dist/{chunk-7DONY7OL.cjs → chunk-R37UG42A.cjs} +3 -3
  54. package/dist/{chunk-7DONY7OL.cjs.map → chunk-R37UG42A.cjs.map} +1 -1
  55. package/dist/{chunk-FSHOQBGF.cjs → chunk-RN6YQCOU.cjs} +9 -9
  56. package/dist/{chunk-FSHOQBGF.cjs.map → chunk-RN6YQCOU.cjs.map} +1 -1
  57. package/dist/{chunk-6UQKQBIB.js → chunk-UKYZDPXL.js} +3 -3
  58. package/dist/{chunk-6UQKQBIB.js.map → chunk-UKYZDPXL.js.map} +1 -1
  59. package/dist/{chunk-7STIIXEL.cjs → chunk-VDZYHVUM.cjs} +3 -3
  60. package/dist/{chunk-7STIIXEL.cjs.map → chunk-VDZYHVUM.cjs.map} +1 -1
  61. package/dist/{chunk-4W26D7S6.cjs → chunk-WTRV3KTS.cjs} +7 -7
  62. package/dist/{chunk-4W26D7S6.cjs.map → chunk-WTRV3KTS.cjs.map} +1 -1
  63. package/dist/{chunk-Z67JQNEH.cjs → chunk-X4JUECE7.cjs} +9 -9
  64. package/dist/{chunk-Z67JQNEH.cjs.map → chunk-X4JUECE7.cjs.map} +1 -1
  65. package/dist/{chunk-DO4JBKMT.cjs → chunk-ZGOY2O3K.cjs} +74 -49
  66. package/dist/chunk-ZGOY2O3K.cjs.map +1 -0
  67. package/dist/{chunk-TG46FM6X.js → chunk-ZZK7VFFA.js} +3 -3
  68. package/dist/{chunk-TG46FM6X.js.map → chunk-ZZK7VFFA.js.map} +1 -1
  69. package/dist/datasets/index.cjs +17 -17
  70. package/dist/datasets/index.js +2 -2
  71. package/dist/docs/SKILL.md +1 -1
  72. package/dist/docs/assets/SOURCE_MAP.json +242 -242
  73. package/dist/evals/index.cjs +5 -5
  74. package/dist/evals/index.js +2 -2
  75. package/dist/evals/scoreTraces/index.cjs +3 -3
  76. package/dist/evals/scoreTraces/index.js +1 -1
  77. package/dist/harness/harness.d.ts +2 -0
  78. package/dist/harness/harness.d.ts.map +1 -1
  79. package/dist/harness/index.cjs +20 -9
  80. package/dist/harness/index.cjs.map +1 -1
  81. package/dist/harness/index.js +17 -6
  82. package/dist/harness/index.js.map +1 -1
  83. package/dist/harness/types.d.ts +8 -0
  84. package/dist/harness/types.d.ts.map +1 -1
  85. package/dist/index.cjs +2 -2
  86. package/dist/index.js +1 -1
  87. package/dist/llm/index.cjs +20 -20
  88. package/dist/llm/index.js +5 -5
  89. package/dist/llm/model/provider-types.generated.d.ts +6 -3
  90. package/dist/loop/index.cjs +14 -14
  91. package/dist/loop/index.js +1 -1
  92. package/dist/mastra/index.cjs +2 -2
  93. package/dist/mastra/index.js +1 -1
  94. package/dist/mastra-GK6QM5DQ.js +3 -0
  95. package/dist/{mastra-O4WWP6N5.js.map → mastra-GK6QM5DQ.js.map} +1 -1
  96. package/dist/mastra-KE4XLMI2.cjs +12 -0
  97. package/dist/{mastra-VHS7LVQG.cjs.map → mastra-KE4XLMI2.cjs.map} +1 -1
  98. package/dist/memory/index.cjs +17 -17
  99. package/dist/memory/index.js +1 -1
  100. package/dist/models-dev-CT6FMRSU.js +3 -0
  101. package/dist/{models-dev-4W7JQVWR.js.map → models-dev-CT6FMRSU.js.map} +1 -1
  102. package/dist/models-dev-UJDAX4F3.cjs +12 -0
  103. package/dist/{models-dev-3IPTEPRM.cjs.map → models-dev-UJDAX4F3.cjs.map} +1 -1
  104. package/dist/netlify-ECN64HAF.js +3 -0
  105. package/dist/{netlify-FZBGNFDI.js.map → netlify-ECN64HAF.js.map} +1 -1
  106. package/dist/netlify-ML4C3IKP.cjs +12 -0
  107. package/dist/{netlify-XT32D45G.cjs.map → netlify-ML4C3IKP.cjs.map} +1 -1
  108. package/dist/processor-provider/index.cjs +10 -10
  109. package/dist/processor-provider/index.js +1 -1
  110. package/dist/processors/index.cjs +44 -44
  111. package/dist/processors/index.js +1 -1
  112. package/dist/provider-registry-6FR6AKYW.js +3 -0
  113. package/dist/{provider-registry-AWL2JDVF.js.map → provider-registry-6FR6AKYW.js.map} +1 -1
  114. package/dist/provider-registry-DRMNUKIF.cjs +40 -0
  115. package/dist/{provider-registry-X5PBSJ2G.cjs.map → provider-registry-DRMNUKIF.cjs.map} +1 -1
  116. package/dist/provider-registry.json +12 -6
  117. package/dist/relevance/index.cjs +3 -3
  118. package/dist/relevance/index.js +1 -1
  119. package/dist/storage/index.cjs +74 -74
  120. package/dist/storage/index.js +1 -1
  121. package/dist/stream/index.cjs +8 -8
  122. package/dist/stream/index.js +1 -1
  123. package/dist/test-utils/llm-mock.cjs +4 -4
  124. package/dist/test-utils/llm-mock.js +1 -1
  125. package/dist/tool-loop-agent/index.cjs +4 -4
  126. package/dist/tool-loop-agent/index.js +1 -1
  127. package/dist/utils.cjs +25 -25
  128. package/dist/utils.js +1 -1
  129. package/dist/vector/index.cjs +7 -7
  130. package/dist/vector/index.js +1 -1
  131. package/dist/workflows/evented/index.cjs +10 -10
  132. package/dist/workflows/evented/index.js +1 -1
  133. package/dist/workflows/handlers/entry.d.ts.map +1 -1
  134. package/dist/workflows/index.cjs +24 -24
  135. package/dist/workflows/index.js +1 -1
  136. package/package.json +4 -4
  137. package/src/llm/model/provider-types.generated.d.ts +6 -3
  138. package/dist/chunk-DO4JBKMT.cjs.map +0 -1
  139. package/dist/chunk-I6XSSR4Z.js.map +0 -1
  140. package/dist/chunk-QYQSXRFZ.js.map +0 -1
  141. package/dist/chunk-V7AX2MSJ.cjs.map +0 -1
  142. package/dist/mastra-O4WWP6N5.js +0 -3
  143. package/dist/mastra-VHS7LVQG.cjs +0 -12
  144. package/dist/models-dev-3IPTEPRM.cjs +0 -12
  145. package/dist/models-dev-4W7JQVWR.js +0 -3
  146. package/dist/netlify-FZBGNFDI.js +0 -3
  147. package/dist/netlify-XT32D45G.cjs +0 -12
  148. package/dist/provider-registry-AWL2JDVF.js +0 -3
  149. package/dist/provider-registry-X5PBSJ2G.cjs +0 -40
@@ -1,22 +1,22 @@
1
1
  'use strict';
2
2
 
3
+ var chunkZCBG4ZQT_cjs = require('./chunk-ZCBG4ZQT.cjs');
3
4
  var chunkX6CDTXAM_cjs = require('./chunk-X6CDTXAM.cjs');
4
5
  var chunkRAD2NM47_cjs = require('./chunk-RAD2NM47.cjs');
5
- var chunkZCBG4ZQT_cjs = require('./chunk-ZCBG4ZQT.cjs');
6
- var chunkFSHOQBGF_cjs = require('./chunk-FSHOQBGF.cjs');
6
+ var chunkRN6YQCOU_cjs = require('./chunk-RN6YQCOU.cjs');
7
7
  var chunkWAPY5X7M_cjs = require('./chunk-WAPY5X7M.cjs');
8
8
  var chunkY3APFUXZ_cjs = require('./chunk-Y3APFUXZ.cjs');
9
9
  var chunkCFMZZDO2_cjs = require('./chunk-CFMZZDO2.cjs');
10
- var chunkDAQ4JZQA_cjs = require('./chunk-DAQ4JZQA.cjs');
11
10
  var chunkOQDRPRKM_cjs = require('./chunk-OQDRPRKM.cjs');
12
11
  var chunkMR7ZWBL6_cjs = require('./chunk-MR7ZWBL6.cjs');
13
- var chunkZUN5CMDY_cjs = require('./chunk-ZUN5CMDY.cjs');
14
- var chunk4W26D7S6_cjs = require('./chunk-4W26D7S6.cjs');
15
- var chunk7DONY7OL_cjs = require('./chunk-7DONY7OL.cjs');
12
+ var chunkOROK2RQF_cjs = require('./chunk-OROK2RQF.cjs');
13
+ var chunkWTRV3KTS_cjs = require('./chunk-WTRV3KTS.cjs');
14
+ var chunkDAQ4JZQA_cjs = require('./chunk-DAQ4JZQA.cjs');
15
+ var chunkR37UG42A_cjs = require('./chunk-R37UG42A.cjs');
16
+ var chunkB4OOPFD3_cjs = require('./chunk-B4OOPFD3.cjs');
16
17
  var chunkKJBMTK5B_cjs = require('./chunk-KJBMTK5B.cjs');
17
18
  var chunkLDLHW3QN_cjs = require('./chunk-LDLHW3QN.cjs');
18
19
  var chunkXB4FLS7A_cjs = require('./chunk-XB4FLS7A.cjs');
19
- var chunkB4OOPFD3_cjs = require('./chunk-B4OOPFD3.cjs');
20
20
  var chunk47RKHZIP_cjs = require('./chunk-47RKHZIP.cjs');
21
21
  var chunk5WBEMKE2_cjs = require('./chunk-5WBEMKE2.cjs');
22
22
  var chunk4U7ZLI36_cjs = require('./chunk-4U7ZLI36.cjs');
@@ -2078,7 +2078,7 @@ var ProcessorRunner = class _ProcessorRunner {
2078
2078
  }
2079
2079
  const { model: _model, ...rest } = result;
2080
2080
  if (result.model) {
2081
- const resolvedModel = await chunkZUN5CMDY_cjs.resolveModelConfig(result.model);
2081
+ const resolvedModel = await chunkOROK2RQF_cjs.resolveModelConfig(result.model);
2082
2082
  const isSupported = isSupportedLanguageModel(resolvedModel);
2083
2083
  if (!isSupported) {
2084
2084
  throw new chunk4U7ZLI36_cjs.MastraError({
@@ -6799,7 +6799,7 @@ var createTimeTravelExecutionParams = (params) => {
6799
6799
  result = void 0;
6800
6800
  }
6801
6801
  if (result) {
6802
- const formattedResult = chunk7DONY7OL_cjs.removeUndefinedValues(result);
6802
+ const formattedResult = chunkR37UG42A_cjs.removeUndefinedValues(result);
6803
6803
  stepResults[stepId] = formattedResult;
6804
6804
  }
6805
6805
  });
@@ -7357,7 +7357,7 @@ async function executeLoop(engine, params) {
7357
7357
  options: {
7358
7358
  type: "workflow_conditional_eval" /* WORKFLOW_CONDITIONAL_EVAL */,
7359
7359
  name: `condition: '${entry.loopType}'`,
7360
- input: chunk7DONY7OL_cjs.selectFields(result.output, ["stepResult", "output.text", "output.object", "messages"]),
7360
+ input: chunkR37UG42A_cjs.selectFields(result.output, ["stepResult", "output.text", "output.object", "messages"]),
7361
7361
  attributes: {
7362
7362
  conditionIndex: iteration
7363
7363
  },
@@ -7887,6 +7887,7 @@ async function executeEntry(engine, params) {
7887
7887
  execResults = await engine.executeParallel({
7888
7888
  workflowId,
7889
7889
  runId,
7890
+ resourceId,
7890
7891
  entry,
7891
7892
  prevStep,
7892
7893
  stepResults,
@@ -7982,6 +7983,7 @@ async function executeEntry(engine, params) {
7982
7983
  execResults = await engine.executeConditional({
7983
7984
  workflowId,
7984
7985
  runId,
7986
+ resourceId,
7985
7987
  entry,
7986
7988
  prevOutput,
7987
7989
  stepResults,
@@ -8002,6 +8004,7 @@ async function executeEntry(engine, params) {
8002
8004
  execResults = await engine.executeLoop({
8003
8005
  workflowId,
8004
8006
  runId,
8007
+ resourceId,
8005
8008
  entry,
8006
8009
  prevStep,
8007
8010
  prevOutput,
@@ -8023,6 +8026,7 @@ async function executeEntry(engine, params) {
8023
8026
  execResults = await engine.executeForeach({
8024
8027
  workflowId,
8025
8028
  runId,
8029
+ resourceId,
8026
8030
  entry,
8027
8031
  prevStep,
8028
8032
  prevOutput,
@@ -12813,7 +12817,7 @@ var MastraScorer = class _MastraScorer {
12813
12817
  }
12814
12818
  });
12815
12819
  }
12816
- const resolvedModel = await chunkZUN5CMDY_cjs.resolveModelConfig(modelConfig, void 0, this.#mastra);
12820
+ const resolvedModel = await chunkOROK2RQF_cjs.resolveModelConfig(modelConfig, void 0, this.#mastra);
12817
12821
  const judgeModel = resolvedModel.modelId;
12818
12822
  const judge = new Agent({
12819
12823
  id: "judge",
@@ -13044,7 +13048,7 @@ async function runDefaultCompletionCheck(agent, context, streamContext, abortSig
13044
13048
  Primitives already executed: ${completedPrimitives.join(", ")}` : "";
13045
13049
  const completionPrompt = `
13046
13050
  The ${context.selectedPrimitive.type} ${context.selectedPrimitive.id} has contributed to the task.
13047
- This is the result: ${chunk7DONY7OL_cjs.safeStringify(context.primitiveResult)}
13051
+ This is the result: ${chunkR37UG42A_cjs.safeStringify(context.primitiveResult)}
13048
13052
 
13049
13053
  ${completedSection}
13050
13054
 
@@ -13140,7 +13144,7 @@ async function generateFinalResult(agent, context, streamContext, abortSignal, o
13140
13144
  Original task: ${context.originalTask}
13141
13145
 
13142
13146
  The ${context.selectedPrimitive.type} ${context.selectedPrimitive.id} produced this result:
13143
- ${chunk7DONY7OL_cjs.safeStringify(context.primitiveResult)}
13147
+ ${chunkR37UG42A_cjs.safeStringify(context.primitiveResult)}
13144
13148
 
13145
13149
  IMPORTANT: If the above result is from an AGENT PRIMITIVE and it is a suitable final result itself considering the original task, then finalResult should be an empty string or undefined.
13146
13150
  You should evaluate if the above result is comprehensive enough to accomplish the user's original task.
@@ -13198,7 +13202,7 @@ async function generateStructuredFinalResult(agent, context, structuredOutputOpt
13198
13202
  Original task: ${context.originalTask}
13199
13203
 
13200
13204
  The ${context.selectedPrimitive.type} ${context.selectedPrimitive.id} produced this result:
13201
- ${chunk7DONY7OL_cjs.safeStringify(context.primitiveResult)}
13205
+ ${chunkR37UG42A_cjs.safeStringify(context.primitiveResult)}
13202
13206
 
13203
13207
  Based on the task and result above, generate a structured response according to the provided schema.
13204
13208
  Use the conversation history and primitive results to craft the response.
@@ -14299,7 +14303,7 @@ function createLLMExecutionStep({
14299
14303
  const convertedTools = {};
14300
14304
  for (const [name, tool2] of Object.entries(currentStep.tools)) {
14301
14305
  if (chunkLDLHW3QN_cjs.isMastraTool(tool2)) {
14302
- convertedTools[name] = chunk7DONY7OL_cjs.makeCoreTool(
14306
+ convertedTools[name] = chunkR37UG42A_cjs.makeCoreTool(
14303
14307
  tool2,
14304
14308
  {
14305
14309
  name,
@@ -14521,7 +14525,7 @@ Analyse the suspended tools: ${JSON.stringify(suspendedTools)}, using the messag
14521
14525
  }
14522
14526
  });
14523
14527
  let transportResolver;
14524
- if (currentStep.model instanceof chunkZUN5CMDY_cjs.ModelRouterLanguageModel) {
14528
+ if (currentStep.model instanceof chunkOROK2RQF_cjs.ModelRouterLanguageModel) {
14525
14529
  const routerModel = currentStep.model;
14526
14530
  transportResolver = () => routerModel._getStreamTransport();
14527
14531
  }
@@ -15420,7 +15424,7 @@ function createToolCallStep({
15420
15424
  }
15421
15425
  }
15422
15426
  const rawResult = await tool2.execute(args, toolOptions);
15423
- const result = chunk7DONY7OL_cjs.ensureSerializable(rawResult);
15427
+ const result = chunkR37UG42A_cjs.ensureSerializable(rawResult);
15424
15428
  if (tool2 && "onOutput" in tool2 && typeof tool2.onOutput === "function") {
15425
15429
  try {
15426
15430
  await tool2.onOutput({
@@ -16280,7 +16284,7 @@ var MastraLLMVNext = class extends chunkFCQNDFEW_cjs.MastraBase {
16280
16284
  const remainingTokens = parseInt(props?.response?.headers?.["x-ratelimit-remaining-tokens"] ?? "", 10);
16281
16285
  if (!isNaN(remainingTokens) && remainingTokens > 0 && remainingTokens < 2e3) {
16282
16286
  this.logger.warn("Rate limit approaching, waiting 10 seconds", { runId });
16283
- await chunk7DONY7OL_cjs.delay(10 * 1e3);
16287
+ await chunkR37UG42A_cjs.delay(10 * 1e3);
16284
16288
  }
16285
16289
  },
16286
16290
  onFinish: async (props) => {
@@ -19778,6 +19782,7 @@ function createMapResultsStep({
19778
19782
  capabilities,
19779
19783
  options,
19780
19784
  resourceId,
19785
+ threadId: threadIdFromArgs,
19781
19786
  runId,
19782
19787
  requestContext,
19783
19788
  memory,
@@ -19796,7 +19801,7 @@ function createMapResultsStep({
19796
19801
  tools: toolsData.convertedTools,
19797
19802
  toolChoice: options.toolChoice,
19798
19803
  thread: memoryData.thread,
19799
- threadId: memoryData.thread?.id,
19804
+ threadId: memoryData.thread?.id ?? threadIdFromArgs,
19800
19805
  resourceId,
19801
19806
  requestContext,
19802
19807
  onStepFinish: async (props) => {
@@ -20333,6 +20338,7 @@ function createPrepareStreamWorkflow({
20333
20338
  capabilities,
20334
20339
  options,
20335
20340
  resourceId,
20341
+ threadId: threadFromArgs?.id,
20336
20342
  runId,
20337
20343
  requestContext,
20338
20344
  memory,
@@ -20544,6 +20550,23 @@ var Agent = class extends chunkFCQNDFEW_cjs.MastraBase {
20544
20550
  get browser() {
20545
20551
  return this.#browser;
20546
20552
  }
20553
+ /**
20554
+ * Sets or updates the browser instance for this agent.
20555
+ * This allows hot-swapping browser configuration without recreating the agent.
20556
+ * Browser tools will be automatically updated on the next execution.
20557
+ *
20558
+ * @param browser - The new browser instance, or undefined to disable browser tools
20559
+ */
20560
+ setBrowser(browser) {
20561
+ this.#browser = browser;
20562
+ }
20563
+ /**
20564
+ * Returns true if this agent was configured with its own browser instance.
20565
+ * Used by Harness to avoid overwriting agent-level browser configuration.
20566
+ */
20567
+ hasOwnBrowser() {
20568
+ return Boolean(this.#browser);
20569
+ }
20547
20570
  /**
20548
20571
  * Gets the skills processors to add to input processors when workspace has skills.
20549
20572
  * @internal
@@ -21350,7 +21373,7 @@ ${errorMessages}`,
21350
21373
  */
21351
21374
  listTools({ requestContext = new chunk5WBEMKE2_cjs.RequestContext() } = {}) {
21352
21375
  if (typeof this.#tools !== "function") {
21353
- return chunk7DONY7OL_cjs.ensureToolProperties(this.#tools);
21376
+ return chunkR37UG42A_cjs.ensureToolProperties(this.#tools);
21354
21377
  }
21355
21378
  const result = this.#tools({
21356
21379
  requestContext,
@@ -21370,7 +21393,7 @@ ${errorMessages}`,
21370
21393
  this.logger.trackException(mastraError);
21371
21394
  throw mastraError;
21372
21395
  }
21373
- return chunk7DONY7OL_cjs.ensureToolProperties(tools);
21396
+ return chunkR37UG42A_cjs.ensureToolProperties(tools);
21374
21397
  });
21375
21398
  }
21376
21399
  /**
@@ -21418,7 +21441,7 @@ ${errorMessages}`,
21418
21441
  });
21419
21442
  });
21420
21443
  } else {
21421
- llm = new chunk4W26D7S6_cjs.MastraLLMV1({
21444
+ llm = new chunkWTRV3KTS_cjs.MastraLLMV1({
21422
21445
  model: modelInfo,
21423
21446
  mastra: this.#mastra,
21424
21447
  options: { tracingPolicy: this.#options?.tracingPolicy }
@@ -21444,7 +21467,7 @@ ${errorMessages}`,
21444
21467
  */
21445
21468
  async resolveModelConfig(modelConfig, requestContext) {
21446
21469
  try {
21447
- return await chunkZUN5CMDY_cjs.resolveModelConfig(modelConfig, requestContext, this.#mastra);
21470
+ return await chunkOROK2RQF_cjs.resolveModelConfig(modelConfig, requestContext, this.#mastra);
21448
21471
  } catch (error) {
21449
21472
  const mastraError = new chunk4U7ZLI36_cjs.MastraError({
21450
21473
  id: "AGENT_GET_MODEL_MISSING_MODEL_INSTANCE",
@@ -21916,7 +21939,7 @@ ${errorMessages}`,
21916
21939
  tracingPolicy: this.#options?.tracingPolicy,
21917
21940
  requireApproval: toolObj.requireApproval
21918
21941
  };
21919
- const convertedToCoreTool = chunk7DONY7OL_cjs.makeCoreTool(toolObj, options, void 0, autoResumeSuspendedTools);
21942
+ const convertedToCoreTool = chunkR37UG42A_cjs.makeCoreTool(toolObj, options, void 0, autoResumeSuspendedTools);
21920
21943
  convertedMemoryTools[toolName] = convertedToCoreTool;
21921
21944
  }
21922
21945
  }
@@ -21969,7 +21992,7 @@ ${errorMessages}`,
21969
21992
  requireApproval: toolObj.requireApproval,
21970
21993
  workspace
21971
21994
  };
21972
- const convertedToCoreTool = chunk7DONY7OL_cjs.makeCoreTool(toolObj, options, void 0, autoResumeSuspendedTools);
21995
+ const convertedToCoreTool = chunkR37UG42A_cjs.makeCoreTool(toolObj, options, void 0, autoResumeSuspendedTools);
21973
21996
  convertedWorkspaceTools[toolName] = convertedToCoreTool;
21974
21997
  }
21975
21998
  }
@@ -22010,7 +22033,7 @@ ${errorMessages}`,
22010
22033
  ...observabilityContext,
22011
22034
  tracingPolicy: this.#options?.tracingPolicy
22012
22035
  };
22013
- convertedChannelTools[toolName] = chunk7DONY7OL_cjs.makeCoreTool(
22036
+ convertedChannelTools[toolName] = chunkR37UG42A_cjs.makeCoreTool(
22014
22037
  tool2,
22015
22038
  options,
22016
22039
  void 0,
@@ -22067,7 +22090,7 @@ ${errorMessages}`,
22067
22090
  // Skill tools never require approval
22068
22091
  workspace
22069
22092
  };
22070
- const convertedToCoreTool = chunk7DONY7OL_cjs.makeCoreTool(toolObj, options, void 0, autoResumeSuspendedTools);
22093
+ const convertedToCoreTool = chunkR37UG42A_cjs.makeCoreTool(toolObj, options, void 0, autoResumeSuspendedTools);
22071
22094
  convertedSkillTools[toolName] = convertedToCoreTool;
22072
22095
  }
22073
22096
  }
@@ -22115,7 +22138,7 @@ ${errorMessages}`,
22115
22138
  tracingPolicy: this.#options?.tracingPolicy,
22116
22139
  requireApproval: toolObj.requireApproval
22117
22140
  };
22118
- const convertedToCoreTool = chunk7DONY7OL_cjs.makeCoreTool(toolObj, options, void 0, autoResumeSuspendedTools);
22141
+ const convertedToCoreTool = chunkR37UG42A_cjs.makeCoreTool(toolObj, options, void 0, autoResumeSuspendedTools);
22119
22142
  convertedBrowserTools[toolName] = convertedToCoreTool;
22120
22143
  }
22121
22144
  }
@@ -22348,7 +22371,7 @@ ${errorMessages}`,
22348
22371
  tracingPolicy: this.#options?.tracingPolicy,
22349
22372
  requireApproval: tool2.requireApproval
22350
22373
  };
22351
- return [k, chunk7DONY7OL_cjs.makeCoreTool(tool2, options, void 0, autoResumeSuspendedTools)];
22374
+ return [k, chunkR37UG42A_cjs.makeCoreTool(tool2, options, void 0, autoResumeSuspendedTools)];
22352
22375
  })
22353
22376
  );
22354
22377
  const assignedToolEntriesConverted = Object.fromEntries(
@@ -22402,7 +22425,7 @@ ${errorMessages}`,
22402
22425
  tracingPolicy: this.#options?.tracingPolicy,
22403
22426
  requireApproval: toolObj.requireApproval
22404
22427
  };
22405
- const convertedToCoreTool = chunk7DONY7OL_cjs.makeCoreTool(toolObj, options, "toolset", autoResumeSuspendedTools);
22428
+ const convertedToCoreTool = chunkR37UG42A_cjs.makeCoreTool(toolObj, options, "toolset", autoResumeSuspendedTools);
22406
22429
  toolsForRequest[toolName] = convertedToCoreTool;
22407
22430
  }
22408
22431
  }
@@ -22447,7 +22470,7 @@ ${errorMessages}`,
22447
22470
  tracingPolicy: this.#options?.tracingPolicy,
22448
22471
  requireApproval: tool2.requireApproval
22449
22472
  };
22450
- const convertedToCoreTool = chunk7DONY7OL_cjs.makeCoreTool(toolRest, options, "client-tool", autoResumeSuspendedTools);
22473
+ const convertedToCoreTool = chunkR37UG42A_cjs.makeCoreTool(toolRest, options, "client-tool", autoResumeSuspendedTools);
22451
22474
  toolsForRequest[toolName] = convertedToCoreTool;
22452
22475
  }
22453
22476
  }
@@ -23167,7 +23190,7 @@ ${effectiveInstructions}`;
23167
23190
  ...observabilityContext,
23168
23191
  tracingPolicy: this.#options?.tracingPolicy
23169
23192
  };
23170
- convertedAgentTools[`agent-${agentName}`] = chunk7DONY7OL_cjs.makeCoreTool(
23193
+ convertedAgentTools[`agent-${agentName}`] = chunkR37UG42A_cjs.makeCoreTool(
23171
23194
  toolObj,
23172
23195
  options,
23173
23196
  void 0,
@@ -23388,7 +23411,7 @@ ${effectiveInstructions}`;
23388
23411
  ...observabilityContext,
23389
23412
  tracingPolicy: this.#options?.tracingPolicy
23390
23413
  };
23391
- convertedWorkflowTools[`workflow-${workflowName}`] = chunk7DONY7OL_cjs.makeCoreTool(
23414
+ convertedWorkflowTools[`workflow-${workflowName}`] = chunkR37UG42A_cjs.makeCoreTool(
23392
23415
  toolObj,
23393
23416
  options,
23394
23417
  void 0,
@@ -23420,7 +23443,7 @@ ${effectiveInstructions}`;
23420
23443
  let mastraProxy = void 0;
23421
23444
  const logger = this.logger;
23422
23445
  if (this.#mastra) {
23423
- mastraProxy = chunk7DONY7OL_cjs.createMastraProxy({ mastra: this.#mastra, logger });
23446
+ mastraProxy = chunkR37UG42A_cjs.createMastraProxy({ mastra: this.#mastra, logger });
23424
23447
  }
23425
23448
  const assignedTools = await this.listAssignedTools({
23426
23449
  runId,
@@ -23691,7 +23714,7 @@ ${effectiveInstructions}`;
23691
23714
  const resolvedModel = await this.resolveModelConfig(selection, requestContext);
23692
23715
  this.assertSupportsPreparedModels(resolvedModel);
23693
23716
  let headers;
23694
- if (resolvedModel instanceof chunkZUN5CMDY_cjs.ModelRouterLanguageModel) {
23717
+ if (resolvedModel instanceof chunkOROK2RQF_cjs.ModelRouterLanguageModel) {
23695
23718
  headers = resolvedModel.config?.headers;
23696
23719
  }
23697
23720
  return [
@@ -23723,7 +23746,7 @@ ${effectiveInstructions}`;
23723
23746
  throw mastraError;
23724
23747
  }
23725
23748
  let headers;
23726
- if (model instanceof chunkZUN5CMDY_cjs.ModelRouterLanguageModel) {
23749
+ if (model instanceof chunkOROK2RQF_cjs.ModelRouterLanguageModel) {
23727
23750
  headers = model.config?.headers;
23728
23751
  }
23729
23752
  return {
@@ -23784,7 +23807,7 @@ ${effectiveInstructions}`;
23784
23807
  model: options.model
23785
23808
  });
23786
23809
  const resolvedModel = llm.getModel();
23787
- const isGatewayModel = resolvedModel instanceof chunkZUN5CMDY_cjs.ModelRouterLanguageModel && resolvedModel.gatewayId === "mastra";
23810
+ const isGatewayModel = resolvedModel instanceof chunkOROK2RQF_cjs.ModelRouterLanguageModel && resolvedModel.gatewayId === "mastra";
23788
23811
  if (resourceId && threadFromArgs && !this.hasOwnMemory() && !isGatewayModel) {
23789
23812
  this.logger.warn("No memory is configured but resourceId and threadId were passed in args", { agent: this.name });
23790
23813
  }
@@ -24029,6 +24052,8 @@ ${effectiveInstructions}`;
24029
24052
  requestContext,
24030
24053
  structuredOutput,
24031
24054
  overrideScorers,
24055
+ threadId,
24056
+ resourceId,
24032
24057
  ...observabilityContext
24033
24058
  });
24034
24059
  agentSpan?.end({
@@ -24195,7 +24220,7 @@ ${effectiveInstructions}`;
24195
24220
  const defaultOptions = await this.getDefaultOptions({
24196
24221
  requestContext: options?.requestContext
24197
24222
  });
24198
- const mergedOptions = chunk7DONY7OL_cjs.deepMerge(
24223
+ const mergedOptions = chunkR37UG42A_cjs.deepMerge(
24199
24224
  defaultOptions,
24200
24225
  options ?? {}
24201
24226
  );
@@ -24266,7 +24291,7 @@ ${effectiveInstructions}`;
24266
24291
  const defaultOptions = await this.getDefaultOptions({
24267
24292
  requestContext: streamOptions?.requestContext
24268
24293
  });
24269
- const mergedOptions = chunk7DONY7OL_cjs.deepMerge(
24294
+ const mergedOptions = chunkR37UG42A_cjs.deepMerge(
24270
24295
  defaultOptions,
24271
24296
  streamOptions ?? {}
24272
24297
  );
@@ -24331,7 +24356,7 @@ ${effectiveInstructions}`;
24331
24356
  const defaultOptions = await this.getDefaultOptions({
24332
24357
  requestContext: streamOptions?.requestContext
24333
24358
  });
24334
- let mergedStreamOptions = chunk7DONY7OL_cjs.deepMerge(
24359
+ let mergedStreamOptions = chunkR37UG42A_cjs.deepMerge(
24335
24360
  defaultOptions,
24336
24361
  streamOptions ?? {}
24337
24362
  );
@@ -24397,7 +24422,7 @@ ${effectiveInstructions}`;
24397
24422
  const defaultOptions = await this.getDefaultOptions({
24398
24423
  requestContext: options?.requestContext
24399
24424
  });
24400
- const mergedOptions = chunk7DONY7OL_cjs.deepMerge(
24425
+ const mergedOptions = chunkR37UG42A_cjs.deepMerge(
24401
24426
  defaultOptions,
24402
24427
  options ?? {}
24403
24428
  );
@@ -27740,7 +27765,7 @@ var WorkingMemory = class {
27740
27765
  return messageList;
27741
27766
  }
27742
27767
  generateEmptyFromSchemaInternal(schema) {
27743
- const result = chunk7DONY7OL_cjs.generateEmptyFromSchema(schema);
27768
+ const result = chunkR37UG42A_cjs.generateEmptyFromSchema(schema);
27744
27769
  return Object.keys(result).length > 0 ? result : null;
27745
27770
  }
27746
27771
  getWorkingMemoryToolInstruction({
@@ -28385,7 +28410,7 @@ https://mastra.ai/en/docs/memory/semantic-recall`
28385
28410
  );
28386
28411
  }
28387
28412
  if (typeof config.embedder === "string") {
28388
- this.embedder = new chunkZUN5CMDY_cjs.ModelRouterEmbeddingModel(config.embedder);
28413
+ this.embedder = new chunkOROK2RQF_cjs.ModelRouterEmbeddingModel(config.embedder);
28389
28414
  } else {
28390
28415
  this.embedder = config.embedder;
28391
28416
  }
@@ -28398,7 +28423,7 @@ https://mastra.ai/en/docs/memory/semantic-recall`
28398
28423
  }
28399
28424
  if (config.embedder) {
28400
28425
  if (typeof config.embedder === "string") {
28401
- this.embedder = new chunkZUN5CMDY_cjs.ModelRouterEmbeddingModel(config.embedder);
28426
+ this.embedder = new chunkOROK2RQF_cjs.ModelRouterEmbeddingModel(config.embedder);
28402
28427
  } else {
28403
28428
  this.embedder = config.embedder;
28404
28429
  }
@@ -28438,7 +28463,7 @@ https://mastra.ai/en/docs/memory/overview`
28438
28463
  }
28439
28464
  setEmbedder(embedder, embedderOptions) {
28440
28465
  if (typeof embedder === "string") {
28441
- this.embedder = new chunkZUN5CMDY_cjs.ModelRouterEmbeddingModel(embedder);
28466
+ this.embedder = new chunkOROK2RQF_cjs.ModelRouterEmbeddingModel(embedder);
28442
28467
  } else {
28443
28468
  this.embedder = embedder;
28444
28469
  }
@@ -28535,7 +28560,7 @@ https://mastra.ai/en/docs/memory/overview`
28535
28560
  "The threads.generateTitle option has been moved. Use the top-level generateTitle option instead."
28536
28561
  );
28537
28562
  }
28538
- const mergedConfig = chunk7DONY7OL_cjs.deepMerge(this.threadConfig, config || {});
28563
+ const mergedConfig = chunkR37UG42A_cjs.deepMerge(this.threadConfig, config || {});
28539
28564
  if (typeof config?.workingMemory === "object" && config.workingMemory?.schema && typeof mergedConfig.workingMemory === "object") {
28540
28565
  mergedConfig.workingMemory.schema = config.workingMemory.schema;
28541
28566
  }
@@ -28887,7 +28912,7 @@ var MockMemory = class extends MastraMemory {
28887
28912
  } = {}) {
28888
28913
  super({
28889
28914
  name: "mock",
28890
- storage: storage || new chunkFSHOQBGF_cjs.InMemoryStore(),
28915
+ storage: storage || new chunkRN6YQCOU_cjs.InMemoryStore(),
28891
28916
  options: {
28892
28917
  ...options,
28893
28918
  workingMemory: enableWorkingMemory ? { enabled: true, template: workingMemoryTemplate } : options?.workingMemory,
@@ -29204,5 +29229,5 @@ exports.validateStepRequestContext = validateStepRequestContext;
29204
29229
  exports.validateStepResumeData = validateStepResumeData;
29205
29230
  exports.validateStepStateData = validateStepStateData;
29206
29231
  exports.validateStepSuspendData = validateStepSuspendData;
29207
- //# sourceMappingURL=chunk-DO4JBKMT.cjs.map
29208
- //# sourceMappingURL=chunk-DO4JBKMT.cjs.map
29232
+ //# sourceMappingURL=chunk-ZGOY2O3K.cjs.map
29233
+ //# sourceMappingURL=chunk-ZGOY2O3K.cjs.map