@mastra/evals 0.1.12 → 0.1.13-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.
@@ -11991,7 +11991,7 @@ function createTestHook(name, handler) {
11991
11991
  globalThis.performance ? globalThis.performance.now.bind(globalThis.performance) : Date.now;
11992
11992
  globalThis.performance ? globalThis.performance.now.bind(globalThis.performance) : Date.now;
11993
11993
 
11994
- // ../../node_modules/.pnpm/vitest@3.0.8_@edge-runtime+vm@3.2.0_@types+debug@4.1.12_@types+node@20.17.24_jiti@2.4.2_dedfc6223645f89cf989a950dc6a81ab/node_modules/vitest/dist/chunks/utils.C8RiOc4B.js
11994
+ // ../../node_modules/.pnpm/vitest@3.0.8_@edge-runtime+vm@3.2.0_@types+debug@4.1.12_@types+node@20.17.24_jiti@2.4.2_77200d29e732717f264ba9ce8f1a1163/node_modules/vitest/dist/chunks/utils.C8RiOc4B.js
11995
11995
  var NAME_WORKER_STATE = "__vitest_worker__";
11996
11996
  function getWorkerState() {
11997
11997
  const workerState = globalThis[NAME_WORKER_STATE];
@@ -12051,7 +12051,7 @@ async function waitForImportsToResolve() {
12051
12051
  await waitForImportsToResolve();
12052
12052
  }
12053
12053
 
12054
- // ../../node_modules/.pnpm/vitest@3.0.8_@edge-runtime+vm@3.2.0_@types+debug@4.1.12_@types+node@20.17.24_jiti@2.4.2_dedfc6223645f89cf989a950dc6a81ab/node_modules/vitest/dist/chunks/_commonjsHelpers.BFTU3MAI.js
12054
+ // ../../node_modules/.pnpm/vitest@3.0.8_@edge-runtime+vm@3.2.0_@types+debug@4.1.12_@types+node@20.17.24_jiti@2.4.2_77200d29e732717f264ba9ce8f1a1163/node_modules/vitest/dist/chunks/_commonjsHelpers.BFTU3MAI.js
12055
12055
  var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
12056
12056
  function getDefaultExportFromCjs3(x2) {
12057
12057
  return x2 && x2.__esModule && Object.prototype.hasOwnProperty.call(x2, "default") ? x2["default"] : x2;
@@ -13784,7 +13784,7 @@ var SnapshotClient = class {
13784
13784
  }
13785
13785
  };
13786
13786
 
13787
- // ../../node_modules/.pnpm/vitest@3.0.8_@edge-runtime+vm@3.2.0_@types+debug@4.1.12_@types+node@20.17.24_jiti@2.4.2_dedfc6223645f89cf989a950dc6a81ab/node_modules/vitest/dist/chunks/date.W2xKR2qe.js
13787
+ // ../../node_modules/.pnpm/vitest@3.0.8_@edge-runtime+vm@3.2.0_@types+debug@4.1.12_@types+node@20.17.24_jiti@2.4.2_77200d29e732717f264ba9ce8f1a1163/node_modules/vitest/dist/chunks/date.W2xKR2qe.js
13788
13788
  var RealDate = Date;
13789
13789
  var now2 = null;
13790
13790
  var MockDate = class _MockDate extends RealDate {
@@ -13837,7 +13837,7 @@ function resetDate() {
13837
13837
  globalThis.Date = RealDate;
13838
13838
  }
13839
13839
 
13840
- // ../../node_modules/.pnpm/vitest@3.0.8_@edge-runtime+vm@3.2.0_@types+debug@4.1.12_@types+node@20.17.24_jiti@2.4.2_dedfc6223645f89cf989a950dc6a81ab/node_modules/vitest/dist/chunks/vi.B5EKKJdE.js
13840
+ // ../../node_modules/.pnpm/vitest@3.0.8_@edge-runtime+vm@3.2.0_@types+debug@4.1.12_@types+node@20.17.24_jiti@2.4.2_77200d29e732717f264ba9ce8f1a1163/node_modules/vitest/dist/chunks/vi.B5EKKJdE.js
13841
13841
  var unsupported = [
13842
13842
  // .poll is meant to retry matchers until they succeed, and
13843
13843
  // snapshots will always succeed as long as the poll method doesn't throw an error
@@ -16805,7 +16805,7 @@ function getImporter(name) {
16805
16805
  return stack?.file || "";
16806
16806
  }
16807
16807
 
16808
- // ../../node_modules/.pnpm/vitest@3.0.8_@edge-runtime+vm@3.2.0_@types+debug@4.1.12_@types+node@20.17.24_jiti@2.4.2_dedfc6223645f89cf989a950dc6a81ab/node_modules/vitest/dist/chunks/run-once.2ogXb3JV.js
16808
+ // ../../node_modules/.pnpm/vitest@3.0.8_@edge-runtime+vm@3.2.0_@types+debug@4.1.12_@types+node@20.17.24_jiti@2.4.2_77200d29e732717f264ba9ce8f1a1163/node_modules/vitest/dist/chunks/run-once.2ogXb3JV.js
16809
16809
  var filesCount = /* @__PURE__ */ new Map();
16810
16810
  var cache = /* @__PURE__ */ new Map();
16811
16811
  function runOnce(fn2, key) {
@@ -16828,7 +16828,7 @@ function isFirstRun() {
16828
16828
  return firstRun;
16829
16829
  }
16830
16830
 
16831
- // ../../node_modules/.pnpm/vitest@3.0.8_@edge-runtime+vm@3.2.0_@types+debug@4.1.12_@types+node@20.17.24_jiti@2.4.2_dedfc6223645f89cf989a950dc6a81ab/node_modules/vitest/dist/chunks/benchmark.Cdu9hjj4.js
16831
+ // ../../node_modules/.pnpm/vitest@3.0.8_@edge-runtime+vm@3.2.0_@types+debug@4.1.12_@types+node@20.17.24_jiti@2.4.2_77200d29e732717f264ba9ce8f1a1163/node_modules/vitest/dist/chunks/benchmark.Cdu9hjj4.js
16832
16832
  var benchFns = /* @__PURE__ */ new WeakMap();
16833
16833
  var benchOptsMap = /* @__PURE__ */ new WeakMap();
16834
16834
  var bench = createBenchmark(function(name, fn2 = noop, options = {}) {
@@ -16857,7 +16857,7 @@ function formatName2(name) {
16857
16857
  return typeof name === "string" ? name : name instanceof Function ? name.name || "<anonymous>" : String(name);
16858
16858
  }
16859
16859
 
16860
- // ../../node_modules/.pnpm/vitest@3.0.8_@edge-runtime+vm@3.2.0_@types+debug@4.1.12_@types+node@20.17.24_jiti@2.4.2_dedfc6223645f89cf989a950dc6a81ab/node_modules/vitest/dist/chunks/index.CNRemkXW.js
16860
+ // ../../node_modules/.pnpm/vitest@3.0.8_@edge-runtime+vm@3.2.0_@types+debug@4.1.12_@types+node@20.17.24_jiti@2.4.2_77200d29e732717f264ba9ce8f1a1163/node_modules/vitest/dist/chunks/index.CNRemkXW.js
16861
16861
  __toESM(require_dist(), 1);
16862
16862
  function getRunningMode() {
16863
16863
  return process.env.VITEST_MODE === "WATCH" ? "watch" : "run";
@@ -16868,7 +16868,7 @@ function isWatchMode() {
16868
16868
  var assertType = function assertType2() {
16869
16869
  };
16870
16870
 
16871
- // ../../node_modules/.pnpm/vitest@3.0.8_@edge-runtime+vm@3.2.0_@types+debug@4.1.12_@types+node@20.17.24_jiti@2.4.2_dedfc6223645f89cf989a950dc6a81ab/node_modules/vitest/dist/index.js
16871
+ // ../../node_modules/.pnpm/vitest@3.0.8_@edge-runtime+vm@3.2.0_@types+debug@4.1.12_@types+node@20.17.24_jiti@2.4.2_77200d29e732717f264ba9ce8f1a1163/node_modules/vitest/dist/index.js
16872
16872
  var import_expect_type2 = __toESM(require_dist(), 1);
16873
16873
  var export_expectTypeOf = import_expect_type2.expectTypeOf;
16874
16874
  /*! Bundled license information:
@@ -11993,7 +11993,7 @@ function createTestHook(name, handler) {
11993
11993
  globalThis.performance ? globalThis.performance.now.bind(globalThis.performance) : Date.now;
11994
11994
  globalThis.performance ? globalThis.performance.now.bind(globalThis.performance) : Date.now;
11995
11995
 
11996
- // ../../node_modules/.pnpm/vitest@3.0.8_@edge-runtime+vm@3.2.0_@types+debug@4.1.12_@types+node@20.17.24_jiti@2.4.2_dedfc6223645f89cf989a950dc6a81ab/node_modules/vitest/dist/chunks/utils.C8RiOc4B.js
11996
+ // ../../node_modules/.pnpm/vitest@3.0.8_@edge-runtime+vm@3.2.0_@types+debug@4.1.12_@types+node@20.17.24_jiti@2.4.2_77200d29e732717f264ba9ce8f1a1163/node_modules/vitest/dist/chunks/utils.C8RiOc4B.js
11997
11997
  var NAME_WORKER_STATE = "__vitest_worker__";
11998
11998
  function getWorkerState() {
11999
11999
  const workerState = globalThis[NAME_WORKER_STATE];
@@ -12053,7 +12053,7 @@ async function waitForImportsToResolve() {
12053
12053
  await waitForImportsToResolve();
12054
12054
  }
12055
12055
 
12056
- // ../../node_modules/.pnpm/vitest@3.0.8_@edge-runtime+vm@3.2.0_@types+debug@4.1.12_@types+node@20.17.24_jiti@2.4.2_dedfc6223645f89cf989a950dc6a81ab/node_modules/vitest/dist/chunks/_commonjsHelpers.BFTU3MAI.js
12056
+ // ../../node_modules/.pnpm/vitest@3.0.8_@edge-runtime+vm@3.2.0_@types+debug@4.1.12_@types+node@20.17.24_jiti@2.4.2_77200d29e732717f264ba9ce8f1a1163/node_modules/vitest/dist/chunks/_commonjsHelpers.BFTU3MAI.js
12057
12057
  var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
12058
12058
  function getDefaultExportFromCjs3(x2) {
12059
12059
  return x2 && x2.__esModule && Object.prototype.hasOwnProperty.call(x2, "default") ? x2["default"] : x2;
@@ -13786,7 +13786,7 @@ var SnapshotClient = class {
13786
13786
  }
13787
13787
  };
13788
13788
 
13789
- // ../../node_modules/.pnpm/vitest@3.0.8_@edge-runtime+vm@3.2.0_@types+debug@4.1.12_@types+node@20.17.24_jiti@2.4.2_dedfc6223645f89cf989a950dc6a81ab/node_modules/vitest/dist/chunks/date.W2xKR2qe.js
13789
+ // ../../node_modules/.pnpm/vitest@3.0.8_@edge-runtime+vm@3.2.0_@types+debug@4.1.12_@types+node@20.17.24_jiti@2.4.2_77200d29e732717f264ba9ce8f1a1163/node_modules/vitest/dist/chunks/date.W2xKR2qe.js
13790
13790
  var RealDate = Date;
13791
13791
  var now2 = null;
13792
13792
  var MockDate = class _MockDate extends RealDate {
@@ -13839,7 +13839,7 @@ function resetDate() {
13839
13839
  globalThis.Date = RealDate;
13840
13840
  }
13841
13841
 
13842
- // ../../node_modules/.pnpm/vitest@3.0.8_@edge-runtime+vm@3.2.0_@types+debug@4.1.12_@types+node@20.17.24_jiti@2.4.2_dedfc6223645f89cf989a950dc6a81ab/node_modules/vitest/dist/chunks/vi.B5EKKJdE.js
13842
+ // ../../node_modules/.pnpm/vitest@3.0.8_@edge-runtime+vm@3.2.0_@types+debug@4.1.12_@types+node@20.17.24_jiti@2.4.2_77200d29e732717f264ba9ce8f1a1163/node_modules/vitest/dist/chunks/vi.B5EKKJdE.js
13843
13843
  var unsupported = [
13844
13844
  // .poll is meant to retry matchers until they succeed, and
13845
13845
  // snapshots will always succeed as long as the poll method doesn't throw an error
@@ -16807,7 +16807,7 @@ function getImporter(name) {
16807
16807
  return stack?.file || "";
16808
16808
  }
16809
16809
 
16810
- // ../../node_modules/.pnpm/vitest@3.0.8_@edge-runtime+vm@3.2.0_@types+debug@4.1.12_@types+node@20.17.24_jiti@2.4.2_dedfc6223645f89cf989a950dc6a81ab/node_modules/vitest/dist/chunks/run-once.2ogXb3JV.js
16810
+ // ../../node_modules/.pnpm/vitest@3.0.8_@edge-runtime+vm@3.2.0_@types+debug@4.1.12_@types+node@20.17.24_jiti@2.4.2_77200d29e732717f264ba9ce8f1a1163/node_modules/vitest/dist/chunks/run-once.2ogXb3JV.js
16811
16811
  var filesCount = /* @__PURE__ */ new Map();
16812
16812
  var cache = /* @__PURE__ */ new Map();
16813
16813
  function runOnce(fn2, key) {
@@ -16830,7 +16830,7 @@ function isFirstRun() {
16830
16830
  return firstRun;
16831
16831
  }
16832
16832
 
16833
- // ../../node_modules/.pnpm/vitest@3.0.8_@edge-runtime+vm@3.2.0_@types+debug@4.1.12_@types+node@20.17.24_jiti@2.4.2_dedfc6223645f89cf989a950dc6a81ab/node_modules/vitest/dist/chunks/benchmark.Cdu9hjj4.js
16833
+ // ../../node_modules/.pnpm/vitest@3.0.8_@edge-runtime+vm@3.2.0_@types+debug@4.1.12_@types+node@20.17.24_jiti@2.4.2_77200d29e732717f264ba9ce8f1a1163/node_modules/vitest/dist/chunks/benchmark.Cdu9hjj4.js
16834
16834
  var benchFns = /* @__PURE__ */ new WeakMap();
16835
16835
  var benchOptsMap = /* @__PURE__ */ new WeakMap();
16836
16836
  var bench = createBenchmark(function(name, fn2 = noop, options = {}) {
@@ -16859,7 +16859,7 @@ function formatName2(name) {
16859
16859
  return typeof name === "string" ? name : name instanceof Function ? name.name || "<anonymous>" : String(name);
16860
16860
  }
16861
16861
 
16862
- // ../../node_modules/.pnpm/vitest@3.0.8_@edge-runtime+vm@3.2.0_@types+debug@4.1.12_@types+node@20.17.24_jiti@2.4.2_dedfc6223645f89cf989a950dc6a81ab/node_modules/vitest/dist/chunks/index.CNRemkXW.js
16862
+ // ../../node_modules/.pnpm/vitest@3.0.8_@edge-runtime+vm@3.2.0_@types+debug@4.1.12_@types+node@20.17.24_jiti@2.4.2_77200d29e732717f264ba9ce8f1a1163/node_modules/vitest/dist/chunks/index.CNRemkXW.js
16863
16863
  chunkCVPOREIE_cjs.__toESM(require_dist(), 1);
16864
16864
  function getRunningMode() {
16865
16865
  return process.env.VITEST_MODE === "WATCH" ? "watch" : "run";
@@ -16870,7 +16870,7 @@ function isWatchMode() {
16870
16870
  var assertType = function assertType2() {
16871
16871
  };
16872
16872
 
16873
- // ../../node_modules/.pnpm/vitest@3.0.8_@edge-runtime+vm@3.2.0_@types+debug@4.1.12_@types+node@20.17.24_jiti@2.4.2_dedfc6223645f89cf989a950dc6a81ab/node_modules/vitest/dist/index.js
16873
+ // ../../node_modules/.pnpm/vitest@3.0.8_@edge-runtime+vm@3.2.0_@types+debug@4.1.12_@types+node@20.17.24_jiti@2.4.2_77200d29e732717f264ba9ce8f1a1163/node_modules/vitest/dist/index.js
16874
16874
  var import_expect_type2 = chunkCVPOREIE_cjs.__toESM(require_dist(), 1);
16875
16875
  var export_expectTypeOf = import_expect_type2.expectTypeOf;
16876
16876
  /*! Bundled license information:
package/dist/index.cjs CHANGED
@@ -3,6 +3,7 @@
3
3
  var core = require('@mastra/core');
4
4
  var hooks = require('@mastra/core/hooks');
5
5
  var storage = require('@mastra/core/storage');
6
+ var utils = require('@mastra/core/utils');
6
7
 
7
8
  // src/constants.ts
8
9
  var GLOBAL_RUN_ID_ENV_KEY = "_MASTRA_GLOBAL_RUN_ID_";
@@ -40,7 +41,7 @@ var getCurrentTestInfo = async () => {
40
41
  };
41
42
  }
42
43
  try {
43
- const vitest = await import('./dist-LFRVETGO.cjs');
44
+ const vitest = await import('./dist-MDECIO7S.cjs');
44
45
  if (typeof vitest !== "undefined" && vitest.expect?.getState) {
45
46
  const state = vitest.expect.getState();
46
47
  return {
@@ -58,12 +59,15 @@ async function attachListeners(mastra) {
58
59
  }
59
60
  hooks.registerHook(hooks.AvailableHooks.ON_EVALUATION, async (traceObject) => {
60
61
  if (mastra?.storage) {
62
+ const logger = mastra?.getLogger();
63
+ const areFieldsValid = utils.checkEvalStorageFields(traceObject, logger);
64
+ if (!areFieldsValid) return;
61
65
  await mastra.storage.insert({
62
66
  tableName: storage.TABLE_EVALS,
63
67
  record: {
64
68
  input: traceObject.input,
65
69
  output: traceObject.output,
66
- result: JSON.stringify(traceObject.result),
70
+ result: JSON.stringify(traceObject.result || {}),
67
71
  agent_name: traceObject.agentName,
68
72
  metric_name: traceObject.metricName,
69
73
  instructions: traceObject.instructions,
package/dist/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import { evaluate as evaluate$1 } from '@mastra/core';
2
2
  import { registerHook, AvailableHooks } from '@mastra/core/hooks';
3
3
  import { TABLE_EVALS } from '@mastra/core/storage';
4
+ import { checkEvalStorageFields } from '@mastra/core/utils';
4
5
 
5
6
  // src/constants.ts
6
7
  var GLOBAL_RUN_ID_ENV_KEY = "_MASTRA_GLOBAL_RUN_ID_";
@@ -38,7 +39,7 @@ var getCurrentTestInfo = async () => {
38
39
  };
39
40
  }
40
41
  try {
41
- const vitest = await import('./dist-QESUHJG4.js');
42
+ const vitest = await import('./dist-4Q76WY4Y.js');
42
43
  if (typeof vitest !== "undefined" && vitest.expect?.getState) {
43
44
  const state = vitest.expect.getState();
44
45
  return {
@@ -56,12 +57,15 @@ async function attachListeners(mastra) {
56
57
  }
57
58
  registerHook(AvailableHooks.ON_EVALUATION, async (traceObject) => {
58
59
  if (mastra?.storage) {
60
+ const logger = mastra?.getLogger();
61
+ const areFieldsValid = checkEvalStorageFields(traceObject, logger);
62
+ if (!areFieldsValid) return;
59
63
  await mastra.storage.insert({
60
64
  tableName: TABLE_EVALS,
61
65
  record: {
62
66
  input: traceObject.input,
63
67
  output: traceObject.output,
64
- result: JSON.stringify(traceObject.result),
68
+ result: JSON.stringify(traceObject.result || {}),
65
69
  agent_name: traceObject.agentName,
66
70
  metric_name: traceObject.metricName,
67
71
  instructions: traceObject.instructions,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/evals",
3
- "version": "0.1.12",
3
+ "version": "0.1.13-alpha.1",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "files": [
@@ -62,7 +62,7 @@
62
62
  "sentiment": "^5.0.2",
63
63
  "string-similarity": "^4.0.4",
64
64
  "zod": "^3.24.2",
65
- "@mastra/core": "^0.6.3"
65
+ "@mastra/core": "^0.6.4-alpha.1"
66
66
  },
67
67
  "peerDependencies": {
68
68
  "ai": "^4.0.0"