@mastra/core 1.18.0-alpha.0 → 1.18.0-alpha.1

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 (147) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/dist/agent/index.cjs +8 -8
  3. package/dist/agent/index.js +1 -1
  4. package/dist/{chunk-3ECYXW43.cjs → chunk-2U4M4SGY.cjs} +16 -16
  5. package/dist/{chunk-3ECYXW43.cjs.map → chunk-2U4M4SGY.cjs.map} +1 -1
  6. package/dist/{chunk-JEEYINIB.js → chunk-3NMSFQPY.js} +4 -4
  7. package/dist/{chunk-JEEYINIB.js.map → chunk-3NMSFQPY.js.map} +1 -1
  8. package/dist/{chunk-7CDFI4GW.cjs → chunk-3O73Q6M2.cjs} +76 -76
  9. package/dist/{chunk-7CDFI4GW.cjs.map → chunk-3O73Q6M2.cjs.map} +1 -1
  10. package/dist/{chunk-ZOPIN73X.js → chunk-3U4ZNZIF.js} +4 -4
  11. package/dist/{chunk-ZOPIN73X.js.map → chunk-3U4ZNZIF.js.map} +1 -1
  12. package/dist/{chunk-QVQ3PGG2.cjs → chunk-7IDACSBM.cjs} +206 -2
  13. package/dist/chunk-7IDACSBM.cjs.map +1 -0
  14. package/dist/{chunk-YFYB3Q5L.js → chunk-A2Z26HFR.js} +9 -9
  15. package/dist/{chunk-YFYB3Q5L.js.map → chunk-A2Z26HFR.js.map} +1 -1
  16. package/dist/{chunk-AIYWGXK7.js → chunk-BYJDWJCX.js} +3 -3
  17. package/dist/{chunk-AIYWGXK7.js.map → chunk-BYJDWJCX.js.map} +1 -1
  18. package/dist/{chunk-F7YLMJSQ.js → chunk-D4DCPE5Y.js} +4 -4
  19. package/dist/{chunk-F7YLMJSQ.js.map → chunk-D4DCPE5Y.js.map} +1 -1
  20. package/dist/{chunk-CYQ2TNSK.js → chunk-EYM6DWKD.js} +18 -3
  21. package/dist/{chunk-CYQ2TNSK.js.map → chunk-EYM6DWKD.js.map} +1 -1
  22. package/dist/{chunk-3LH5QX5F.cjs → chunk-G62XEVSI.cjs} +3 -3
  23. package/dist/{chunk-3LH5QX5F.cjs.map → chunk-G62XEVSI.cjs.map} +1 -1
  24. package/dist/{chunk-BHVF4Z5D.cjs → chunk-GFBH7Q4W.cjs} +13 -13
  25. package/dist/{chunk-BHVF4Z5D.cjs.map → chunk-GFBH7Q4W.cjs.map} +1 -1
  26. package/dist/{chunk-3DDJ33AU.js → chunk-HEHK7LXS.js} +4 -4
  27. package/dist/{chunk-3DDJ33AU.js.map → chunk-HEHK7LXS.js.map} +1 -1
  28. package/dist/{chunk-TG4U3K3I.cjs → chunk-JFPVUKPB.cjs} +50 -50
  29. package/dist/{chunk-TG4U3K3I.cjs.map → chunk-JFPVUKPB.cjs.map} +1 -1
  30. package/dist/{chunk-AIEKKCJ7.js → chunk-K22Q6XPG.js} +3 -3
  31. package/dist/{chunk-AIEKKCJ7.js.map → chunk-K22Q6XPG.js.map} +1 -1
  32. package/dist/{chunk-V54LY5HR.cjs → chunk-KL2IRBNK.cjs} +6107 -5697
  33. package/dist/chunk-KL2IRBNK.cjs.map +1 -0
  34. package/dist/{chunk-DV7FIKOO.cjs → chunk-MSDZQ4DW.cjs} +10 -10
  35. package/dist/{chunk-DV7FIKOO.cjs.map → chunk-MSDZQ4DW.cjs.map} +1 -1
  36. package/dist/{chunk-3H34KWBU.cjs → chunk-PK3X5KIF.cjs} +24 -9
  37. package/dist/{chunk-3H34KWBU.cjs.map → chunk-PK3X5KIF.cjs.map} +1 -1
  38. package/dist/{chunk-SLG7AUBK.cjs → chunk-PQWEJELD.cjs} +6 -6
  39. package/dist/{chunk-SLG7AUBK.cjs.map → chunk-PQWEJELD.cjs.map} +1 -1
  40. package/dist/{chunk-P2C4NFMY.js → chunk-RB2QRGRV.js} +4 -4
  41. package/dist/{chunk-P2C4NFMY.js.map → chunk-RB2QRGRV.js.map} +1 -1
  42. package/dist/{chunk-BIB2LCIR.js → chunk-TKKBZUWD.js} +6106 -5696
  43. package/dist/chunk-TKKBZUWD.js.map +1 -0
  44. package/dist/{chunk-AEIPJW4F.cjs → chunk-UEZU2TA2.cjs} +185 -185
  45. package/dist/{chunk-AEIPJW4F.cjs.map → chunk-UEZU2TA2.cjs.map} +1 -1
  46. package/dist/{chunk-DL4A7URO.cjs → chunk-UPCNNWXW.cjs} +236 -20
  47. package/dist/chunk-UPCNNWXW.cjs.map +1 -0
  48. package/dist/{chunk-KMVGT2JI.js → chunk-UQ2HAEHL.js} +233 -17
  49. package/dist/chunk-UQ2HAEHL.js.map +1 -0
  50. package/dist/{chunk-AGEYVARR.js → chunk-VMKNS3YO.js} +204 -3
  51. package/dist/chunk-VMKNS3YO.js.map +1 -0
  52. package/dist/{chunk-YXNO6AHV.js → chunk-WYFCQAHY.js} +7 -7
  53. package/dist/{chunk-YXNO6AHV.js.map → chunk-WYFCQAHY.js.map} +1 -1
  54. package/dist/{chunk-A5JHKGFY.cjs → chunk-Z3VUDCXI.cjs} +7 -7
  55. package/dist/{chunk-A5JHKGFY.cjs.map → chunk-Z3VUDCXI.cjs.map} +1 -1
  56. package/dist/datasets/index.cjs +17 -17
  57. package/dist/datasets/index.js +2 -2
  58. package/dist/docs/SKILL.md +2 -1
  59. package/dist/docs/assets/SOURCE_MAP.json +349 -334
  60. package/dist/docs/references/reference-evals-run-evals.md +78 -3
  61. package/dist/docs/references/reference-evals-scorer-utils.md +184 -0
  62. package/dist/docs/references/reference-evals-trajectory-accuracy.md +613 -0
  63. package/dist/docs/references/reference.md +1 -0
  64. package/dist/evals/base.d.ts +8 -2
  65. package/dist/evals/base.d.ts.map +1 -1
  66. package/dist/evals/index.cjs +32 -20
  67. package/dist/evals/index.js +3 -3
  68. package/dist/evals/run/index.d.ts +28 -1
  69. package/dist/evals/run/index.d.ts.map +1 -1
  70. package/dist/evals/run/scorerAccumulator.d.ts +4 -1
  71. package/dist/evals/run/scorerAccumulator.d.ts.map +1 -1
  72. package/dist/evals/scoreTraces/index.cjs +5 -5
  73. package/dist/evals/scoreTraces/index.js +2 -2
  74. package/dist/evals/types.d.ts +305 -10
  75. package/dist/evals/types.d.ts.map +1 -1
  76. package/dist/harness/index.cjs +7 -7
  77. package/dist/harness/index.js +5 -5
  78. package/dist/index.cjs +2 -2
  79. package/dist/index.js +1 -1
  80. package/dist/llm/index.cjs +16 -16
  81. package/dist/llm/index.js +5 -5
  82. package/dist/llm/model/provider-types.generated.d.ts +2444 -2243
  83. package/dist/loop/index.cjs +14 -14
  84. package/dist/loop/index.js +1 -1
  85. package/dist/loop/network/index.d.ts +3 -3
  86. package/dist/loop/types.d.ts +1 -1
  87. package/dist/mastra/index.cjs +2 -2
  88. package/dist/mastra/index.js +1 -1
  89. package/dist/memory/index.cjs +14 -14
  90. package/dist/memory/index.js +1 -1
  91. package/dist/models-dev-3U6ICCNW.js +3 -0
  92. package/dist/{models-dev-JEMMVJFN.js.map → models-dev-3U6ICCNW.js.map} +1 -1
  93. package/dist/models-dev-BJHT4GXA.cjs +12 -0
  94. package/dist/{models-dev-MU7QGI4O.cjs.map → models-dev-BJHT4GXA.cjs.map} +1 -1
  95. package/dist/netlify-DE3IXMT2.js +3 -0
  96. package/dist/{netlify-BROEKRZF.js.map → netlify-DE3IXMT2.js.map} +1 -1
  97. package/dist/netlify-UARJYMCW.cjs +12 -0
  98. package/dist/{netlify-GOEIG6IC.cjs.map → netlify-UARJYMCW.cjs.map} +1 -1
  99. package/dist/processor-provider/index.cjs +10 -10
  100. package/dist/processor-provider/index.js +1 -1
  101. package/dist/processors/index.cjs +44 -44
  102. package/dist/processors/index.js +1 -1
  103. package/dist/provider-registry-65CPGTUU.cjs +40 -0
  104. package/dist/{provider-registry-CKFMYEBK.cjs.map → provider-registry-65CPGTUU.cjs.map} +1 -1
  105. package/dist/provider-registry-EQAT7FXK.js +3 -0
  106. package/dist/{provider-registry-P7EMCVJI.js.map → provider-registry-EQAT7FXK.js.map} +1 -1
  107. package/dist/provider-registry.json +6102 -5692
  108. package/dist/relevance/index.cjs +3 -3
  109. package/dist/relevance/index.js +1 -1
  110. package/dist/storage/constants.cjs +56 -56
  111. package/dist/storage/constants.d.ts +1 -1
  112. package/dist/storage/constants.js +1 -1
  113. package/dist/storage/domains/experiments/base.d.ts +2 -1
  114. package/dist/storage/domains/experiments/base.d.ts.map +1 -1
  115. package/dist/storage/domains/experiments/inmemory.d.ts +2 -1
  116. package/dist/storage/domains/experiments/inmemory.d.ts.map +1 -1
  117. package/dist/storage/domains/observability/tracing.d.ts +45 -45
  118. package/dist/storage/index.cjs +160 -160
  119. package/dist/storage/index.js +2 -2
  120. package/dist/storage/types.d.ts +12 -0
  121. package/dist/storage/types.d.ts.map +1 -1
  122. package/dist/stream/MastraAgentNetworkStream.d.ts +1 -1
  123. package/dist/stream/MastraWorkflowStream.d.ts +1 -1
  124. package/dist/stream/index.cjs +8 -8
  125. package/dist/stream/index.js +1 -1
  126. package/dist/tool-loop-agent/index.cjs +4 -4
  127. package/dist/tool-loop-agent/index.js +1 -1
  128. package/dist/vector/index.cjs +7 -7
  129. package/dist/vector/index.js +1 -1
  130. package/dist/workflows/evented/index.cjs +10 -10
  131. package/dist/workflows/evented/index.js +1 -1
  132. package/dist/workflows/index.cjs +24 -24
  133. package/dist/workflows/index.js +1 -1
  134. package/package.json +5 -5
  135. package/src/llm/model/provider-types.generated.d.ts +2444 -2243
  136. package/dist/chunk-AGEYVARR.js.map +0 -1
  137. package/dist/chunk-BIB2LCIR.js.map +0 -1
  138. package/dist/chunk-DL4A7URO.cjs.map +0 -1
  139. package/dist/chunk-KMVGT2JI.js.map +0 -1
  140. package/dist/chunk-QVQ3PGG2.cjs.map +0 -1
  141. package/dist/chunk-V54LY5HR.cjs.map +0 -1
  142. package/dist/models-dev-JEMMVJFN.js +0 -3
  143. package/dist/models-dev-MU7QGI4O.cjs +0 -12
  144. package/dist/netlify-BROEKRZF.js +0 -3
  145. package/dist/netlify-GOEIG6IC.cjs +0 -12
  146. package/dist/provider-registry-CKFMYEBK.cjs +0 -40
  147. package/dist/provider-registry-P7EMCVJI.js +0 -3
package/CHANGELOG.md CHANGED
@@ -1,5 +1,30 @@
1
1
  # @mastra/core
2
2
 
3
+ ## 1.18.0-alpha.1
4
+
5
+ ### Minor Changes
6
+
7
+ - **Trajectory evaluation**: Added trajectory types and trace-based extraction for evaluating agent and workflow execution paths. ([#14697](https://github.com/mastra-ai/mastra/pull/14697))
8
+
9
+ `TrajectoryStep` models each step in an execution as a typed object — tool calls, model generations, agent runs, workflow steps, and control flow nodes each have their own variant with relevant properties (e.g., `toolArgs`/`toolResult` for tool calls, `modelId`/`promptTokens` for model generations). Steps can be nested via `children` to represent hierarchical execution.
10
+
11
+ `TrajectoryExpectation` lets you define what a good trajectory looks like — expected steps, ordering, step/token/duration budgets, blacklisted tools, and retry thresholds. `ExpectedStep` provides a simple way to define expected steps by name and optional stepType, with support for nested expectations via `children` to set different evaluation rules at each level of the hierarchy.
12
+
13
+ **Trace-based extraction:** `extractTrajectoryFromTrace()` builds hierarchical trajectories from observability trace spans. The `runEvals` pipeline automatically uses this when storage is configured, capturing the full execution tree including nested agent runs and tool calls. Falls back to `extractTrajectory` (agents) or `extractWorkflowTrajectory` (workflows) when storage is unavailable.
14
+
15
+ **Pipeline:** `expectedTrajectory` flows from dataset items through `runEvals` to trajectory scorers. Added `trajectory` key to both `AgentScorerConfig` and `WorkflowScorerConfig`.
16
+
17
+ ### Patch Changes
18
+
19
+ - Add `getReviewSummary()` to experiments storage for aggregating review status counts ([#14649](https://github.com/mastra-ai/mastra/pull/14649))
20
+
21
+ Query experiment results grouped by experiment ID, returning counts of `needs-review`, `reviewed`, and `complete` items in a single query instead of fetching all results client-side.
22
+
23
+ ```ts
24
+ const summary = await storage.experiments.getReviewSummary();
25
+ // [{ experimentId: 'exp-1', needsReview: 3, reviewed: 5, complete: 2, total: 10 }, ...]
26
+ ```
27
+
3
28
  ## 1.18.0-alpha.0
4
29
 
5
30
  ### Minor Changes
@@ -1,37 +1,37 @@
1
1
  'use strict';
2
2
 
3
- var chunkBHVF4Z5D_cjs = require('../chunk-BHVF4Z5D.cjs');
3
+ var chunkGFBH7Q4W_cjs = require('../chunk-GFBH7Q4W.cjs');
4
4
  var chunkANLO4VM2_cjs = require('../chunk-ANLO4VM2.cjs');
5
5
 
6
6
 
7
7
 
8
8
  Object.defineProperty(exports, "Agent", {
9
9
  enumerable: true,
10
- get: function () { return chunkBHVF4Z5D_cjs.Agent; }
10
+ get: function () { return chunkGFBH7Q4W_cjs.Agent; }
11
11
  });
12
12
  Object.defineProperty(exports, "TripWire", {
13
13
  enumerable: true,
14
- get: function () { return chunkBHVF4Z5D_cjs.TripWire; }
14
+ get: function () { return chunkGFBH7Q4W_cjs.TripWire; }
15
15
  });
16
16
  Object.defineProperty(exports, "isSupportedLanguageModel", {
17
17
  enumerable: true,
18
- get: function () { return chunkBHVF4Z5D_cjs.isSupportedLanguageModel; }
18
+ get: function () { return chunkGFBH7Q4W_cjs.isSupportedLanguageModel; }
19
19
  });
20
20
  Object.defineProperty(exports, "resolveThreadIdFromArgs", {
21
21
  enumerable: true,
22
- get: function () { return chunkBHVF4Z5D_cjs.resolveThreadIdFromArgs; }
22
+ get: function () { return chunkGFBH7Q4W_cjs.resolveThreadIdFromArgs; }
23
23
  });
24
24
  Object.defineProperty(exports, "supportedLanguageModelSpecifications", {
25
25
  enumerable: true,
26
- get: function () { return chunkBHVF4Z5D_cjs.supportedLanguageModelSpecifications; }
26
+ get: function () { return chunkGFBH7Q4W_cjs.supportedLanguageModelSpecifications; }
27
27
  });
28
28
  Object.defineProperty(exports, "tryGenerateWithJsonFallback", {
29
29
  enumerable: true,
30
- get: function () { return chunkBHVF4Z5D_cjs.tryGenerateWithJsonFallback; }
30
+ get: function () { return chunkGFBH7Q4W_cjs.tryGenerateWithJsonFallback; }
31
31
  });
32
32
  Object.defineProperty(exports, "tryStreamWithJsonFallback", {
33
33
  enumerable: true,
34
- get: function () { return chunkBHVF4Z5D_cjs.tryStreamWithJsonFallback; }
34
+ get: function () { return chunkGFBH7Q4W_cjs.tryStreamWithJsonFallback; }
35
35
  });
36
36
  Object.defineProperty(exports, "MessageList", {
37
37
  enumerable: true,
@@ -1,4 +1,4 @@
1
- export { Agent, TripWire, isSupportedLanguageModel, resolveThreadIdFromArgs, supportedLanguageModelSpecifications, tryGenerateWithJsonFallback, tryStreamWithJsonFallback } from '../chunk-ZOPIN73X.js';
1
+ export { Agent, TripWire, isSupportedLanguageModel, resolveThreadIdFromArgs, supportedLanguageModelSpecifications, tryGenerateWithJsonFallback, tryStreamWithJsonFallback } from '../chunk-3U4ZNZIF.js';
2
2
  export { MessageList, TypeDetector, aiV5ModelMessageToV2PromptMessage, convertMessages } from '../chunk-SLZ3WO42.js';
3
3
  //# sourceMappingURL=index.js.map
4
4
  //# sourceMappingURL=index.js.map
@@ -1,16 +1,16 @@
1
1
  'use strict';
2
2
 
3
- var chunkTG4U3K3I_cjs = require('./chunk-TG4U3K3I.cjs');
4
- var chunkA5JHKGFY_cjs = require('./chunk-A5JHKGFY.cjs');
5
- var chunkSLG7AUBK_cjs = require('./chunk-SLG7AUBK.cjs');
6
- var chunkDL4A7URO_cjs = require('./chunk-DL4A7URO.cjs');
7
- var chunkBHVF4Z5D_cjs = require('./chunk-BHVF4Z5D.cjs');
3
+ var chunkJFPVUKPB_cjs = require('./chunk-JFPVUKPB.cjs');
4
+ var chunkZ3VUDCXI_cjs = require('./chunk-Z3VUDCXI.cjs');
5
+ var chunkPQWEJELD_cjs = require('./chunk-PQWEJELD.cjs');
6
+ var chunkUPCNNWXW_cjs = require('./chunk-UPCNNWXW.cjs');
7
+ var chunkGFBH7Q4W_cjs = require('./chunk-GFBH7Q4W.cjs');
8
8
  var chunkMR7ZWBL6_cjs = require('./chunk-MR7ZWBL6.cjs');
9
9
  var chunk6BJ7XHRH_cjs = require('./chunk-6BJ7XHRH.cjs');
10
+ var chunk2VD5OGOT_cjs = require('./chunk-2VD5OGOT.cjs');
10
11
  var chunkOQDRPRKM_cjs = require('./chunk-OQDRPRKM.cjs');
11
12
  var chunkG5HKDGNT_cjs = require('./chunk-G5HKDGNT.cjs');
12
13
  var chunk4U7ZLI36_cjs = require('./chunk-4U7ZLI36.cjs');
13
- var chunk2VD5OGOT_cjs = require('./chunk-2VD5OGOT.cjs');
14
14
  var chunk7XAECHYL_cjs = require('./chunk-7XAECHYL.cjs');
15
15
  var crypto = require('crypto');
16
16
 
@@ -67,7 +67,7 @@ var Mastra = class {
67
67
  }
68
68
  get datasets() {
69
69
  if (!this.#datasets) {
70
- this.#datasets = new chunkSLG7AUBK_cjs.DatasetsManager(this);
70
+ this.#datasets = new chunkPQWEJELD_cjs.DatasetsManager(this);
71
71
  }
72
72
  return this.#datasets;
73
73
  }
@@ -243,7 +243,7 @@ var Mastra = class {
243
243
  this.#events[topic] = config?.events?.[topic] ?? [];
244
244
  }
245
245
  }
246
- const workflowEventProcessor = new chunkTG4U3K3I_cjs.WorkflowEventProcessor({ mastra: this });
246
+ const workflowEventProcessor = new chunkJFPVUKPB_cjs.WorkflowEventProcessor({ mastra: this });
247
247
  const workflowEventCb = async (event, cb) => {
248
248
  try {
249
249
  await workflowEventProcessor.process(event, cb);
@@ -271,7 +271,7 @@ var Mastra = class {
271
271
  this.#idGenerator = config?.idGenerator;
272
272
  let storage = config?.storage;
273
273
  if (storage) {
274
- storage = chunkBHVF4Z5D_cjs.augmentWithInit(storage);
274
+ storage = chunkGFBH7Q4W_cjs.augmentWithInit(storage);
275
275
  }
276
276
  if (config?.observability) {
277
277
  if (typeof config.observability.getDefaultInstance === "function") {
@@ -374,7 +374,7 @@ var Mastra = class {
374
374
  if (config?.server) {
375
375
  this.#server = config.server;
376
376
  }
377
- chunkMR7ZWBL6_cjs.registerHook("onScorerRun" /* ON_SCORER_RUN */, chunkDL4A7URO_cjs.createOnScorerHook(this));
377
+ chunkMR7ZWBL6_cjs.registerHook("onScorerRun" /* ON_SCORER_RUN */, chunkUPCNNWXW_cjs.createOnScorerHook(this));
378
378
  this.#observability.setMastraContext({ mastra: this });
379
379
  this.setLogger({ logger });
380
380
  }
@@ -518,8 +518,8 @@ var Mastra = class {
518
518
  throw createUndefinedPrimitiveError("agent", agent, key);
519
519
  }
520
520
  let mastraAgent;
521
- if (chunkA5JHKGFY_cjs.isToolLoopAgentLike(agent)) {
522
- mastraAgent = chunkA5JHKGFY_cjs.toolLoopAgentToMastraAgent(agent, { fallbackName: key });
521
+ if (chunkZ3VUDCXI_cjs.isToolLoopAgentLike(agent)) {
522
+ mastraAgent = chunkZ3VUDCXI_cjs.toolLoopAgentToMastraAgent(agent, { fallbackName: key });
523
523
  } else {
524
524
  mastraAgent = agent;
525
525
  }
@@ -1863,7 +1863,7 @@ var Mastra = class {
1863
1863
  * ```
1864
1864
  */
1865
1865
  setStorage(storage) {
1866
- this.#storage = chunkBHVF4Z5D_cjs.augmentWithInit(storage);
1866
+ this.#storage = chunkGFBH7Q4W_cjs.augmentWithInit(storage);
1867
1867
  }
1868
1868
  setLogger({ logger }) {
1869
1869
  this.#logger = logger;
@@ -2556,7 +2556,7 @@ var Mastra = class {
2556
2556
  if (process.env.MASTRA_DEV !== "true" && process.env.MASTRA_DEV !== "1") {
2557
2557
  return;
2558
2558
  }
2559
- import('./provider-registry-CKFMYEBK.cjs').then(async ({ GatewayRegistry }) => {
2559
+ import('./provider-registry-65CPGTUU.cjs').then(async ({ GatewayRegistry }) => {
2560
2560
  const registry = GatewayRegistry.getInstance();
2561
2561
  const customGateways = Object.values(this.#gateways || {});
2562
2562
  registry.registerCustomGateways(customGateways);
@@ -2610,5 +2610,5 @@ var Mastra = class {
2610
2610
  };
2611
2611
 
2612
2612
  exports.Mastra = Mastra;
2613
- //# sourceMappingURL=chunk-3ECYXW43.cjs.map
2614
- //# sourceMappingURL=chunk-3ECYXW43.cjs.map
2613
+ //# sourceMappingURL=chunk-2U4M4SGY.cjs.map
2614
+ //# sourceMappingURL=chunk-2U4M4SGY.cjs.map