mastra 0.2.0-alpha.153 → 0.2.0-alpha.155

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.
@@ -630,6 +630,7 @@ var createMastraProject = async () => {
630
630
  await exec3(`echo .mastra >> .gitignore`);
631
631
  await exec3(`echo .env.development >> .gitignore`);
632
632
  await exec3(`echo .env >> .gitignore`);
633
+ await exec3(`echo *.db >> .gitignore`);
633
634
  s2.stop(".gitignore added");
634
635
  p.outro("Project created successfully");
635
636
  console.log("");
@@ -1 +1 @@
1
- export { create } from '../../chunk-VQREOIU7.js';
1
+ export { create } from '../../chunk-UU6XEV7T.js';
package/dist/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  #! /usr/bin/env node
2
2
  import { PosthogAnalytics } from './chunk-K5HPNH5H.js';
3
3
  export { PosthogAnalytics } from './chunk-K5HPNH5H.js';
4
- import { DepsService, create, checkPkgJson, checkAndInstallCoreDeps, interactivePrompt, init, FileService, logger } from './chunk-VQREOIU7.js';
5
- export { create } from './chunk-VQREOIU7.js';
4
+ import { DepsService, create, checkPkgJson, checkAndInstallCoreDeps, interactivePrompt, init, FileService, logger } from './chunk-UU6XEV7T.js';
5
+ export { create } from './chunk-UU6XEV7T.js';
6
6
  import { Command } from 'commander';
7
7
  import 'picocolors';
8
8
  import { join, dirname } from 'node:path';
@@ -13,9 +13,7 @@ import { readFileSync } from 'node:fs';
13
13
  import { fileURLToPath as fileURLToPath$1 } from 'node:url';
14
14
  import { getDeployer, FileService as FileService$2 } from '@mastra/deployer';
15
15
  import { join as join$1 } from 'path';
16
- import 'child_process';
17
16
  import { execa } from 'execa';
18
- import { writeFileSync } from 'fs';
19
17
  import { fileURLToPath } from 'url';
20
18
  import { MastraBundler } from '@mastra/core/bundler';
21
19
  import 'dotenv';
@@ -58,8 +56,8 @@ async function build({ dir }) {
58
56
  const mastraDir = dir ?? process.cwd();
59
57
  const outputDirectory = join(mastraDir, ".mastra");
60
58
  const deployer = new BuildBundler();
61
- const fs2 = new FileService();
62
- const mastraEntryFile = fs2.getFirstExistingFile([
59
+ const fs = new FileService();
60
+ const mastraEntryFile = fs.getFirstExistingFile([
63
61
  join(mastraDir, "src", "mastra", "index.ts"),
64
62
  join(mastraDir, "src", "mastra", "index.js")
65
63
  ]);
@@ -71,8 +69,8 @@ async function deploy({ dir }) {
71
69
  let mastraDir = dir || join$1(process.cwd(), "src/mastra");
72
70
  try {
73
71
  const outputDirectory = join$1(process.cwd(), ".mastra");
74
- const fs2 = new FileService();
75
- const mastraEntryFile = fs2.getFirstExistingFile([join$1(mastraDir, "index.ts"), join$1(mastraDir, "index.js")]);
72
+ const fs = new FileService();
73
+ const mastraEntryFile = fs.getFirstExistingFile([join$1(mastraDir, "index.ts"), join$1(mastraDir, "index.js")]);
76
74
  const deployer = await getDeployer(mastraEntryFile, outputDirectory);
77
75
  if (!deployer) {
78
76
  logger.warn("No deployer found.");
@@ -260,7 +258,6 @@ async function dev({ port, dir, root }) {
260
258
  const bundler = new DevBundler(mastraDir);
261
259
  const env = await bundler.loadEnvVars();
262
260
  await bundler.prepare(dotMastraPath);
263
- writeFileSync(join$1(dotMastraPath, "evals.json"), ``);
264
261
  const watcher = await bundler.watch(dotMastraPath);
265
262
  await startServer(dotMastraPath, port, env);
266
263
  watcher.on("event", (event) => {
@@ -4,13 +4,12 @@ import { mastra } from '#mastra';
4
4
  import { createNodeServer } from '#server';
5
5
  import { evaluate } from '@mastra/core/eval';
6
6
  import { AvailableHooks, registerHook } from '@mastra/core/hooks';
7
+ import { MastraStorage } from '@mastra/core/storage';
7
8
 
8
9
  // @ts-ignore
9
- const evalStore = [];
10
- // @ts-ignore
11
- await createNodeServer(mastra, { playground: true, swaggerUI: true, evalStore });
10
+ await createNodeServer(mastra, { playground: true, swaggerUI: true });
12
11
 
13
- registerHook(AvailableHooks.ON_GENERATION, ({ input, output, metric, runId, agentName }) => {
12
+ registerHook(AvailableHooks.ON_GENERATION, ({ input, output, metric, runId, agentName, instructions }) => {
14
13
  evaluate({
15
14
  agentName,
16
15
  input,
@@ -18,9 +17,21 @@ registerHook(AvailableHooks.ON_GENERATION, ({ input, output, metric, runId, agen
18
17
  output,
19
18
  runId,
20
19
  globalRunId: runId,
20
+ instructions,
21
21
  });
22
22
  });
23
23
 
24
24
  registerHook(AvailableHooks.ON_EVALUATION, async traceObject => {
25
- evalStore.push(traceObject);
25
+ if (mastra?.memory?.storage) {
26
+ await mastra.memory.storage.insert({
27
+ tableName: MastraStorage.TABLE_EVALS,
28
+ record: {
29
+ result: JSON.stringify(traceObject.result),
30
+ meta: JSON.stringify(traceObject.meta),
31
+ input: traceObject.input,
32
+ output: traceObject.output,
33
+ createdAt: new Date().toISOString(),
34
+ },
35
+ });
36
+ }
26
37
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mastra",
3
- "version": "0.2.0-alpha.153",
3
+ "version": "0.2.0-alpha.155",
4
4
  "license": "MIT",
5
5
  "description": "cli for mastra",
6
6
  "type": "module",
@@ -55,8 +55,8 @@
55
55
  "yocto-spinner": "^0.1.1",
56
56
  "zod": "^3.24.1",
57
57
  "zod-to-json-schema": "^3.24.1",
58
- "@mastra/core": "^0.2.0-alpha.96",
59
- "@mastra/deployer": "^0.1.0-alpha.45"
58
+ "@mastra/core": "^0.2.0-alpha.98",
59
+ "@mastra/deployer": "^0.1.0-alpha.47"
60
60
  },
61
61
  "devDependencies": {
62
62
  "@ai-sdk/openai": "^1.1.9",
@@ -75,7 +75,7 @@
75
75
  },
76
76
  "scripts": {
77
77
  "build": "npm-run-all --serial build:lib copy-starter-files copy-templates build:playground",
78
- "build:lib": "tsup-node --config tsup.config.js",
78
+ "build:lib": "tsup --config tsup.config.js",
79
79
  "build:watch": "pnpm run build:lib --watch --onSuccess \"pnpm run copy-starter-files && pnpm run copy-templates\"",
80
80
  "copy-starter-files": "cpy \"src/starter-files/**/*\" \"dist/starter-files\"",
81
81
  "copy-templates": "cpy \"src/templates/**/*\" \"dist/templates/\"",