mastra 0.10.1-alpha.1 → 0.10.1-alpha.2

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.
package/dist/index.js CHANGED
@@ -102,7 +102,7 @@ async function build({ dir: dir2, tools, root }) {
102
102
  const rootDir = root || process.cwd();
103
103
  const mastraDir = dir2 ? dir2.startsWith("/") ? dir2 : join$1(rootDir, dir2) : join$1(rootDir, "src", "mastra");
104
104
  const outputDirectory = join$1(rootDir, ".mastra");
105
- const defaultToolsPath = join$1(mastraDir, "tools");
105
+ const defaultToolsPath = join$1(mastraDir, "tools/**/*");
106
106
  const discoveredTools = [defaultToolsPath, ...tools ?? []];
107
107
  try {
108
108
  const fs = new FileService();
@@ -262,6 +262,8 @@ var DevBundler = class extends Bundler {
262
262
  // src/commands/dev/dev.ts
263
263
  var currentServerProcess;
264
264
  var isRestarting = false;
265
+ var restartCount = 0;
266
+ var MAX_RESTARTS = 3;
265
267
  var startServer = async (dotMastraPath, port, env) => {
266
268
  try {
267
269
  logger.info("[Mastra Dev] - Starting server...");
@@ -283,11 +285,30 @@ var startServer = async (dotMastraPath, port, env) => {
283
285
  stdio: "inherit",
284
286
  reject: false
285
287
  });
288
+ currentServerProcess.on("close", (code) => {
289
+ if (!code) {
290
+ restartCount++;
291
+ if (restartCount > MAX_RESTARTS) {
292
+ logger.error(`Server failed to start after ${MAX_RESTARTS} attempts. Giving up.`);
293
+ process.exit(1);
294
+ }
295
+ logger.error(
296
+ `Server exited with code ${code}, attempting to restart... (Attempt ${restartCount}/${MAX_RESTARTS})`
297
+ );
298
+ setTimeout(() => {
299
+ if (!isRestarting) {
300
+ startServer(dotMastraPath, port, env);
301
+ }
302
+ }, 1e3);
303
+ }
304
+ });
286
305
  if (currentServerProcess?.exitCode && currentServerProcess?.exitCode !== 0) {
287
306
  if (!currentServerProcess) {
288
307
  throw new Error(`Server failed to start`);
289
308
  }
290
- throw new Error(`Server failed to start with error: ${currentServerProcess.stderr}`);
309
+ throw new Error(
310
+ `Server failed to start with error: ${currentServerProcess.stderr || currentServerProcess.stdout}`
311
+ );
291
312
  }
292
313
  await new Promise((resolve) => setTimeout(resolve, 1e3));
293
314
  try {
@@ -317,6 +338,17 @@ var startServer = async (dotMastraPath, port, env) => {
317
338
  const execaError = err;
318
339
  if (execaError.stderr) logger.error("Server error output:", { stderr: execaError.stderr });
319
340
  if (execaError.stdout) logger.debug("Server output:", { stdout: execaError.stdout });
341
+ setTimeout(() => {
342
+ if (!isRestarting) {
343
+ restartCount++;
344
+ if (restartCount > MAX_RESTARTS) {
345
+ logger.error(`Server failed to start after ${MAX_RESTARTS} attempts. Giving up.`);
346
+ process.exit(1);
347
+ }
348
+ logger.error(`Attempting to restart server... (Attempt ${restartCount}/${MAX_RESTARTS})`);
349
+ startServer(dotMastraPath, port, env);
350
+ }
351
+ }, 1e3);
320
352
  }
321
353
  };
322
354
  async function rebundleAndRestart(dotMastraPath, port, bundler) {
@@ -341,10 +373,11 @@ async function dev({
341
373
  root,
342
374
  tools
343
375
  }) {
376
+ restartCount = 0;
344
377
  const rootDir = root || process.cwd();
345
378
  const mastraDir = dir2 ? dir2.startsWith("/") ? dir2 : join(process.cwd(), dir2) : join(process.cwd(), "src", "mastra");
346
379
  const dotMastraPath = join(rootDir, ".mastra");
347
- const defaultToolsPath = join(mastraDir, "tools");
380
+ const defaultToolsPath = join(mastraDir, "tools/**/*");
348
381
  const discoveredTools = [defaultToolsPath, ...tools || []];
349
382
  const fileService = new FileService$1();
350
383
  const entryFile = fileService.getFirstExistingFile([join(mastraDir, "index.ts"), join(mastraDir, "index.js")]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mastra",
3
- "version": "0.10.1-alpha.1",
3
+ "version": "0.10.1-alpha.2",
4
4
  "license": "Elastic-2.0",
5
5
  "description": "cli for mastra",
6
6
  "type": "module",
@@ -56,9 +56,9 @@
56
56
  "yocto-spinner": "^0.1.2",
57
57
  "zod": "^3.24.3",
58
58
  "zod-to-json-schema": "^3.24.5",
59
- "@mastra/deployer": "^0.10.1-alpha.0",
59
+ "@mastra/deployer": "^0.10.1-alpha.1",
60
60
  "@mastra/loggers": "^0.10.0",
61
- "@mastra/mcp": "^0.10.0"
61
+ "@mastra/mcp": "^0.10.1-alpha.0"
62
62
  },
63
63
  "devDependencies": {
64
64
  "@microsoft/api-extractor": "^7.52.5",
@@ -77,9 +77,9 @@
77
77
  "typescript": "^5.8.2",
78
78
  "vitest": "^3.1.2",
79
79
  "@internal/lint": "0.0.6",
80
- "@mastra/client-js": "0.10.1-alpha.0",
81
- "@mastra/playground-ui": "5.1.1-alpha.1",
82
- "@mastra/core": "0.10.1-alpha.0"
80
+ "@mastra/client-js": "0.10.1-alpha.1",
81
+ "@mastra/playground-ui": "5.1.1-alpha.2",
82
+ "@mastra/core": "0.10.1-alpha.1"
83
83
  },
84
84
  "peerDependencies": {
85
85
  "@mastra/core": "^0.10.0"