mastracode 0.42.2-alpha.0 → 0.42.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.
@@ -1,5 +1,5 @@
1
1
  import fs, { existsSync, readFileSync, statSync, unlinkSync } from "fs";
2
- import { MASTRA_GATEWAY_DEFAULT_URL, MASTRA_GATEWAY_PROVIDER, OBSERVABILITY_AUTH_PREFIX, THREAD_ACTIVE_MODEL_PACK_ID_KEY, THREAD_FALLBACK_STATUS_KEY, VIEWPORT_PRESETS, checkProfileProviderMismatch, createBrowserFromSettings, getCustomProviderId, loadSettings, migrateAccountPreferences, parseThreadSettings, parseViewportInput, pruneRemovedAccountPreferences, resolveDefaultThinkingLevel, resolveModePackModels, resolveThreadActiveModelPackId, saveSettings, setProfileProvider, stripMastraCodeCustomProviderPrefix, toCustomProviderModelId } from "@mastra/code-sdk/onboarding/settings";
2
+ import { MASTRA_GATEWAY_DEFAULT_URL, MASTRA_GATEWAY_PROVIDER, OBSERVABILITY_AUTH_PREFIX, THREAD_ACTIVE_MODEL_PACK_ID_KEY, THREAD_FALLBACK_STATUS_KEY, VIEWPORT_PRESETS, checkProfileProviderMismatch, createBrowserFromSettings, getCustomProviderId, loadSettings, migrateAccountPreferences, parseThreadSettings, parseViewportInput, pruneRemovedAccountPreferences, resolveDefaultThinkingLevel, resolveModePackModels, resolveStagehandModel, resolveThreadActiveModelPackId, saveSettings, setProfileProvider, stripMastraCodeCustomProviderPrefix, toActiveBrowserSettings, toCustomProviderModelId } from "@mastra/code-sdk/onboarding/settings";
3
3
  import { ThreadLockError } from "@mastra/code-sdk/utils/thread-lock";
4
4
  import { mastraBrand } from "@mastra/code-sdk/theme-palette";
5
5
  import chalk from "chalk";
@@ -47,6 +47,7 @@ import { removeCustomPackFromSettings } from "@mastra/code-sdk/onboarding/custom
47
47
  import { removeCustomProviderFromSettings, upsertCustomProviderInSettings } from "@mastra/code-sdk/onboarding/custom-providers";
48
48
  import { applyOMDefaultIfUnconfigured, applyOmRoleOverride, persistOmObserveAttachments } from "@mastra/code-sdk/onboarding/om-settings";
49
49
  import { access, mkdir, mkdtemp, readFile, rm, stat, writeFile } from "fs/promises";
50
+ import { remapOpenAIModelForCodexOAuth } from "@mastra/code-sdk/providers/model-ids";
50
51
  import { STAGEHAND_MODEL_PROVIDERS } from "@mastra/stagehand";
51
52
  import { getOAuthProviders as getOAuthProviders$1 } from "@mastra/code-sdk/auth/index";
52
53
  import { GatewayRegistry } from "@mastra/core/llm";
@@ -5656,12 +5657,27 @@ function getDecisionText(decision) {
5656
5657
  //#endregion
5657
5658
  //#region src/tui/components/notification-summary.ts
5658
5659
  var NotificationSummaryComponent = class extends Container {
5660
+ options;
5661
+ quietDisplayMode;
5659
5662
  constructor(options) {
5660
5663
  super();
5661
- const title = chalk.hex(mastra.orange).bold(`Notification summary: ${options.pending} pending`);
5662
- this.addChild(new Text(title, 0, 0));
5664
+ this.options = options;
5665
+ this.quietDisplayMode = options.quietDisplayMode ?? "normal";
5666
+ this.rebuild();
5667
+ }
5668
+ setQuietModeDisplay(mode) {
5669
+ if (this.quietDisplayMode === mode) return;
5670
+ this.quietDisplayMode = mode;
5671
+ this.rebuild();
5672
+ }
5673
+ rebuild() {
5674
+ this.clear();
5675
+ const { options } = this;
5663
5676
  const message = Object.entries(options.bySource).sort(([a], [b]) => a.localeCompare(b)).map(([source, count]) => `${source}: ${count}`).join(", ") || options.message.trim();
5677
+ const title = `Notification summary: ${options.pending} pending`;
5678
+ this.addChild(new Text(chalk.hex(mastra.orange).bold(title), 0, 0));
5664
5679
  if (message) this.addChild(new Text(theme.fg("dim", message), 2, 0));
5680
+ if (this.quietDisplayMode === "quiet") return;
5665
5681
  this.addChild(new Text(theme.fg("dim", "Use notification_inbox to inspect pending notifications."), 2, 0));
5666
5682
  }
5667
5683
  getChatSpacingKind() {
@@ -5670,6 +5686,9 @@ var NotificationSummaryComponent = class extends Container {
5670
5686
  };
5671
5687
  //#endregion
5672
5688
  //#region src/tui/components/notification.ts
5689
+ function normalizeQuietPreviewLineLimit(limit) {
5690
+ return Math.min(8, Math.max(0, Math.floor(Number.isFinite(limit) ? limit : 2)));
5691
+ }
5673
5692
  function priorityColor(priority) {
5674
5693
  if (priority === "urgent" || priority === "high") return mastra.orange;
5675
5694
  if (priority === "medium") return mastra.blue;
@@ -5715,10 +5734,25 @@ function wrapText(value, maxWidth) {
5715
5734
  }
5716
5735
  var NotificationComponent = class extends WidthAwareContainer {
5717
5736
  options;
5737
+ quietDisplayMode;
5738
+ quietPreviewLineLimit;
5718
5739
  expanded = false;
5719
5740
  constructor(options) {
5720
5741
  super();
5721
5742
  this.options = options;
5743
+ this.quietDisplayMode = options.quietDisplayMode ?? "normal";
5744
+ this.quietPreviewLineLimit = normalizeQuietPreviewLineLimit(options.quietPreviewLineLimit);
5745
+ }
5746
+ setQuietModeDisplay(mode) {
5747
+ if (this.quietDisplayMode === mode) return;
5748
+ this.quietDisplayMode = mode;
5749
+ this.rebuild();
5750
+ }
5751
+ setQuietPreviewLineLimit(limit) {
5752
+ const normalized = normalizeQuietPreviewLineLimit(limit);
5753
+ if (this.quietPreviewLineLimit === normalized) return;
5754
+ this.quietPreviewLineLimit = normalized;
5755
+ this.rebuild();
5722
5756
  }
5723
5757
  setExpanded(expanded) {
5724
5758
  this.expanded = expanded;
@@ -5727,6 +5761,7 @@ var NotificationComponent = class extends WidthAwareContainer {
5727
5761
  rebuildForWidth(width) {
5728
5762
  this.clear();
5729
5763
  const options = this.options;
5764
+ const quiet = this.quietDisplayMode === "quiet" && !this.expanded;
5730
5765
  if (options.backgroundCompletion && !this.expanded) {
5731
5766
  const completion = options.backgroundCompletion;
5732
5767
  const failed = options.status === "failed";
@@ -5739,7 +5774,7 @@ var NotificationComponent = class extends WidthAwareContainer {
5739
5774
  return;
5740
5775
  }
5741
5776
  const titleText = options.source ? `notification from ${options.source}` : "notification";
5742
- const details = [
5777
+ const details = quiet ? "" : [
5743
5778
  options.priority,
5744
5779
  options.kind,
5745
5780
  options.status
@@ -5748,7 +5783,7 @@ var NotificationComponent = class extends WidthAwareContainer {
5748
5783
  const maxContentWidth = Math.max(MIN_NOTIFICATION_CONTENT_WIDTH, Math.min(MAX_NOTIFICATION_CONTENT_WIDTH, width - 0 - 4));
5749
5784
  const titleLines = wrapText(titleText, maxContentWidth);
5750
5785
  const detailLines = details ? wrapText(details, maxContentWidth) : [];
5751
- const messageLines = message ? wrapText(message, maxContentWidth) : [];
5786
+ const messageLines = message ? this.limitMessageLines(wrapText(message, maxContentWidth), quiet, maxContentWidth) : [];
5752
5787
  const backgroundDetailLines = options.backgroundCompletion ? [
5753
5788
  `task · ${options.backgroundCompletion.taskId}`,
5754
5789
  options.backgroundCompletion.argsSummary ? `invocation · ${options.backgroundCompletion.argsSummary}` : void 0,
@@ -5771,6 +5806,14 @@ var NotificationComponent = class extends WidthAwareContainer {
5771
5806
  for (const line of backgroundDetailLines) this.addChild(new Text(`${borderColor("│")} ${theme.fg("dim", padLine$1(line, contentWidth))} ${borderColor("│")}`, 0, 0));
5772
5807
  this.addChild(new Text(borderColor(bottom), 0, 0));
5773
5808
  }
5809
+ limitMessageLines(lines, quiet, maxWidth) {
5810
+ if (!quiet || lines.length <= this.quietPreviewLineLimit) return lines;
5811
+ const shown = lines.slice(0, this.quietPreviewLineLimit);
5812
+ if (shown.length === 0) return shown;
5813
+ const last = shown[shown.length - 1];
5814
+ shown[shown.length - 1] = visibleWidth(last) < maxWidth ? `${last}…` : `${truncateToWidth(last, maxWidth - 1, "")}…`;
5815
+ return shown;
5816
+ }
5774
5817
  getChatSpacingKind() {
5775
5818
  return "system";
5776
5819
  }
@@ -7626,9 +7669,34 @@ var ToolExecutionComponentEnhanced = class extends WidthAwareContainer {
7626
7669
  addLeadingPadding() {
7627
7670
  if (this.shouldShowLeadingPadding()) this.contentBox.addChild(new Text("", 0, 0));
7628
7671
  }
7672
+ /**
7673
+ * Quiet shell output follows the same rule as every other tool's preview:
7674
+ * `quietPreviewLineLimit` output lines (the tail, since that is where errors
7675
+ * land), or none at all when the limit is 0. Expanding (ctrl+e) shows everything.
7676
+ */
7629
7677
  limitQuietShellLines(lines) {
7630
- if (this.quietDisplayMode !== "quiet" || lines.length <= 15) return lines;
7631
- return lines.slice(-15);
7678
+ if (this.quietDisplayMode !== "quiet" || this.expanded) return lines;
7679
+ const limit = this.quietPreviewLineLimit;
7680
+ if (limit <= 0) return [];
7681
+ if (this.fitsQuietLimit(lines.length, limit)) return lines;
7682
+ return [this.quietHiddenLinesMarker(lines.length - limit), ...lines.slice(-limit)];
7683
+ }
7684
+ /**
7685
+ * The command is the shell tool's header, so at least one line always shows;
7686
+ * the rest of a long command (heredocs, inline scripts) is capped like output.
7687
+ */
7688
+ limitQuietShellCommandLines(lines) {
7689
+ if (this.quietDisplayMode !== "quiet" || this.expanded) return lines;
7690
+ const limit = Math.max(1, this.quietPreviewLineLimit);
7691
+ if (this.fitsQuietLimit(lines.length, limit)) return lines;
7692
+ return [...lines.slice(0, limit), this.quietHiddenLinesMarker(lines.length - limit)];
7693
+ }
7694
+ /** A `⋯ (+1 line)` marker costs the same row as the line it hides, so just show the line. */
7695
+ fitsQuietLimit(count, limit) {
7696
+ return count <= limit + 1;
7697
+ }
7698
+ quietHiddenLinesMarker(hidden) {
7699
+ return theme.fg("muted", `⋯ (+${hidden} ${hidden === 1 ? "line" : "lines"})`);
7632
7700
  }
7633
7701
  /**
7634
7702
  * Full clear-and-rebuild. Called when:
@@ -8339,15 +8407,17 @@ var ToolExecutionComponentEnhanced = class extends WidthAwareContainer {
8339
8407
  this.contentBox.addChild(new Text(displayOutput, 0, 0));
8340
8408
  this.contentBox.addChild(new Text(`${border("├")}${border(horizontal)}${border("┤")}`, 0, 0));
8341
8409
  }
8342
- const footerWrapWidth = Math.max(1, contentWidth - 4);
8343
- const footerLines = this.wrapQuietShellCommand(command, footerWrapWidth);
8410
+ const footerPromptWidth = visibleWidth(footerPrompt);
8411
+ const footerWrapWidth = Math.max(1, contentWidth - 2 - footerPromptWidth);
8412
+ const footerLines = this.limitQuietShellCommandLines(this.wrapQuietShellCommand(command, footerWrapWidth));
8344
8413
  const footerSuffixWidth = visibleWidth(footerSuffix);
8414
+ const continuationIndent = " ".repeat(footerPromptWidth);
8345
8415
  footerLines.forEach((footerLine, index) => {
8346
- const prefix = index === 0 ? footerPrompt : " ";
8416
+ const prefix = index === 0 ? footerPrompt : continuationIndent;
8347
8417
  const suffix = index === footerLines.length - 1 && visibleWidth(footerLine) + footerSuffixWidth <= footerWrapWidth ? footerSuffix : "";
8348
8418
  this.contentBox.addChild(new Text(renderLine(`${prefix}${footerLine}${suffix}`, (value) => value), 0, 0));
8349
8419
  });
8350
- if (visibleWidth(footerLines[footerLines.length - 1] ?? "") + footerSuffixWidth > footerWrapWidth) this.contentBox.addChild(new Text(renderLine(` ${footerSuffix}`, (value) => value), 0, 0));
8420
+ if (visibleWidth(footerLines[footerLines.length - 1] ?? "") + footerSuffixWidth > footerWrapWidth) this.contentBox.addChild(new Text(renderLine(`${continuationIndent}${footerSuffix}`, (value) => value), 0, 0));
8351
8421
  this.contentBox.addChild(new Text(`${border("╰")}${border(horizontal)}${border("╯")}`, 0, 0));
8352
8422
  };
8353
8423
  if (!this.result || this.isPartial) {
@@ -10607,6 +10677,8 @@ function renderSignalMessage(state, message) {
10607
10677
  kind: notification.kind,
10608
10678
  priority: notification.priority,
10609
10679
  status: notification.status,
10680
+ quietDisplayMode: state.quietMode ? "quiet" : "normal",
10681
+ quietPreviewLineLimit: state.quietModeMaxToolPreviewLines,
10610
10682
  backgroundCompletion
10611
10683
  });
10612
10684
  if (backgroundCompletion) state.allToolComponents.push(component);
@@ -10621,7 +10693,8 @@ function renderSignalMessage(state, message) {
10621
10693
  const component = new NotificationSummaryComponent({
10622
10694
  message: summary.message,
10623
10695
  pending: summary.pending,
10624
- bySource: summary.bySource
10696
+ bySource: summary.bySource,
10697
+ quietDisplayMode: state.quietMode ? "quiet" : "normal"
10625
10698
  });
10626
10699
  addChildBeforeFollowUps(state, component);
10627
10700
  state.messageComponentsById.set(message.id, component);
@@ -15555,7 +15628,7 @@ var SettingsComponent = class extends Box {
15555
15628
  ...config.quietMode ? [{
15556
15629
  id: "quietModeMaxToolPreviewLines",
15557
15630
  label: "Quiet mode tool preview lines",
15558
- description: "Maximum compact tool detail preview lines. Set to None to hide previews.",
15631
+ description: "Preview lines shown under each tool, including shell output. Set to None to hide previews.",
15559
15632
  currentValue: quietPreviewLinesLabel(config.quietModeMaxToolPreviewLines),
15560
15633
  submenu: (_currentValue, done) => new SelectSubmenu([
15561
15634
  0,
@@ -15566,7 +15639,7 @@ var SettingsComponent = class extends Box {
15566
15639
  ].map((lines) => ({
15567
15640
  value: String(lines),
15568
15641
  label: ` ${quietPreviewLinesLabel(lines)}`,
15569
- description: lines === 0 ? "Hide compact tool detail previews" : `Show up to ${lines} preview line${lines === 1 ? "" : "s"}`
15642
+ description: lines === 0 ? "Hide tool previews and shell output" : `Show up to ${lines} preview line${lines === 1 ? "" : "s"}`
15570
15643
  })), String(config.quietModeMaxToolPreviewLines), (value) => {
15571
15644
  config.quietModeMaxToolPreviewLines = Number(value);
15572
15645
  callbacks.onQuietModeMaxToolPreviewLinesChange(config.quietModeMaxToolPreviewLines);
@@ -15693,6 +15766,27 @@ var SettingsComponent = class extends Box {
15693
15766
  }
15694
15767
  };
15695
15768
  //#endregion
15769
+ //#region src/tui/quiet-mode.ts
15770
+ /**
15771
+ * Pushes the current quiet-mode preference into every already-rendered component
15772
+ * that renders differently in quiet mode: tool executions, notifications, and
15773
+ * notification summaries. Both the onboarding prompt and the `/settings` overlay
15774
+ * route through here so the two paths cannot drift.
15775
+ */
15776
+ function applyQuietModeToRenderedComponents(state, enabled, previewLineLimit, modeColor) {
15777
+ const mode = enabled ? "quiet" : "normal";
15778
+ const tools = state.allToolComponents.filter((tool) => typeof tool.setQuietModeDisplay === "function");
15779
+ for (const tool of tools) {
15780
+ tool.setCompactToolModeColor?.(modeColor);
15781
+ tool.setQuietModeDisplay?.(mode);
15782
+ tool.setQuietPreviewLineLimit?.(previewLineLimit);
15783
+ }
15784
+ for (const component of state.messageComponentsById?.values() ?? []) if (component instanceof NotificationComponent) {
15785
+ component.setQuietModeDisplay(mode);
15786
+ component.setQuietPreviewLineLimit(previewLineLimit);
15787
+ } else if (component instanceof NotificationSummaryComponent) component.setQuietModeDisplay(mode);
15788
+ }
15789
+ //#endregion
15696
15790
  //#region src/tui/commands/api-keys.ts
15697
15791
  /**
15698
15792
  * /api-keys command: manage API keys for model providers.
@@ -15983,11 +16077,7 @@ async function ensureGitcrawlReady(ctx) {
15983
16077
  }
15984
16078
  }
15985
16079
  function applyQuietModeToRenderedTools(ctx, enabled, previewLineLimit) {
15986
- ctx.state.allToolComponents.filter((tool) => typeof tool.setQuietModeDisplay === "function").forEach((tool) => {
15987
- tool.setCompactToolModeColor?.(getCurrentModeColor$1(ctx));
15988
- tool.setQuietModeDisplay?.(enabled ? "quiet" : "normal");
15989
- tool.setQuietPreviewLineLimit?.(previewLineLimit);
15990
- });
16080
+ applyQuietModeToRenderedComponents(ctx.state, enabled, previewLineLimit, getCurrentModeColor$1(ctx));
15991
16081
  ctx.state.ui.requestRender();
15992
16082
  }
15993
16083
  async function handleSettingsCommand(ctx) {
@@ -16119,17 +16209,39 @@ async function handleSettingsCommand(ctx) {
16119
16209
  * which may differ from the settings file if another instance changed it.
16120
16210
  */
16121
16211
  const ACTIVE_BROWSER_KEY = "activeBrowserSettings";
16212
+ const ACTIVE_BROWSER_MODEL_KEY = "activeBrowserModel";
16122
16213
  /**
16123
16214
  * /browser command - Configure browser automation for agents.
16124
16215
  *
16125
16216
  * Usage:
16126
16217
  * /browser - Interactive setup wizard
16127
- * /browser status - Show current browser configuration
16218
+ * /browser status|info - Show current browser configuration
16128
16219
  * /browser on - Enable browser with current settings
16129
16220
  * /browser off - Disable browser
16130
16221
  * /browser set <k> <v> - Set a specific setting (profile, executablePath, storageState, cdpUrl, model, viewport)
16131
16222
  */
16132
16223
  /**
16224
+ * Chat model at the moment the browser is launched. Stagehand is fixed at
16225
+ * creation and shared by every thread, so later model switches don't affect it.
16226
+ */
16227
+ function launchChatModelId(ctx) {
16228
+ return ctx.state.session.model.get();
16229
+ }
16230
+ /**
16231
+ * Human-readable line for the model Stagehand will actually use, including the
16232
+ * implicit chat-model / Codex fallbacks, so users can see it without reading the
16233
+ * settings file.
16234
+ */
16235
+ function describeStagehandModel({ modelName, source, viaCodexOAuth }) {
16236
+ const codex = viaCodexOAuth ? " via OpenAI Codex login" : "";
16237
+ switch (source) {
16238
+ case "settings": return ` Model: ${modelName}${codex ? ` (${codex.trim()})` : ""}`;
16239
+ case "chat-model": return ` Model: ${modelName} (current chat model${codex}; override with /browser set model)`;
16240
+ case "codex-oauth": return ` Model: ${modelName} (OpenAI Codex login default; override with /browser set model)`;
16241
+ case "stagehand-default": return " Model: Stagehand default (set one with /browser set model)";
16242
+ }
16243
+ }
16244
+ /**
16133
16245
  * Validate a `provider/model` id against the providers Stagehand can resolve.
16134
16246
  *
16135
16247
  * Stagehand splits the id on its first slash and throws during browser startup
@@ -16312,22 +16424,40 @@ function resolveModeAgent(mode, agentControllerState) {
16312
16424
  const modeAgent = mode.agent;
16313
16425
  return typeof modeAgent === "function" ? modeAgent(agentControllerState) : modeAgent;
16314
16426
  }
16315
- function applyBrowserToAgents(ctx, browser, browserSettings) {
16427
+ /**
16428
+ * @param chatModelId the chat model passed to `createBrowserFromSettings` for
16429
+ * this browser, so the recorded model matches what was really launched.
16430
+ */
16431
+ function applyBrowserToAgents(ctx, browser, browserSettings, chatModelId) {
16316
16432
  const modes = ctx.controller.listModes();
16317
16433
  let agentControllerState;
16318
16434
  for (const mode of modes) resolveModeAgent(mode, agentControllerState ??= ctx.state.session.state.get())?.setBrowser?.(browser);
16319
16435
  ctx.controller.setBrowser?.(browser);
16320
- ctx.state.session.state.set({ [ACTIVE_BROWSER_KEY]: browserSettings });
16436
+ ctx.state.session.state.set({
16437
+ [ACTIVE_BROWSER_KEY]: browserSettings ? toActiveBrowserSettings(browserSettings) : void 0,
16438
+ [ACTIVE_BROWSER_MODEL_KEY]: browserSettings?.enabled ? resolveStagehandModel(browserSettings, { chatModelId }) : void 0
16439
+ });
16321
16440
  }
16322
16441
  /**
16323
16442
  * Get a summary key for browser settings to detect config drift.
16443
+ *
16444
+ * `resolved` is the model resolution for these settings; when the configured
16445
+ * model is used it is canonicalized the way `createBrowserFromSettings` does
16446
+ * (Anthropic id normalization, `-codex` remaps over Codex OAuth) so that two
16447
+ * spellings of the same launched model don't read as pending changes.
16324
16448
  */
16325
- function getBrowserConfigKey(settings) {
16449
+ function getBrowserConfigKey(settings, resolved) {
16326
16450
  if (!settings.enabled) return "disabled";
16327
16451
  const parts = [settings.provider];
16328
16452
  if (settings.provider === "stagehand" && settings.stagehand?.env) parts.push(settings.stagehand.env);
16329
- if (settings.provider === "stagehand" && settings.stagehand?.model) parts.push(`model:${settings.stagehand.model}`);
16453
+ if (settings.provider === "stagehand" && settings.stagehand?.model) {
16454
+ const canonical = resolved?.source === "settings" && resolved.modelName ? resolved.viaCodexOAuth ? remapOpenAIModelForCodexOAuth(resolved.modelName) : resolved.modelName : settings.stagehand.model;
16455
+ parts.push(`model:${canonical}`);
16456
+ }
16330
16457
  parts.push(settings.headless ? "headless" : "headed");
16458
+ const effectiveScope = settings.profile || settings.cdpUrl ? "shared" : settings.scope;
16459
+ if (effectiveScope) parts.push(`scope:${effectiveScope}`);
16460
+ if (settings.provider === "stagehand" && !settings.cdpUrl && settings.stagehand?.preserveUserDataDir !== void 0) parts.push(`preserve:${settings.stagehand.preserveUserDataDir}`);
16331
16461
  if (settings.viewport) parts.push(`viewport:${formatViewport(settings.viewport)}`);
16332
16462
  if (settings.profile) parts.push(`profile:${settings.profile}`);
16333
16463
  if (settings.executablePath) parts.push(`exec:${settings.executablePath}`);
@@ -16452,17 +16582,20 @@ async function handleBrowserCommand(ctx, args = []) {
16452
16582
  ctx.showInfo(`Set ${args[1]} = ${expandedValue}\nRun /browser on to apply.`);
16453
16583
  return;
16454
16584
  }
16455
- if (arg === "status") {
16456
- const activeSettings = ctx.state.session.state.get()?.[ACTIVE_BROWSER_KEY];
16457
- if (activeSettings && getBrowserConfigKey(browser) !== getBrowserConfigKey(activeSettings) && activeSettings) {
16585
+ if (arg === "status" || arg === "info") {
16586
+ const state = ctx.state.session.state.get();
16587
+ const activeSettings = state?.[ACTIVE_BROWSER_KEY];
16588
+ const activeModel = state?.[ACTIVE_BROWSER_MODEL_KEY];
16589
+ const resolveNow = (settings) => resolveStagehandModel(settings, { chatModelId: launchChatModelId(ctx) });
16590
+ if (activeSettings && getBrowserConfigKey(browser, resolveNow(browser)) !== getBrowserConfigKey(activeSettings, activeModel ?? resolveNow(activeSettings)) && activeSettings) {
16458
16591
  const lines = [];
16459
16592
  const activeProvider = activeSettings.provider === "stagehand" ? "Stagehand (AI-powered)" : "AgentBrowser (deterministic)";
16460
16593
  const activeIsBrowserbase = activeSettings.provider === "stagehand" && activeSettings.stagehand?.env === "BROWSERBASE";
16461
16594
  lines.push("Browser (active):");
16462
16595
  lines.push(` Provider: ${activeProvider}`);
16463
- if (activeSettings.provider === "stagehand" && activeSettings.stagehand) {
16464
- lines.push(` Environment: ${activeSettings.stagehand.env}`);
16465
- if (activeSettings.stagehand.model) lines.push(` Model: ${activeSettings.stagehand.model}`);
16596
+ if (activeSettings.provider === "stagehand") {
16597
+ if (activeSettings.stagehand) lines.push(` Environment: ${activeSettings.stagehand.env}`);
16598
+ lines.push(describeStagehandModel(activeModel ?? resolveNow(activeSettings)));
16466
16599
  }
16467
16600
  if (!activeIsBrowserbase) lines.push(` Headless: ${activeSettings.headless ? "yes" : "no"}`);
16468
16601
  lines.push(` Viewport: ${formatViewport(activeSettings.viewport)}`);
@@ -16475,9 +16608,9 @@ async function handleBrowserCommand(ctx, args = []) {
16475
16608
  const fileIsBrowserbase = browser.provider === "stagehand" && browser.stagehand?.env === "BROWSERBASE";
16476
16609
  lines.push("Pending changes (not yet applied):");
16477
16610
  lines.push(` Provider: ${fileProvider}`);
16478
- if (browser.provider === "stagehand" && browser.stagehand) {
16479
- lines.push(` Environment: ${browser.stagehand.env}`);
16480
- if (browser.stagehand.model) lines.push(` Model: ${browser.stagehand.model}`);
16611
+ if (browser.provider === "stagehand") {
16612
+ if (browser.stagehand) lines.push(` Environment: ${browser.stagehand.env}`);
16613
+ lines.push(describeStagehandModel(resolveNow(browser)));
16481
16614
  }
16482
16615
  if (!fileIsBrowserbase) lines.push(` Headless: ${browser.headless ? "yes" : "no"}`);
16483
16616
  lines.push(` Viewport: ${formatViewport(browser.viewport)}`);
@@ -16493,9 +16626,9 @@ async function handleBrowserCommand(ctx, args = []) {
16493
16626
  const providerLabel = browser.provider === "stagehand" ? "Stagehand (AI-powered)" : "AgentBrowser (deterministic)";
16494
16627
  const isBrowserbase = browser.provider === "stagehand" && browser.stagehand?.env === "BROWSERBASE";
16495
16628
  const lines = [`Browser: enabled`, ` Provider: ${providerLabel}`];
16496
- if (browser.provider === "stagehand" && browser.stagehand) {
16497
- lines.push(` Environment: ${browser.stagehand.env}`);
16498
- if (browser.stagehand.model) lines.push(` Model: ${browser.stagehand.model}`);
16629
+ if (browser.provider === "stagehand") {
16630
+ if (browser.stagehand) lines.push(` Environment: ${browser.stagehand.env}`);
16631
+ lines.push(describeStagehandModel(activeModel ?? resolveNow(browser)));
16499
16632
  }
16500
16633
  if (!isBrowserbase) lines.push(` Headless: ${browser.headless ? "yes" : "no"}`);
16501
16634
  lines.push(` Viewport: ${formatViewport(browser.viewport)}`);
@@ -16528,7 +16661,8 @@ async function handleBrowserCommand(ctx, args = []) {
16528
16661
  return;
16529
16662
  }
16530
16663
  try {
16531
- applyBrowserToAgents(ctx, await createBrowserFromSettings(nextBrowser), nextBrowser);
16664
+ const chatModelId = launchChatModelId(ctx);
16665
+ applyBrowserToAgents(ctx, await createBrowserFromSettings(nextBrowser, { chatModelId }), nextBrowser, chatModelId);
16532
16666
  if (nextBrowser.profile && nextBrowser.provider) setProfileProvider(nextBrowser.profile, nextBrowser.provider);
16533
16667
  settings.browser = nextBrowser;
16534
16668
  saveSettings(settings);
@@ -16554,7 +16688,8 @@ async function handleBrowserCommand(ctx, args = []) {
16554
16688
  };
16555
16689
  saveSettings(settings);
16556
16690
  if (wasEnabled) try {
16557
- applyBrowserToAgents(ctx, await createBrowserFromSettings(settings.browser), settings.browser);
16691
+ const chatModelId = launchChatModelId(ctx);
16692
+ applyBrowserToAgents(ctx, await createBrowserFromSettings(settings.browser, { chatModelId }), settings.browser, chatModelId);
16558
16693
  } catch (err) {
16559
16694
  settings.browser.enabled = false;
16560
16695
  saveSettings(settings);
@@ -16611,8 +16746,9 @@ async function handleBrowserCommand(ctx, args = []) {
16611
16746
  }
16612
16747
  let browserInstance = resolveModeAgent(ctx.state.session.mode.resolve(), ctx.state.session.state.get())?.browser;
16613
16748
  if (!browserInstance && browser.enabled) {
16614
- browserInstance = await createBrowserFromSettings(browser);
16615
- applyBrowserToAgents(ctx, browserInstance, browser);
16749
+ const chatModelId = launchChatModelId(ctx);
16750
+ browserInstance = await createBrowserFromSettings(browser, { chatModelId });
16751
+ applyBrowserToAgents(ctx, browserInstance, browser, chatModelId);
16616
16752
  }
16617
16753
  if (!browserInstance) {
16618
16754
  ctx.showError("Browser not enabled. Run /browser on first.");
@@ -16636,6 +16772,7 @@ async function handleBrowserCommand(ctx, args = []) {
16636
16772
  if (arg && ![
16637
16773
  "set",
16638
16774
  "status",
16775
+ "info",
16639
16776
  "on",
16640
16777
  "off",
16641
16778
  "enable",
@@ -16648,7 +16785,7 @@ async function handleBrowserCommand(ctx, args = []) {
16648
16785
  " (no command) Interactive setup wizard",
16649
16786
  " on, enable Enable browser with current settings",
16650
16787
  " off, disable Disable browser",
16651
- " status Show current configuration",
16788
+ " status, info Show current configuration (provider, model, profile, ...)",
16652
16789
  " clear Reset all settings to defaults",
16653
16790
  " clear <key> Clear: profile, executablePath, storageState, cdpUrl, model, viewport",
16654
16791
  " set <key> <v> Set: profile, executablePath, storageState, cdpUrl, model, viewport",
@@ -16815,8 +16952,9 @@ async function handleBrowserCommand(ctx, args = []) {
16815
16952
  ctx.showInfo("Browser setup cancelled.");
16816
16953
  return;
16817
16954
  }
16955
+ const chatModelId = launchChatModelId(ctx);
16818
16956
  try {
16819
- applyBrowserToAgents(ctx, await createBrowserFromSettings(nextBrowser), nextBrowser);
16957
+ applyBrowserToAgents(ctx, await createBrowserFromSettings(nextBrowser, { chatModelId }), nextBrowser, chatModelId);
16820
16958
  if (nextBrowser.profile && nextBrowser.provider) setProfileProvider(nextBrowser.profile, nextBrowser.provider);
16821
16959
  settings.browser = nextBrowser;
16822
16960
  saveSettings(settings);
@@ -16825,7 +16963,10 @@ async function handleBrowserCommand(ctx, args = []) {
16825
16963
  return;
16826
16964
  }
16827
16965
  const summary = ["Browser automation enabled:", ` Provider: ${provider === "stagehand" ? "Stagehand (AI-powered)" : "AgentBrowser (deterministic)"}`];
16828
- if (provider === "stagehand" && stagehandSettings) summary.push(` Environment: ${stagehandSettings.env}`);
16966
+ if (provider === "stagehand") {
16967
+ if (stagehandSettings) summary.push(` Environment: ${stagehandSettings.env}`);
16968
+ summary.push(describeStagehandModel(resolveStagehandModel(nextBrowser, { chatModelId })));
16969
+ }
16829
16970
  if (!isBrowserbase) summary.push(` Headless: ${headless ? "yes" : "no"}`);
16830
16971
  if (cdpUrl) summary.push(` CDP URL: ${cdpUrl}`);
16831
16972
  if (executablePath) summary.push(` Executable: ${executablePath}`);
@@ -26781,14 +26922,9 @@ var MastraTUI = class MastraTUI {
26781
26922
  this.state.quietMode = enabled;
26782
26923
  this.state.quietModeMaxToolPreviewLines = previewLineLimit;
26783
26924
  this.state.taskProgress?.setQuietMode(enabled);
26784
- const tools = this.state.allToolComponents.filter((tool) => typeof tool.setQuietModeDisplay === "function");
26785
26925
  const color = this.state.session?.mode.resolve().metadata?.color;
26786
26926
  const modeColor = typeof color === "string" ? color : void 0;
26787
- for (const tool of tools) {
26788
- tool.setCompactToolModeColor?.(modeColor);
26789
- tool.setQuietModeDisplay?.(enabled ? "quiet" : "normal");
26790
- tool.setQuietPreviewLineLimit?.(previewLineLimit);
26791
- }
26927
+ applyQuietModeToRenderedComponents(this.state, enabled, previewLineLimit, modeColor);
26792
26928
  flushRender(this.state);
26793
26929
  }
26794
26930
  parseQuietPreviewLineAnswer(answer) {
@@ -26819,7 +26955,7 @@ var MastraTUI = class MastraTUI {
26819
26955
  options: [
26820
26956
  {
26821
26957
  label: "None",
26822
- description: "Hide compact tool detail previews"
26958
+ description: "Hide tool previews and shell output"
26823
26959
  },
26824
26960
  {
26825
26961
  label: "1 line",
@@ -26926,4 +27062,4 @@ var MastraTUI = class MastraTUI {
26926
27062
  //#endregion
26927
27063
  export { mastraBrand as _, OMProgressComponent as a, TUI_CO_AUTHOR as b, ToolExecutionComponentEnhanced as c, detectTerminalTheme as d, applyThemeMode as f, mastra as g, getThemeMode as h, LoginDialogComponent as i, ModelSelectorComponent as l, getMarkdownTheme as m, createTUIState as n, formatOMStatus as o, getEditorTheme as p, LoginSelectorComponent as r, UserMessageComponent as s, MastraTUI as t, AssistantMessageComponent as u, restoreTerminalForeground as v, theme as y };
26928
27064
 
26929
- //# sourceMappingURL=tui-BS1IUTkx.js.map
27065
+ //# sourceMappingURL=tui-BNnzmiap.js.map