mastra 0.10.6-alpha.4 → 0.10.6-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.
- package/dist/{chunk-25NEZQOD.js → chunk-DKHFKQWY.js} +1 -1
- package/dist/commands/create/create.js +1 -1
- package/dist/index.js +17 -73
- package/package.json +6 -6
- package/src/playground/dist/assets/{index-BFCcRzj1.js → index-IrzYc-uV.js} +1 -1
- package/src/playground/dist/assets/{index-BWk7-Ap1.js → index-RjmNiQs6.js} +231 -231
- package/src/playground/dist/assets/{index-BOflxKlK.js → index-pJaVMfg5.js} +1 -1
- package/src/playground/dist/index.html +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
export { create } from '../../chunk-
|
|
1
|
+
export { create } from '../../chunk-DKHFKQWY.js';
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#! /usr/bin/env node
|
|
2
2
|
import { PosthogAnalytics } from './chunk-7OXWUU2Q.js';
|
|
3
3
|
export { PosthogAnalytics } from './chunk-7OXWUU2Q.js';
|
|
4
|
-
import { DepsService, create, checkPkgJson, checkAndInstallCoreDeps, interactivePrompt, init, logger, FileService } from './chunk-
|
|
5
|
-
export { create } from './chunk-
|
|
4
|
+
import { DepsService, create, checkPkgJson, checkAndInstallCoreDeps, interactivePrompt, init, logger, FileService } from './chunk-DKHFKQWY.js';
|
|
5
|
+
export { create } from './chunk-DKHFKQWY.js';
|
|
6
6
|
import { Command } from 'commander';
|
|
7
7
|
import { config } from 'dotenv';
|
|
8
8
|
import { join, dirname } from 'path';
|
|
@@ -12,13 +12,12 @@ import { getDeployer, FileService as FileService$1 } from '@mastra/deployer';
|
|
|
12
12
|
import { isWebContainer } from '@webcontainer/env';
|
|
13
13
|
import { execa } from 'execa';
|
|
14
14
|
import getPort from 'get-port';
|
|
15
|
-
import { spawn, exec } from 'child_process';
|
|
16
|
-
import { fileURLToPath } from 'url';
|
|
17
|
-
import open from 'open';
|
|
18
15
|
import { writeFile } from 'fs/promises';
|
|
16
|
+
import { fileURLToPath } from 'url';
|
|
19
17
|
import * as fsExtra from 'fs-extra';
|
|
20
18
|
import fs, { readFileSync } from 'fs';
|
|
21
19
|
import stripJsonComments from 'strip-json-comments';
|
|
20
|
+
import { spawn } from 'child_process';
|
|
22
21
|
|
|
23
22
|
var BuildBundler = class extends Bundler {
|
|
24
23
|
customEnvFile;
|
|
@@ -122,6 +121,7 @@ async function build({
|
|
|
122
121
|
const platformDeployer = await getDeployer(mastraEntryFile, outputDirectory);
|
|
123
122
|
if (!platformDeployer) {
|
|
124
123
|
const deployer = new BuildBundler(env);
|
|
124
|
+
deployer.__setLogger(logger);
|
|
125
125
|
await deployer.prepare(outputDirectory);
|
|
126
126
|
await deployer.bundle(mastraEntryFile, outputDirectory, discoveredTools);
|
|
127
127
|
logger.info(`Build successful, you can now deploy the .mastra/output directory to your target platform.`);
|
|
@@ -131,6 +131,7 @@ async function build({
|
|
|
131
131
|
return;
|
|
132
132
|
}
|
|
133
133
|
logger.info("Deployer found, preparing deployer build...");
|
|
134
|
+
platformDeployer.__setLogger(logger);
|
|
134
135
|
await platformDeployer.prepare(outputDirectory);
|
|
135
136
|
await platformDeployer.bundle(mastraEntryFile, outputDirectory, discoveredTools);
|
|
136
137
|
logger.info("You can now deploy the .mastra/output directory to your target platform.");
|
|
@@ -172,69 +173,6 @@ async function deploy({ dir: dir2 }) {
|
|
|
172
173
|
logger.warn("No deployer found.");
|
|
173
174
|
}
|
|
174
175
|
}
|
|
175
|
-
function openBrowser(url, opt) {
|
|
176
|
-
const browser = process.env.BROWSER || "";
|
|
177
|
-
if (browser.toLowerCase() !== "none") {
|
|
178
|
-
const browserArgs = process.env.BROWSER_ARGS ? process.env.BROWSER_ARGS.split(" ") : [];
|
|
179
|
-
void startBrowserProcess(browser, browserArgs, url);
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
var supportedChromiumBrowsers = [
|
|
183
|
-
"Google Chrome Canary",
|
|
184
|
-
"Google Chrome Dev",
|
|
185
|
-
"Google Chrome Beta",
|
|
186
|
-
"Google Chrome",
|
|
187
|
-
"Microsoft Edge",
|
|
188
|
-
"Brave Browser",
|
|
189
|
-
"Vivaldi",
|
|
190
|
-
"Chromium",
|
|
191
|
-
"Arc"
|
|
192
|
-
];
|
|
193
|
-
async function startBrowserProcess(browser, browserArgs, url) {
|
|
194
|
-
const preferredOSXBrowser = browser === "google chrome" ? "Google Chrome" : browser;
|
|
195
|
-
const shouldTryOpenChromeWithAppleScript = process.platform === "darwin" && (!preferredOSXBrowser || supportedChromiumBrowsers.includes(preferredOSXBrowser));
|
|
196
|
-
if (shouldTryOpenChromeWithAppleScript) {
|
|
197
|
-
try {
|
|
198
|
-
const ps = await execAsync("ps cax");
|
|
199
|
-
const openedBrowser = preferredOSXBrowser && ps.includes(preferredOSXBrowser) ? preferredOSXBrowser : supportedChromiumBrowsers.find((b) => ps.includes(b));
|
|
200
|
-
if (openedBrowser) {
|
|
201
|
-
const packageDir = dirname(fileURLToPath(import.meta.resolve("mastra/package.json")));
|
|
202
|
-
await execAsync(`osascript openChrome.applescript "${url}" "${openedBrowser}"`, {
|
|
203
|
-
cwd: join(packageDir, "bin")
|
|
204
|
-
});
|
|
205
|
-
return true;
|
|
206
|
-
}
|
|
207
|
-
} catch {
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
if (process.platform === "darwin" && browser === "open") {
|
|
211
|
-
browser = void 0;
|
|
212
|
-
}
|
|
213
|
-
try {
|
|
214
|
-
const options = browser ? { app: { name: browser, arguments: browserArgs } } : {};
|
|
215
|
-
new Promise((_, reject) => {
|
|
216
|
-
open(url, options).then((subprocess) => {
|
|
217
|
-
subprocess.on("error", reject);
|
|
218
|
-
}).catch(reject);
|
|
219
|
-
}).catch((err) => {
|
|
220
|
-
console.error(err.stack || err.message);
|
|
221
|
-
});
|
|
222
|
-
return true;
|
|
223
|
-
} catch {
|
|
224
|
-
return false;
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
function execAsync(command, options) {
|
|
228
|
-
return new Promise((resolve, reject) => {
|
|
229
|
-
exec(command, options, (error, stdout) => {
|
|
230
|
-
if (error) {
|
|
231
|
-
reject(error);
|
|
232
|
-
} else {
|
|
233
|
-
resolve(stdout.toString());
|
|
234
|
-
}
|
|
235
|
-
});
|
|
236
|
-
});
|
|
237
|
-
}
|
|
238
176
|
var DevBundler = class extends Bundler {
|
|
239
177
|
customEnvFile;
|
|
240
178
|
constructor(customEnvFile) {
|
|
@@ -282,6 +220,16 @@ var DevBundler = class extends Bundler {
|
|
|
282
220
|
const watcher = await createWatcher(
|
|
283
221
|
{
|
|
284
222
|
...inputOptions,
|
|
223
|
+
logLevel: inputOptions.logLevel === "silent" ? "warn" : inputOptions.logLevel,
|
|
224
|
+
onwarn: (warning) => {
|
|
225
|
+
if (warning.code === "CIRCULAR_DEPENDENCY") {
|
|
226
|
+
if (warning.ids?.[0]?.includes("node_modules")) {
|
|
227
|
+
return;
|
|
228
|
+
}
|
|
229
|
+
this.logger.warn(`Circular dependency found:
|
|
230
|
+
${warning.message.replace("Circular dependency: ", "")}`);
|
|
231
|
+
}
|
|
232
|
+
},
|
|
285
233
|
plugins: [
|
|
286
234
|
// @ts-ignore - types are good
|
|
287
235
|
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
|
@@ -346,7 +294,6 @@ var DevBundler = class extends Bundler {
|
|
|
346
294
|
// src/commands/dev/dev.ts
|
|
347
295
|
var currentServerProcess;
|
|
348
296
|
var isRestarting = false;
|
|
349
|
-
var isInitialServerStart = true;
|
|
350
297
|
var ON_ERROR_MAX_RESTARTS = 3;
|
|
351
298
|
var startServer = async (dotMastraPath, port, env, errorRestartCount = 0) => {
|
|
352
299
|
let serverIsReady = false;
|
|
@@ -381,10 +328,6 @@ var startServer = async (dotMastraPath, port, env, errorRestartCount = 0) => {
|
|
|
381
328
|
currentServerProcess.on("message", async (message) => {
|
|
382
329
|
if (message?.type === "server-ready") {
|
|
383
330
|
serverIsReady = true;
|
|
384
|
-
if (isInitialServerStart) {
|
|
385
|
-
isInitialServerStart = false;
|
|
386
|
-
void openBrowser(`http://localhost:${port}`, true);
|
|
387
|
-
}
|
|
388
331
|
try {
|
|
389
332
|
await fetch(`http://localhost:${port}/__refresh`, {
|
|
390
333
|
method: "POST",
|
|
@@ -459,6 +402,7 @@ async function dev({
|
|
|
459
402
|
const fileService = new FileService$1();
|
|
460
403
|
const entryFile = fileService.getFirstExistingFile([join(mastraDir, "index.ts"), join(mastraDir, "index.js")]);
|
|
461
404
|
const bundler = new DevBundler(env);
|
|
405
|
+
bundler.__setLogger(logger);
|
|
462
406
|
await bundler.prepare(dotMastraPath);
|
|
463
407
|
const watcher = await bundler.watch(entryFile, dotMastraPath, discoveredTools);
|
|
464
408
|
const loadedEnv = await bundler.loadEnvVars();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mastra",
|
|
3
|
-
"version": "0.10.6-alpha.
|
|
3
|
+
"version": "0.10.6-alpha.7",
|
|
4
4
|
"license": "Elastic-2.0",
|
|
5
5
|
"description": "cli for mastra",
|
|
6
6
|
"type": "module",
|
|
@@ -58,9 +58,9 @@
|
|
|
58
58
|
"yocto-spinner": "^0.2.3",
|
|
59
59
|
"zod": "^3.25.57",
|
|
60
60
|
"zod-to-json-schema": "^3.24.5",
|
|
61
|
-
"@mastra/deployer": "^0.10.6-alpha.
|
|
61
|
+
"@mastra/deployer": "^0.10.6-alpha.5",
|
|
62
62
|
"@mastra/loggers": "^0.10.2",
|
|
63
|
-
"@mastra/mcp": "^0.10.4-alpha.
|
|
63
|
+
"@mastra/mcp": "^0.10.4-alpha.1"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
66
66
|
"@microsoft/api-extractor": "^7.52.8",
|
|
@@ -78,10 +78,10 @@
|
|
|
78
78
|
"type-fest": "^4.41.0",
|
|
79
79
|
"typescript": "^5.8.3",
|
|
80
80
|
"vitest": "^3.2.3",
|
|
81
|
+
"@mastra/client-js": "0.10.5-alpha.5",
|
|
82
|
+
"@mastra/core": "0.10.6-alpha.5",
|
|
81
83
|
"@internal/lint": "0.0.12",
|
|
82
|
-
"@mastra/
|
|
83
|
-
"@mastra/playground-ui": "5.1.6-alpha.3",
|
|
84
|
-
"@mastra/core": "0.10.6-alpha.3"
|
|
84
|
+
"@mastra/playground-ui": "5.1.6-alpha.5"
|
|
85
85
|
},
|
|
86
86
|
"peerDependencies": {
|
|
87
87
|
"@mastra/core": "^0.10.2-alpha.0"
|