mastracode 0.33.0-alpha.3 → 0.33.0-alpha.5
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/CHANGELOG.md +19 -0
- package/dist/cli.cjs +2 -2
- package/dist/cli.js +2 -2
- package/dist/tui/commands/browser.d.ts.map +1 -1
- package/dist/{tui-aAxigfCH.cjs → tui-BAjz-lln.cjs} +113 -11
- package/dist/tui-BAjz-lln.cjs.map +1 -0
- package/dist/{tui-CzFanVr8.js → tui-ciIVmFuD.js} +113 -11
- package/dist/{tui-CzFanVr8.js.map → tui-ciIVmFuD.js.map} +1 -1
- package/dist/tui.cjs +1 -1
- package/dist/tui.js +1 -1
- package/package.json +8 -8
- package/dist/tui-aAxigfCH.cjs.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# mastracode
|
|
2
2
|
|
|
3
|
+
## 0.33.0-alpha.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [[`6445eba`](https://github.com/mastra-ai/mastra/commit/6445eba6020abac681aba1cc9289f446cb400cbe), [`deaf0c4`](https://github.com/mastra-ai/mastra/commit/deaf0c4c38fe2e988a094c63bbd8899436f4e579), [`df31eb0`](https://github.com/mastra-ai/mastra/commit/df31eb0c7087d782a0d9346e467f9a4af4b0eef6), [`59866f2`](https://github.com/mastra-ai/mastra/commit/59866f2e0a7986bea3b418aaa2c2f79a77d33719), [`fcd0667`](https://github.com/mastra-ai/mastra/commit/fcd0667a4e378be35c9a1b1eb19cce78fbfd7282), [`bab06b1`](https://github.com/mastra-ai/mastra/commit/bab06b18923873a584bdfc71a6b4ec7fb4727fb7)]:
|
|
8
|
+
- @mastra/core@1.58.0-alpha.5
|
|
9
|
+
- @mastra/memory@1.26.1-alpha.3
|
|
10
|
+
- @mastra/libsql@1.20.0-alpha.1
|
|
11
|
+
- @mastra/pg@1.20.0-alpha.2
|
|
12
|
+
- @mastra/code-sdk@1.2.0-alpha.5
|
|
13
|
+
|
|
14
|
+
## 0.33.0-alpha.4
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- Updated dependencies [[`76e5132`](https://github.com/mastra-ai/mastra/commit/76e51328dbc0749c8304e6b3f21e4401f451b081), [`0282e16`](https://github.com/mastra-ai/mastra/commit/0282e16115538c8e9b248b90f0748eb01cb5dc98)]:
|
|
19
|
+
- @mastra/core@1.58.0-alpha.4
|
|
20
|
+
- @mastra/code-sdk@1.2.0-alpha.4
|
|
21
|
+
|
|
3
22
|
## 0.33.0-alpha.3
|
|
4
23
|
|
|
5
24
|
### Minor Changes
|
package/dist/cli.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
const require_tui = require("./tui-
|
|
2
|
+
const require_tui = require("./tui-BAjz-lln.cjs");
|
|
3
3
|
let _mastra_code_sdk = require("@mastra/code-sdk");
|
|
4
4
|
let fs = require("fs");
|
|
5
5
|
fs = require_tui.__toESM(fs, 1);
|
|
@@ -13,7 +13,7 @@ let _mastra_code_sdk_utils_stdin_pipe = require("@mastra/code-sdk/utils/stdin-pi
|
|
|
13
13
|
let _mastra_code_sdk_utils_thread_lock = require("@mastra/code-sdk/utils/thread-lock");
|
|
14
14
|
//#region src/version.ts
|
|
15
15
|
function getCurrentVersion() {
|
|
16
|
-
return "0.33.0-alpha.
|
|
16
|
+
return "0.33.0-alpha.5";
|
|
17
17
|
}
|
|
18
18
|
//#endregion
|
|
19
19
|
//#region src/main.ts
|
package/dist/cli.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { d as detectTerminalTheme, f as applyThemeMode, t as MastraTUI, v as restoreTerminalForeground } from "./tui-
|
|
2
|
+
import { d as detectTerminalTheme, f as applyThemeMode, t as MastraTUI, v as restoreTerminalForeground } from "./tui-ciIVmFuD.js";
|
|
3
3
|
import { createMastraCode } from "@mastra/code-sdk";
|
|
4
4
|
import fs from "fs";
|
|
5
5
|
import { createMastraCodeAnalytics } from "@mastra/code-sdk/analytics";
|
|
@@ -12,7 +12,7 @@ import { drainPipedStdin, reopenStdinFromTTY } from "@mastra/code-sdk/utils/stdi
|
|
|
12
12
|
import { releaseAllThreadLocks } from "@mastra/code-sdk/utils/thread-lock";
|
|
13
13
|
//#region src/version.ts
|
|
14
14
|
function getCurrentVersion() {
|
|
15
|
-
return "0.33.0-alpha.
|
|
15
|
+
return "0.33.0-alpha.5";
|
|
16
16
|
}
|
|
17
17
|
//#endregion
|
|
18
18
|
//#region src/main.ts
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../../../src/tui/commands/browser.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../../../src/tui/commands/browser.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAyMtD;;;;;;;GAOG;AACH,wBAAsB,oBAAoB,CAAC,GAAG,EAAE,mBAAmB,EAAE,IAAI,GAAE,MAAM,EAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CA0mBvG"}
|
|
@@ -68,6 +68,7 @@ let _mastra_code_sdk_onboarding_packs = require("@mastra/code-sdk/onboarding/pac
|
|
|
68
68
|
let _mastra_code_sdk_onboarding_custom_providers = require("@mastra/code-sdk/onboarding/custom-providers");
|
|
69
69
|
let _mastra_code_sdk_onboarding_om_settings = require("@mastra/code-sdk/onboarding/om-settings");
|
|
70
70
|
let fs_promises = require("fs/promises");
|
|
71
|
+
let _mastra_stagehand = require("@mastra/stagehand");
|
|
71
72
|
let _mastra_code_sdk_auth_index = require("@mastra/code-sdk/auth/index");
|
|
72
73
|
let _mastra_core_llm = require("@mastra/core/llm");
|
|
73
74
|
let _mastra_code_sdk_utils_project = require("@mastra/code-sdk/utils/project");
|
|
@@ -13472,9 +13473,72 @@ const ACTIVE_BROWSER_KEY = "activeBrowserSettings";
|
|
|
13472
13473
|
* /browser status - Show current browser configuration
|
|
13473
13474
|
* /browser on - Enable browser with current settings
|
|
13474
13475
|
* /browser off - Disable browser
|
|
13475
|
-
* /browser set <k> <v> - Set a specific setting (profile, executablePath, storageState, cdpUrl)
|
|
13476
|
+
* /browser set <k> <v> - Set a specific setting (profile, executablePath, storageState, cdpUrl, model)
|
|
13476
13477
|
*/
|
|
13477
13478
|
/**
|
|
13479
|
+
* Validate a `provider/model` id against the providers Stagehand can resolve.
|
|
13480
|
+
*
|
|
13481
|
+
* Stagehand splits the id on its first slash and throws during browser startup
|
|
13482
|
+
* if the prefix is not a provider it knows, so both halves are checked here
|
|
13483
|
+
* where the error can still be acted on.
|
|
13484
|
+
*
|
|
13485
|
+
* @returns an error message, or undefined when the id is usable.
|
|
13486
|
+
*/
|
|
13487
|
+
function stagehandModelError(modelId) {
|
|
13488
|
+
const slashIndex = modelId.indexOf("/");
|
|
13489
|
+
if (slashIndex <= 0 || slashIndex === modelId.length - 1) return `Invalid model: ${modelId}. Use <provider>/<model>, for example anthropic/claude-sonnet-4-5.`;
|
|
13490
|
+
const provider = modelId.slice(0, slashIndex);
|
|
13491
|
+
if (!_mastra_stagehand.STAGEHAND_MODEL_PROVIDERS.includes(provider)) return `Unsupported model provider: ${provider}. Supported providers: ${_mastra_stagehand.STAGEHAND_MODEL_PROVIDERS.join(", ")}.`;
|
|
13492
|
+
}
|
|
13493
|
+
/**
|
|
13494
|
+
* Open the shared model picker, restricted to providers Stagehand can resolve,
|
|
13495
|
+
* and persist the choice as the browser model.
|
|
13496
|
+
*/
|
|
13497
|
+
async function promptForStagehandModel(ctx, settings, browser) {
|
|
13498
|
+
if (browser.provider !== "stagehand") {
|
|
13499
|
+
ctx.showError("model is only supported by the stagehand provider.");
|
|
13500
|
+
return;
|
|
13501
|
+
}
|
|
13502
|
+
const supported = new Set(_mastra_stagehand.STAGEHAND_MODEL_PROVIDERS);
|
|
13503
|
+
const models = (await ctx.state.controller.listAvailableModels()).filter((m) => supported.has(m.provider));
|
|
13504
|
+
if (models.length === 0) {
|
|
13505
|
+
ctx.showError(`No models available for Stagehand. Supported providers: ${_mastra_stagehand.STAGEHAND_MODEL_PROVIDERS.join(", ")}.\nYou can also set one directly: /browser set model anthropic/claude-sonnet-4-5`);
|
|
13506
|
+
return;
|
|
13507
|
+
}
|
|
13508
|
+
await new Promise((resolve) => {
|
|
13509
|
+
const selector = new ModelSelectorComponent({
|
|
13510
|
+
tui: ctx.state.ui,
|
|
13511
|
+
models,
|
|
13512
|
+
currentModelId: browser.stagehand?.model,
|
|
13513
|
+
title: "Select Browser Model",
|
|
13514
|
+
onSelect: async (model) => {
|
|
13515
|
+
ctx.state.ui.hideOverlay();
|
|
13516
|
+
const error = stagehandModelError(model.id);
|
|
13517
|
+
if (error) {
|
|
13518
|
+
ctx.showError(error);
|
|
13519
|
+
resolve();
|
|
13520
|
+
return;
|
|
13521
|
+
}
|
|
13522
|
+
await promptForApiKeyIfNeeded(ctx.state.ui, model, ctx.authStorage);
|
|
13523
|
+
settings.browser.stagehand = {
|
|
13524
|
+
...settings.browser.stagehand,
|
|
13525
|
+
env: settings.browser.stagehand?.env ?? "LOCAL",
|
|
13526
|
+
model: model.id
|
|
13527
|
+
};
|
|
13528
|
+
(0, _mastra_code_sdk_onboarding_settings.saveSettings)(settings);
|
|
13529
|
+
ctx.showInfo(`Set model = ${model.id}\nRun /browser on to apply.`);
|
|
13530
|
+
resolve();
|
|
13531
|
+
},
|
|
13532
|
+
onCancel: () => {
|
|
13533
|
+
ctx.state.ui.hideOverlay();
|
|
13534
|
+
ctx.showInfo("Model selection cancelled.");
|
|
13535
|
+
resolve();
|
|
13536
|
+
}
|
|
13537
|
+
});
|
|
13538
|
+
ctx.state.ui.showOverlay(selector, { width: "60%" });
|
|
13539
|
+
});
|
|
13540
|
+
}
|
|
13541
|
+
/**
|
|
13478
13542
|
* Helper to show an inline question and return the answer.
|
|
13479
13543
|
*/
|
|
13480
13544
|
function askInline(ctx, question, options) {
|
|
@@ -13534,6 +13598,7 @@ function getBrowserConfigKey(settings) {
|
|
|
13534
13598
|
if (!settings.enabled) return "disabled";
|
|
13535
13599
|
const parts = [settings.provider];
|
|
13536
13600
|
if (settings.provider === "stagehand" && settings.stagehand?.env) parts.push(settings.stagehand.env);
|
|
13601
|
+
if (settings.provider === "stagehand" && settings.stagehand?.model) parts.push(`model:${settings.stagehand.model}`);
|
|
13537
13602
|
parts.push(settings.headless ? "headless" : "headed");
|
|
13538
13603
|
if (settings.profile) parts.push(`profile:${settings.profile}`);
|
|
13539
13604
|
if (settings.executablePath) parts.push(`exec:${settings.executablePath}`);
|
|
@@ -13557,19 +13622,24 @@ async function handleBrowserCommand(ctx, args = []) {
|
|
|
13557
13622
|
const key = args[1]?.toLowerCase();
|
|
13558
13623
|
const value = args.slice(2).join(" ");
|
|
13559
13624
|
if (!key) {
|
|
13560
|
-
ctx.showInfo("Usage: /browser set <key> <value>\n\nKeys:\n profile <path> - Browser profile directory\n executablePath <path> - Browser executable path\n storageState <path> - Playwright storage state file (agent-browser only)\n cdpUrl <url> - CDP WebSocket URL\n\nTo remove a setting, use: /browser clear <key>\n\nExamples:\n /browser set profile ~/.mastracode/browser-profile-stagehand\n /browser set executablePath /Applications/Google Chrome.app/Contents/MacOS/Google Chrome");
|
|
13625
|
+
ctx.showInfo("Usage: /browser set <key> <value>\n\nKeys:\n profile <path> - Browser profile directory\n executablePath <path> - Browser executable path\n storageState <path> - Playwright storage state file (agent-browser only)\n cdpUrl <url> - CDP WebSocket URL\n model [provider/id] - Model Stagehand uses for AI operations (stagehand only).\n Omit the value to pick from a list.\n\nTo remove a setting, use: /browser clear <key>\n\nExamples:\n /browser set profile ~/.mastracode/browser-profile-stagehand\n /browser set model\n /browser set model anthropic/claude-sonnet-4-5\n /browser set executablePath /Applications/Google Chrome.app/Contents/MacOS/Google Chrome");
|
|
13561
13626
|
return;
|
|
13562
13627
|
}
|
|
13563
13628
|
if (![
|
|
13564
13629
|
"profile",
|
|
13565
13630
|
"executablepath",
|
|
13566
13631
|
"storagestate",
|
|
13567
|
-
"cdpurl"
|
|
13632
|
+
"cdpurl",
|
|
13633
|
+
"model"
|
|
13568
13634
|
].includes(key)) {
|
|
13569
|
-
ctx.showError(`Unknown key: ${args[1]}. Valid keys: profile, executablePath, storageState, cdpUrl`);
|
|
13635
|
+
ctx.showError(`Unknown key: ${args[1]}. Valid keys: profile, executablePath, storageState, cdpUrl, model`);
|
|
13570
13636
|
return;
|
|
13571
13637
|
}
|
|
13572
13638
|
if (!value) {
|
|
13639
|
+
if (key === "model") {
|
|
13640
|
+
await promptForStagehandModel(ctx, settings, browser);
|
|
13641
|
+
return;
|
|
13642
|
+
}
|
|
13573
13643
|
ctx.showError(`Missing value. Use: /browser set ${args[1]} <value>\nTo remove a setting, use: /browser clear ${args[1]}`);
|
|
13574
13644
|
return;
|
|
13575
13645
|
}
|
|
@@ -13604,6 +13674,26 @@ async function handleBrowserCommand(ctx, args = []) {
|
|
|
13604
13674
|
storageState: expandedValue
|
|
13605
13675
|
};
|
|
13606
13676
|
break;
|
|
13677
|
+
case "model": {
|
|
13678
|
+
if (browser.provider !== "stagehand") {
|
|
13679
|
+
ctx.showError("model is only supported by the stagehand provider.");
|
|
13680
|
+
return;
|
|
13681
|
+
}
|
|
13682
|
+
const modelId = value.trim();
|
|
13683
|
+
const modelError = stagehandModelError(modelId);
|
|
13684
|
+
if (modelError) {
|
|
13685
|
+
ctx.showError(modelError);
|
|
13686
|
+
return;
|
|
13687
|
+
}
|
|
13688
|
+
settings.browser.stagehand = {
|
|
13689
|
+
...settings.browser.stagehand,
|
|
13690
|
+
env: settings.browser.stagehand?.env ?? "LOCAL",
|
|
13691
|
+
model: modelId
|
|
13692
|
+
};
|
|
13693
|
+
(0, _mastra_code_sdk_onboarding_settings.saveSettings)(settings);
|
|
13694
|
+
ctx.showInfo(`Set model = ${modelId}\nRun /browser on to apply.`);
|
|
13695
|
+
return;
|
|
13696
|
+
}
|
|
13607
13697
|
case "cdpurl":
|
|
13608
13698
|
settings.browser.cdpUrl = expandedValue;
|
|
13609
13699
|
if (settings.browser.profile || settings.browser.executablePath) {
|
|
@@ -13627,7 +13717,10 @@ async function handleBrowserCommand(ctx, args = []) {
|
|
|
13627
13717
|
const activeIsBrowserbase = activeSettings.provider === "stagehand" && activeSettings.stagehand?.env === "BROWSERBASE";
|
|
13628
13718
|
lines.push("Browser (active):");
|
|
13629
13719
|
lines.push(` Provider: ${activeProvider}`);
|
|
13630
|
-
if (activeSettings.provider === "stagehand" && activeSettings.stagehand)
|
|
13720
|
+
if (activeSettings.provider === "stagehand" && activeSettings.stagehand) {
|
|
13721
|
+
lines.push(` Environment: ${activeSettings.stagehand.env}`);
|
|
13722
|
+
if (activeSettings.stagehand.model) lines.push(` Model: ${activeSettings.stagehand.model}`);
|
|
13723
|
+
}
|
|
13631
13724
|
if (!activeIsBrowserbase) lines.push(` Headless: ${activeSettings.headless ? "yes" : "no"}`);
|
|
13632
13725
|
if (activeSettings.executablePath) lines.push(` Executable: ${activeSettings.executablePath}`);
|
|
13633
13726
|
if (activeSettings.profile) lines.push(` Profile: ${activeSettings.profile}`);
|
|
@@ -13638,7 +13731,10 @@ async function handleBrowserCommand(ctx, args = []) {
|
|
|
13638
13731
|
const fileIsBrowserbase = browser.provider === "stagehand" && browser.stagehand?.env === "BROWSERBASE";
|
|
13639
13732
|
lines.push("Pending changes (not yet applied):");
|
|
13640
13733
|
lines.push(` Provider: ${fileProvider}`);
|
|
13641
|
-
if (browser.provider === "stagehand" && browser.stagehand)
|
|
13734
|
+
if (browser.provider === "stagehand" && browser.stagehand) {
|
|
13735
|
+
lines.push(` Environment: ${browser.stagehand.env}`);
|
|
13736
|
+
if (browser.stagehand.model) lines.push(` Model: ${browser.stagehand.model}`);
|
|
13737
|
+
}
|
|
13642
13738
|
if (!fileIsBrowserbase) lines.push(` Headless: ${browser.headless ? "yes" : "no"}`);
|
|
13643
13739
|
if (browser.executablePath) lines.push(` Executable: ${browser.executablePath}`);
|
|
13644
13740
|
if (browser.profile) lines.push(` Profile: ${browser.profile}`);
|
|
@@ -13652,7 +13748,10 @@ async function handleBrowserCommand(ctx, args = []) {
|
|
|
13652
13748
|
const providerLabel = browser.provider === "stagehand" ? "Stagehand (AI-powered)" : "AgentBrowser (deterministic)";
|
|
13653
13749
|
const isBrowserbase = browser.provider === "stagehand" && browser.stagehand?.env === "BROWSERBASE";
|
|
13654
13750
|
const lines = [`Browser: enabled`, ` Provider: ${providerLabel}`];
|
|
13655
|
-
if (browser.provider === "stagehand" && browser.stagehand)
|
|
13751
|
+
if (browser.provider === "stagehand" && browser.stagehand) {
|
|
13752
|
+
lines.push(` Environment: ${browser.stagehand.env}`);
|
|
13753
|
+
if (browser.stagehand.model) lines.push(` Model: ${browser.stagehand.model}`);
|
|
13754
|
+
}
|
|
13656
13755
|
if (!isBrowserbase) lines.push(` Headless: ${browser.headless ? "yes" : "no"}`);
|
|
13657
13756
|
if (browser.executablePath) lines.push(` Executable: ${browser.executablePath}`);
|
|
13658
13757
|
if (browser.profile) lines.push(` Profile: ${browser.profile}`);
|
|
@@ -13735,8 +13834,11 @@ async function handleBrowserCommand(ctx, args = []) {
|
|
|
13735
13834
|
case "cdpurl":
|
|
13736
13835
|
delete settings.browser.cdpUrl;
|
|
13737
13836
|
break;
|
|
13837
|
+
case "model":
|
|
13838
|
+
if (settings.browser.stagehand) delete settings.browser.stagehand.model;
|
|
13839
|
+
break;
|
|
13738
13840
|
default:
|
|
13739
|
-
ctx.showError(`Unknown field: ${field}. Valid fields: profile, executablePath, storageState, cdpUrl`);
|
|
13841
|
+
ctx.showError(`Unknown field: ${field}. Valid fields: profile, executablePath, storageState, cdpUrl, model`);
|
|
13740
13842
|
return;
|
|
13741
13843
|
}
|
|
13742
13844
|
(0, _mastra_code_sdk_onboarding_settings.saveSettings)(settings);
|
|
@@ -13799,8 +13901,8 @@ async function handleBrowserCommand(ctx, args = []) {
|
|
|
13799
13901
|
" off, disable Disable browser",
|
|
13800
13902
|
" status Show current configuration",
|
|
13801
13903
|
" clear Reset all settings to defaults",
|
|
13802
|
-
" clear <key> Clear: profile, executablePath, storageState, cdpUrl",
|
|
13803
|
-
" set <key> <v> Set: profile, executablePath, storageState, cdpUrl",
|
|
13904
|
+
" clear <key> Clear: profile, executablePath, storageState, cdpUrl, model",
|
|
13905
|
+
" set <key> <v> Set: profile, executablePath, storageState, cdpUrl, model",
|
|
13804
13906
|
" export storageState <path> Export session cookies/localStorage (agent-browser)"
|
|
13805
13907
|
].join("\n"));
|
|
13806
13908
|
return;
|
|
@@ -22064,4 +22166,4 @@ Object.defineProperty(exports, "theme", {
|
|
|
22064
22166
|
}
|
|
22065
22167
|
});
|
|
22066
22168
|
|
|
22067
|
-
//# sourceMappingURL=tui-
|
|
22169
|
+
//# sourceMappingURL=tui-BAjz-lln.cjs.map
|