mastracode 0.50.3 → 0.50.4-alpha.0

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 CHANGED
@@ -1,5 +1,21 @@
1
1
  # mastracode
2
2
 
3
+ ## 0.50.4-alpha.0
4
+
5
+ ### Patch Changes
6
+
7
+ - Model pack fallback notices now name the cause first, for example `Anthropic is out of credits or quota, switched to OpenAI`. ([#31230](https://github.com/mastra-ai/mastra/pull/31230))
8
+
9
+ A request the provider rejects, such as a prompt too long for the first model, now moves to the next model in the pack, with a notice. Before, the run stopped with `Processor "mastracode-account-rotation" stopped the run: …`.
10
+
11
+ - Updated dependencies [[`0aec008`](https://github.com/mastra-ai/mastra/commit/0aec008954c873153e6037f1d11b26d1a3156d87), [`0aec008`](https://github.com/mastra-ai/mastra/commit/0aec008954c873153e6037f1d11b26d1a3156d87), [`bd6e62f`](https://github.com/mastra-ai/mastra/commit/bd6e62fe098784b149d7d04948bc66ca68108d0b), [`dc78e49`](https://github.com/mastra-ai/mastra/commit/dc78e49845d7e5bfc2aa826b24e9a104f9428c33), [`853bb80`](https://github.com/mastra-ai/mastra/commit/853bb80b6f0ff6647b41f373473e6d95f9efe1aa), [`9a6be2d`](https://github.com/mastra-ai/mastra/commit/9a6be2d940906b37b573bbf14fdd6ee7633e4c5e), [`7e1eab0`](https://github.com/mastra-ai/mastra/commit/7e1eab088a61f88cd7875bf50118ff3223b5efd7), [`c2b28d4`](https://github.com/mastra-ai/mastra/commit/c2b28d49a7ba6e0339b694e22607869f75b1dd04), [`a5b8a78`](https://github.com/mastra-ai/mastra/commit/a5b8a782708b1bbb1c5b132a2f8de8c0b0145415), [`4fb02e4`](https://github.com/mastra-ai/mastra/commit/4fb02e4f6205d7ee6f1335279ac09841d2482d13), [`d6f54c1`](https://github.com/mastra-ai/mastra/commit/d6f54c1a148edc2d605b3a4c9194d30a85929320), [`a5b8a78`](https://github.com/mastra-ai/mastra/commit/a5b8a782708b1bbb1c5b132a2f8de8c0b0145415), [`1804d9a`](https://github.com/mastra-ai/mastra/commit/1804d9a02acb89af57a8b82ed4bfc1ad79ae9e77), [`2fa9b3e`](https://github.com/mastra-ai/mastra/commit/2fa9b3e0396ccadc359eb562c32588d7dfad88b4), [`853bb80`](https://github.com/mastra-ai/mastra/commit/853bb80b6f0ff6647b41f373473e6d95f9efe1aa), [`b15af8b`](https://github.com/mastra-ai/mastra/commit/b15af8be275465422d016ebba2882ee5252a69e2), [`ab3f19d`](https://github.com/mastra-ai/mastra/commit/ab3f19dad1e65ad176c97e71ffacad5d5b5fd773), [`17cfd26`](https://github.com/mastra-ai/mastra/commit/17cfd2613995be04e9f3ab8a1b91d4d0a26ae800), [`ab3f19d`](https://github.com/mastra-ai/mastra/commit/ab3f19dad1e65ad176c97e71ffacad5d5b5fd773), [`04b03dd`](https://github.com/mastra-ai/mastra/commit/04b03dd6a50a60cc900f255485f8993ade206a35), [`f636a9f`](https://github.com/mastra-ai/mastra/commit/f636a9f13dc880f60679fc49fc39a51c124b5599), [`2d35c78`](https://github.com/mastra-ai/mastra/commit/2d35c78da97db7d3ce5570882cac441a51f4386a), [`b6df61e`](https://github.com/mastra-ai/mastra/commit/b6df61eec51f6352696c7eca45beadf00f794230), [`0e27198`](https://github.com/mastra-ai/mastra/commit/0e27198791549ae6a4d4e64e24ba8c2b56afde46), [`ad02b1c`](https://github.com/mastra-ai/mastra/commit/ad02b1c61743b71d32728947a2d7c0ab1700d1b5), [`127897c`](https://github.com/mastra-ai/mastra/commit/127897c8573c62cdedad921b4ad33138b25f181c), [`9de2483`](https://github.com/mastra-ai/mastra/commit/9de24839be8a44477b56c61a9878282781b12c84), [`da66164`](https://github.com/mastra-ai/mastra/commit/da66164f2827ee6cee59d1691a2c78e58601cf2f), [`3a325bb`](https://github.com/mastra-ai/mastra/commit/3a325bb29be1bf6f64dd06b3c129a64a2b706069), [`178e12f`](https://github.com/mastra-ai/mastra/commit/178e12fbeabbe096418e63a9eab4a1153cc61d89), [`9de2483`](https://github.com/mastra-ai/mastra/commit/9de24839be8a44477b56c61a9878282781b12c84), [`cbcf337`](https://github.com/mastra-ai/mastra/commit/cbcf337aabfc0a0f8ea9387d5b06bd893021ff6f), [`9100eb8`](https://github.com/mastra-ai/mastra/commit/9100eb8a78c79046d0001541734fc769254f7119), [`3f526af`](https://github.com/mastra-ai/mastra/commit/3f526aff4a2d59f1dc4bb778e7181cdedd954ec0), [`da66164`](https://github.com/mastra-ai/mastra/commit/da66164f2827ee6cee59d1691a2c78e58601cf2f), [`cbcf337`](https://github.com/mastra-ai/mastra/commit/cbcf337aabfc0a0f8ea9387d5b06bd893021ff6f), [`4af262e`](https://github.com/mastra-ai/mastra/commit/4af262e9c0c47e414cfe0cbc9e0c61275a7441bc), [`d66b3f1`](https://github.com/mastra-ai/mastra/commit/d66b3f151be25128500d1d1acd1d9701b191b623)]:
12
+ - @mastra/observability@1.24.4-alpha.0
13
+ - @mastra/core@1.87.0-alpha.0
14
+ - @mastra/pg@1.39.0-alpha.0
15
+ - @mastra/libsql@1.33.0-alpha.0
16
+ - @mastra/code-sdk@1.22.0-alpha.0
17
+ - @mastra/mcp@2.11.0
18
+
3
19
  ## 0.50.3
4
20
 
5
21
  ### Patch Changes
package/dist/cli.cjs CHANGED
@@ -3,4 +3,4 @@
3
3
  /**
4
4
  * Main entry point for Mastra Code TUI.
5
5
  */
6
- require("./run-tui-CaM7UVOw.cjs").runTui();
6
+ require("./run-tui-iN-yMNdP.cjs").runTui();
package/dist/cli.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { t as runTui } from "./run-tui-DMHTLXmB.js";
2
+ import { t as runTui } from "./run-tui-Cro2miV4.js";
3
3
  // src/main.ts
4
4
  /**
5
5
  * Main entry point for Mastra Code TUI.
@@ -3,7 +3,7 @@ name: mastracode
3
3
  description: Documentation for mastracode. Use when working with mastracode APIs, configuration, or implementation.
4
4
  metadata:
5
5
  package: "mastracode"
6
- version: "0.50.3"
6
+ version: "0.50.4-alpha.0"
7
7
  ---
8
8
 
9
9
  ## When to use
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.50.3",
2
+ "version": "0.50.4-alpha.0",
3
3
  "package": "mastracode",
4
4
  "exports": {},
5
5
  "modules": {}
@@ -1,4 +1,4 @@
1
- import { D as closeActiveBrowser, E as activeBrowserGeneration, O as discardBrowser, T as TUI_CO_AUTHOR, _ as normalizeThemePreference, a as formatUpdateHeader, g as applyThemePreference, i as formatUpToDate, k as replaceActiveBrowser, n as formatInstallingLabel, o as formatUpdateOutcome, r as formatRegistryError, t as MastraTUI } from "./tui-D5nvojR8.js";
1
+ import { D as closeActiveBrowser, E as activeBrowserGeneration, O as discardBrowser, T as TUI_CO_AUTHOR, _ as normalizeThemePreference, a as formatUpdateHeader, g as applyThemePreference, i as formatUpToDate, k as replaceActiveBrowser, n as formatInstallingLabel, o as formatUpdateOutcome, r as formatRegistryError, t as MastraTUI } from "./tui-Dj2PcyWU.js";
2
2
  import { createMastraCode, resolveSubagentsSetting } from "@mastra/code-sdk";
3
3
  import { spawn } from "child_process";
4
4
  import fs from "fs";
@@ -263,7 +263,7 @@ async function runUpdateCommand({ args = [], output = process.stdout, errorOutpu
263
263
  }
264
264
  // src/version.ts
265
265
  function getCurrentVersion() {
266
- return "0.50.3";
266
+ return "0.50.4-alpha.0";
267
267
  }
268
268
  /** Whether the invocation is `mastracode --version` or `mastracode -v`. */
269
269
  function isVersionCommand(argv) {
@@ -1,4 +1,4 @@
1
- const require_tui = require("./tui-guTrLOOr.cjs");
1
+ const require_tui = require("./tui-C7NUOVDN.cjs");
2
2
  let _mastra_code_sdk = require("@mastra/code-sdk");
3
3
  let child_process = require("child_process");
4
4
  let fs = require("fs");
@@ -264,7 +264,7 @@ async function runUpdateCommand({ args = [], output = process.stdout, errorOutpu
264
264
  }
265
265
  // src/version.ts
266
266
  function getCurrentVersion() {
267
- return "0.50.3";
267
+ return "0.50.4-alpha.0";
268
268
  }
269
269
  /** Whether the invocation is `mastracode --version` or `mastracode -v`. */
270
270
  function isVersionCommand(argv) {
package/dist/run-tui.cjs CHANGED
@@ -1,3 +1,3 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_run_tui = require("./run-tui-CaM7UVOw.cjs");
2
+ const require_run_tui = require("./run-tui-iN-yMNdP.cjs");
3
3
  exports.runTui = require_run_tui.runTui;
package/dist/run-tui.js CHANGED
@@ -1 +1 @@
1
- export { t as runTui } from "./run-tui-DMHTLXmB.js";
1
+ export { t as runTui } from "./run-tui-Cro2miV4.js";
@@ -6,7 +6,8 @@
6
6
  * part lines read identically.
7
7
  */
8
8
  import { Container } from '@earendil-works/pi-tui';
9
- import type { AccountSwitchPartData, ModelFallbackPartData } from '@mastra/code-sdk/auth/account-rotation-processor';
9
+ import type { AccountSwitchPartData } from '@mastra/code-sdk/auth/account-rotation-processor';
10
+ import type { ModelFallbackPartData } from '@mastra/code-sdk/model-fallback';
10
11
  import type { ChatSpacingKind } from './chat-spacing.js';
11
12
  export type AccountSwitchNoticeData = AccountSwitchPartData;
12
13
  export declare function formatAccountSwitchNotice(data: AccountSwitchNoticeData): string;
@@ -16,7 +17,6 @@ export declare class AccountSwitchNoticeComponent extends Container {
16
17
  getChatSpacingKind(): ChatSpacingKind;
17
18
  }
18
19
  export type PackFallbackNoticeData = ModelFallbackPartData;
19
- export declare function packFallbackNoticeText(data: PackFallbackNoticeData): string;
20
20
  export declare class PackFallbackNoticeComponent extends Container {
21
21
  private textChild;
22
22
  constructor(data: PackFallbackNoticeData);
@@ -1,4 +1,5 @@
1
- import type { AccountSwitchPartData, ModelFallbackPartData } from '@mastra/code-sdk/auth/account-rotation-processor';
1
+ import type { AccountSwitchPartData } from '@mastra/code-sdk/auth/account-rotation-processor';
2
+ import type { ModelFallbackPartData } from '@mastra/code-sdk/model-fallback';
2
3
  import type { MastraDBMessage } from '@mastra/core/agent-controller';
3
4
  import type { CreatedAgentSignal } from '@mastra/core/signals';
4
5
  import { getBackgroundToolMetadata } from './background-tool-result.js';
@@ -35,10 +35,11 @@ let _mastra_code_sdk_theme_palette = require("@mastra/code-sdk/theme-palette");
35
35
  let chalk = require("chalk");
36
36
  chalk = __toESM(chalk, 1);
37
37
  let _mastra_code_sdk_agents_fastembed_subprocess = require("@mastra/code-sdk/agents/fastembed-subprocess");
38
- let _mastra_code_sdk_auth_account_rotation_processor = require("@mastra/code-sdk/auth/account-rotation-processor");
39
38
  let _mastra_code_sdk_auth_storage = require("@mastra/code-sdk/auth/storage");
39
+ let _mastra_code_sdk_model_fallback = require("@mastra/code-sdk/model-fallback");
40
40
  let _mastra_code_sdk_onboarding_index = require("@mastra/code-sdk/onboarding/index");
41
41
  let _mastra_code_sdk_utils_update_check = require("@mastra/code-sdk/utils/update-check");
42
+ let _mastra_code_sdk_auth_account_rotation_processor = require("@mastra/code-sdk/auth/account-rotation-processor");
42
43
  let _mastra_core_signals = require("@mastra/core/signals");
43
44
  let zod = require("zod");
44
45
  let _mastra_code_sdk_providers_model_ids = require("@mastra/code-sdk/providers/model-ids");
@@ -1789,29 +1790,6 @@ const OM_EVENT_BY_TYPE = {
1789
1790
  "data-om-observation-failed": "failed",
1790
1791
  "data-om-thread-update": "thread-title"
1791
1792
  };
1792
- function packFallbackRenderPart(data) {
1793
- if (!data || typeof data !== "object") return null;
1794
- const record = data;
1795
- const endpoint = (value) => {
1796
- if (!value || typeof value !== "object") return null;
1797
- const entry = value;
1798
- if (typeof entry.entryId !== "string" || typeof entry.label !== "string") return null;
1799
- return {
1800
- entryId: entry.entryId,
1801
- label: entry.label
1802
- };
1803
- };
1804
- const from = endpoint(record.from);
1805
- const to = endpoint(record.to);
1806
- if (!from || !to || !(0, _mastra_code_sdk_auth_account_rotation_processor.isModelFallbackReason)(record.reason)) return null;
1807
- return {
1808
- kind: "pack-fallback",
1809
- from,
1810
- to,
1811
- reason: record.reason,
1812
- at: typeof record.at === "string" ? record.at : ""
1813
- };
1814
- }
1815
1793
  function accountSwitchRenderPart(data) {
1816
1794
  if (!data || typeof data !== "object") return null;
1817
1795
  const record = data;
@@ -1970,9 +1948,12 @@ function getAssistantRenderParts(message) {
1970
1948
  if (switchPart) out.push(switchPart);
1971
1949
  break;
1972
1950
  }
1973
- if (partType === _mastra_code_sdk_auth_account_rotation_processor.MODEL_FALLBACK_PART_TYPE) {
1974
- const hopPart = packFallbackRenderPart(part.data);
1975
- if (hopPart) out.push(hopPart);
1951
+ if (partType === _mastra_code_sdk_model_fallback.MODEL_FALLBACK_PART_TYPE) {
1952
+ const hop = (0, _mastra_code_sdk_model_fallback.parseModelFallbackPart)(part.data);
1953
+ if (hop) out.push({
1954
+ kind: "pack-fallback",
1955
+ ...hop
1956
+ });
1976
1957
  break;
1977
1958
  }
1978
1959
  const event = OM_EVENT_BY_TYPE[part.type];
@@ -6387,7 +6368,7 @@ async function applyPackToSession(ctx, packId, options = {}) {
6387
6368
  if (!application.isCurrent()) return cancelled();
6388
6369
  if (options.clearPendingFallback !== false) {
6389
6370
  await ctx.state.session.thread.setSetting({
6390
- key: _mastra_code_sdk_auth_account_rotation_processor.MODEL_FALLBACK_STATE_KEY,
6371
+ key: _mastra_code_sdk_model_fallback.MODEL_FALLBACK_STATE_KEY,
6391
6372
  value: void 0
6392
6373
  });
6393
6374
  if (!application.isCurrent()) return cancelled();
@@ -6404,7 +6385,7 @@ async function applyPackToSession(ctx, packId, options = {}) {
6404
6385
  }
6405
6386
  await ctx.state.session.state.set({
6406
6387
  modelRoute: selection.modelRoute,
6407
- ...options.clearPendingFallback === false ? {} : { [_mastra_code_sdk_auth_account_rotation_processor.MODEL_FALLBACK_STATE_KEY]: null }
6388
+ ...options.clearPendingFallback === false ? {} : { [_mastra_code_sdk_model_fallback.MODEL_FALLBACK_STATE_KEY]: null }
6408
6389
  });
6409
6390
  if (!application.isCurrent()) return cancelled();
6410
6391
  await options.afterApply?.(selection);
@@ -6454,14 +6435,14 @@ async function applyCurrentThreadPack(ctx, options = {}) {
6454
6435
  }
6455
6436
  if (resolution.threadId) {
6456
6437
  await ctx.state.session.thread.setSetting({
6457
- key: _mastra_code_sdk_auth_account_rotation_processor.MODEL_FALLBACK_STATE_KEY,
6438
+ key: _mastra_code_sdk_model_fallback.MODEL_FALLBACK_STATE_KEY,
6458
6439
  value: void 0
6459
6440
  });
6460
6441
  if (!application.isCurrent()) return { applied: false };
6461
6442
  }
6462
6443
  await ctx.state.session.state.set({
6463
6444
  modelRoute: void 0,
6464
- [_mastra_code_sdk_auth_account_rotation_processor.MODEL_FALLBACK_STATE_KEY]: null
6445
+ [_mastra_code_sdk_model_fallback.MODEL_FALLBACK_STATE_KEY]: null
6465
6446
  });
6466
6447
  return { applied: application.isCurrent() };
6467
6448
  });
@@ -6478,7 +6459,7 @@ async function reconcilePackAfterModeChange(ctx, modeId) {
6478
6459
  const selection = (0, _mastra_code_sdk_onboarding_pack_activation.resolvePackSelection)(settings, resolution.packId, modeId);
6479
6460
  if (!selection) return;
6480
6461
  const state = ctx.state.session.state.get();
6481
- if (ctx.state.session.model.get() === selection.modelId && modelRoutesMatch(state.modelRoute, selection.modelRoute) && state[_mastra_code_sdk_auth_account_rotation_processor.MODEL_FALLBACK_STATE_KEY] == null) return;
6462
+ if (ctx.state.session.model.get() === selection.modelId && modelRoutesMatch(state.modelRoute, selection.modelRoute) && state[_mastra_code_sdk_model_fallback.MODEL_FALLBACK_STATE_KEY] == null) return;
6482
6463
  await applyPackToSession(ctx, resolution.packId, {
6483
6464
  modeId,
6484
6465
  expectedThreadId: resolution.threadId
@@ -6822,14 +6803,11 @@ var AccountSwitchNoticeComponent = class extends _earendil_works_pi_tui.Containe
6822
6803
  return "other";
6823
6804
  }
6824
6805
  };
6825
- function packFallbackNoticeText(data) {
6826
- return (0, _mastra_code_sdk_auth_account_rotation_processor.modelFallbackNoticeText)(data).replace("Switched model route:", "Switched model pack:");
6827
- }
6828
6806
  var PackFallbackNoticeComponent = class extends _earendil_works_pi_tui.Container {
6829
6807
  textChild;
6830
6808
  constructor(data) {
6831
6809
  super();
6832
- this.textChild = new _earendil_works_pi_tui.Text(theme.fg("muted", ` ⇄ ${packFallbackNoticeText(data)}`), 0, 0);
6810
+ this.textChild = new _earendil_works_pi_tui.Text(theme.fg("muted", ` ⇄ ${(0, _mastra_code_sdk_model_fallback.modelFallbackNoticeText)(data)}`), 0, 0);
6833
6811
  this.addChild(this.textChild);
6834
6812
  }
6835
6813
  getChatSpacingKind() {
@@ -16579,7 +16557,7 @@ async function switchCurrentModeModel(ctx, selectedModelId) {
16579
16557
  const threadSettings = (0, _mastra_code_sdk_onboarding_settings.parseThreadSettings)(thread?.metadata);
16580
16558
  const previousPackSetting = thread?.metadata?.[_mastra_code_sdk_onboarding_settings.THREAD_ACTIVE_MODEL_PACK_ID_KEY];
16581
16559
  const previousFallbackStatus = thread?.metadata?.[_mastra_code_sdk_onboarding_settings.THREAD_FALLBACK_STATUS_KEY];
16582
- const previousPendingFallback = thread?.metadata?.[_mastra_code_sdk_auth_account_rotation_processor.MODEL_FALLBACK_STATE_KEY];
16560
+ const previousPendingFallback = thread?.metadata?.[_mastra_code_sdk_model_fallback.MODEL_FALLBACK_STATE_KEY];
16583
16561
  const previousSessionState = ctx.state.session.state.get();
16584
16562
  const previousFallbackUi = ctx.state.fallbackStatus;
16585
16563
  const activePackId = threadSettings.activeModelPackId ?? nextSettings.models.activeModelPackId;
@@ -16651,7 +16629,7 @@ async function switchCurrentModeModel(ctx, selectedModelId) {
16651
16629
  value: previousFallbackStatus
16652
16630
  }),
16653
16631
  ctx.state.session.thread.setSetting({
16654
- key: _mastra_code_sdk_auth_account_rotation_processor.MODEL_FALLBACK_STATE_KEY,
16632
+ key: _mastra_code_sdk_model_fallback.MODEL_FALLBACK_STATE_KEY,
16655
16633
  value: previousPendingFallback
16656
16634
  }),
16657
16635
  ctx.state.session.thread.setSetting({
@@ -16677,7 +16655,7 @@ async function switchCurrentModeModel(ctx, selectedModelId) {
16677
16655
  ctx.state.session.model.switch(previousModelId),
16678
16656
  ctx.state.session.state.set({
16679
16657
  modelRoute: previousSessionState.modelRoute,
16680
- [_mastra_code_sdk_auth_account_rotation_processor.MODEL_FALLBACK_STATE_KEY]: previousSessionState[_mastra_code_sdk_auth_account_rotation_processor.MODEL_FALLBACK_STATE_KEY] ?? null,
16658
+ [_mastra_code_sdk_model_fallback.MODEL_FALLBACK_STATE_KEY]: previousSessionState[_mastra_code_sdk_model_fallback.MODEL_FALLBACK_STATE_KEY] ?? null,
16681
16659
  subagentModelId_explore: previousSessionState.subagentModelId_explore,
16682
16660
  subagentModelId_plan: previousSessionState.subagentModelId_plan,
16683
16661
  subagentModelId_execute: previousSessionState.subagentModelId_execute,
@@ -25974,8 +25952,8 @@ function handleMessageEnd(ctx, message) {
25974
25952
  * Keep a thread on the pack selected by a generic model-route hop.
25975
25953
  */
25976
25954
  async function handlePackFallbackState(ectx, event) {
25977
- if (!event.changedKeys.includes(_mastra_code_sdk_auth_account_rotation_processor.MODEL_FALLBACK_STATE_KEY)) return;
25978
- const pending = event.state[_mastra_code_sdk_auth_account_rotation_processor.MODEL_FALLBACK_STATE_KEY];
25955
+ if (!event.changedKeys.includes(_mastra_code_sdk_model_fallback.MODEL_FALLBACK_STATE_KEY)) return;
25956
+ const pending = event.state[_mastra_code_sdk_model_fallback.MODEL_FALLBACK_STATE_KEY];
25979
25957
  if (pending === null || pending === void 0) return;
25980
25958
  const entryThreadId = ectx.state.session.thread.getId();
25981
25959
  const pendingThreadId = typeof pending.threadId === "string" ? pending.threadId : entryThreadId;
@@ -25988,10 +25966,10 @@ async function handlePackFallbackState(ectx, event) {
25988
25966
  const isOriginThreadActive = () => !pendingThreadId || ectx.state.session.thread.getId() === pendingThreadId;
25989
25967
  const clearPending = async () => {
25990
25968
  await setOriginThreadSetting({
25991
- key: _mastra_code_sdk_auth_account_rotation_processor.MODEL_FALLBACK_STATE_KEY,
25969
+ key: _mastra_code_sdk_model_fallback.MODEL_FALLBACK_STATE_KEY,
25992
25970
  value: void 0
25993
25971
  });
25994
- if (isOriginThreadActive()) await ectx.state.session.state.set({ [_mastra_code_sdk_auth_account_rotation_processor.MODEL_FALLBACK_STATE_KEY]: null });
25972
+ if (isOriginThreadActive()) await ectx.state.session.state.set({ [_mastra_code_sdk_model_fallback.MODEL_FALLBACK_STATE_KEY]: null });
25995
25973
  };
25996
25974
  if (typeof pending.fromEntryId !== "string" || typeof pending.toEntryId !== "string" || typeof pending.toModelId !== "string" || pending.threadId !== void 0 && typeof pending.threadId !== "string" || pending.toEntryId.length === 0 || pending.toModelId.length === 0) {
25997
25975
  await clearPending();
@@ -26904,7 +26882,7 @@ async function dispatchEvent(event, ectx, state) {
26904
26882
  handleToolEnd(ectx, event.toolCallId, event.result, event.isError, event.providerMetadata);
26905
26883
  break;
26906
26884
  case "info":
26907
- ectx.showInfo(event.message.replace(/^Switched model route:/, "Switched model pack:"));
26885
+ ectx.showInfo(event.message);
26908
26886
  break;
26909
26887
  case "error":
26910
26888
  ectx.showFormattedError(event);
@@ -28867,11 +28845,11 @@ async function syncInitialThreadState(state, isCurrent = () => true) {
28867
28845
  const initThread = initThreads.find((t) => t.id === initThreadId);
28868
28846
  const metadata = initThread?.metadata;
28869
28847
  const persistedFallbackStatus = fallbackStatusFromMetadata(metadata);
28870
- const pendingFallback = metadata?.[_mastra_code_sdk_auth_account_rotation_processor.MODEL_FALLBACK_STATE_KEY];
28848
+ const pendingFallback = metadata?.[_mastra_code_sdk_model_fallback.MODEL_FALLBACK_STATE_KEY];
28871
28849
  const validPendingFallback = pendingFallback && typeof pendingFallback === "object" && typeof pendingFallback.fromEntryId === "string" && typeof pendingFallback.toEntryId === "string" && typeof pendingFallback.toModelId === "string" && (pendingFallback.reason === "pool-exhausted" || pendingFallback.reason === "persistent-outage") && typeof pendingFallback.at === "string" ? pendingFallback : null;
28872
- const currentPending = (state.session.state?.get?.())?.[_mastra_code_sdk_auth_account_rotation_processor.MODEL_FALLBACK_STATE_KEY];
28850
+ const currentPending = (state.session.state?.get?.())?.[_mastra_code_sdk_model_fallback.MODEL_FALLBACK_STATE_KEY];
28873
28851
  if (validPendingFallback || currentPending) {
28874
- const updates = { [_mastra_code_sdk_auth_account_rotation_processor.MODEL_FALLBACK_STATE_KEY]: validPendingFallback };
28852
+ const updates = { [_mastra_code_sdk_model_fallback.MODEL_FALLBACK_STATE_KEY]: validPendingFallback };
28875
28853
  if (!(state.session.state.setIf ? await state.session.state.setIf(updates, ownsUpdate) : ownsUpdate() ? await state.session.state.set(updates).then(() => true) : false) || !ownsUpdate()) return;
28876
28854
  }
28877
28855
  setCurrentThreadTitle(state, initThread?.title);
@@ -14,10 +14,11 @@ import path, { basename, dirname, extname, isAbsolute, join, relative, resolve }
14
14
  import { mastraBrand } from "@mastra/code-sdk/theme-palette";
15
15
  import chalk from "chalk";
16
16
  import { onEmbedderPackageMissing } from "@mastra/code-sdk/agents/fastembed-subprocess";
17
- import { ACCOUNT_SWITCH_PART_TYPE, MODEL_FALLBACK_PART_TYPE, MODEL_FALLBACK_STATE_KEY, accountSwitchNoticeText, isAccountSwitchReason, isModelFallbackReason, modelFallbackNoticeText, providerFromModelId } from "@mastra/code-sdk/auth/account-rotation-processor";
18
17
  import { PROVIDER_DEFAULT_MODELS, getOAuthProviders } from "@mastra/code-sdk/auth/storage";
18
+ import { MODEL_FALLBACK_PART_TYPE, MODEL_FALLBACK_STATE_KEY, modelFallbackNoticeText, parseModelFallbackPart } from "@mastra/code-sdk/model-fallback";
19
19
  import { ONBOARDING_VERSION, getAvailableModePacks, loadSettings as loadSettings$1, saveSettings as saveSettings$1 } from "@mastra/code-sdk/onboarding/index";
20
20
  import { detectPackageManager, fetchChangelog, fetchLatestVersion, isNewerVersion, performUpdate, planUpdate } from "@mastra/code-sdk/utils/update-check";
21
+ import { ACCOUNT_SWITCH_PART_TYPE, accountSwitchNoticeText, isAccountSwitchReason, providerFromModelId } from "@mastra/code-sdk/auth/account-rotation-processor";
21
22
  import { assignTaskIds, mastraDBMessageToSignal } from "@mastra/core/signals";
22
23
  import { z } from "zod";
23
24
  import { getCredentialProviderId, parseCodexModelSelection, remapOpenAIModelForCodexOAuth, withCodexFastModels } from "@mastra/code-sdk/providers/model-ids";
@@ -1765,29 +1766,6 @@ const OM_EVENT_BY_TYPE = {
1765
1766
  "data-om-observation-failed": "failed",
1766
1767
  "data-om-thread-update": "thread-title"
1767
1768
  };
1768
- function packFallbackRenderPart(data) {
1769
- if (!data || typeof data !== "object") return null;
1770
- const record = data;
1771
- const endpoint = (value) => {
1772
- if (!value || typeof value !== "object") return null;
1773
- const entry = value;
1774
- if (typeof entry.entryId !== "string" || typeof entry.label !== "string") return null;
1775
- return {
1776
- entryId: entry.entryId,
1777
- label: entry.label
1778
- };
1779
- };
1780
- const from = endpoint(record.from);
1781
- const to = endpoint(record.to);
1782
- if (!from || !to || !isModelFallbackReason(record.reason)) return null;
1783
- return {
1784
- kind: "pack-fallback",
1785
- from,
1786
- to,
1787
- reason: record.reason,
1788
- at: typeof record.at === "string" ? record.at : ""
1789
- };
1790
- }
1791
1769
  function accountSwitchRenderPart(data) {
1792
1770
  if (!data || typeof data !== "object") return null;
1793
1771
  const record = data;
@@ -1947,8 +1925,11 @@ function getAssistantRenderParts(message) {
1947
1925
  break;
1948
1926
  }
1949
1927
  if (partType === MODEL_FALLBACK_PART_TYPE) {
1950
- const hopPart = packFallbackRenderPart(part.data);
1951
- if (hopPart) out.push(hopPart);
1928
+ const hop = parseModelFallbackPart(part.data);
1929
+ if (hop) out.push({
1930
+ kind: "pack-fallback",
1931
+ ...hop
1932
+ });
1952
1933
  break;
1953
1934
  }
1954
1935
  const event = OM_EVENT_BY_TYPE[part.type];
@@ -6792,14 +6773,11 @@ var AccountSwitchNoticeComponent = class extends Container {
6792
6773
  return "other";
6793
6774
  }
6794
6775
  };
6795
- function packFallbackNoticeText(data) {
6796
- return modelFallbackNoticeText(data).replace("Switched model route:", "Switched model pack:");
6797
- }
6798
6776
  var PackFallbackNoticeComponent = class extends Container {
6799
6777
  textChild;
6800
6778
  constructor(data) {
6801
6779
  super();
6802
- this.textChild = new Text(theme.fg("muted", ` ⇄ ${packFallbackNoticeText(data)}`), 0, 0);
6780
+ this.textChild = new Text(theme.fg("muted", ` ⇄ ${modelFallbackNoticeText(data)}`), 0, 0);
6803
6781
  this.addChild(this.textChild);
6804
6782
  }
6805
6783
  getChatSpacingKind() {
@@ -26874,7 +26852,7 @@ async function dispatchEvent(event, ectx, state) {
26874
26852
  handleToolEnd(ectx, event.toolCallId, event.result, event.isError, event.providerMetadata);
26875
26853
  break;
26876
26854
  case "info":
26877
- ectx.showInfo(event.message.replace(/^Switched model route:/, "Switched model pack:"));
26855
+ ectx.showInfo(event.message);
26878
26856
  break;
26879
26857
  case "error":
26880
26858
  ectx.showFormattedError(event);
package/dist/tui.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_tui = require("./tui-guTrLOOr.cjs");
2
+ const require_tui = require("./tui-C7NUOVDN.cjs");
3
3
  let _mastra_code_sdk_theme_palette = require("@mastra/code-sdk/theme-palette");
4
4
  exports.AssistantMessageComponent = require_tui.AssistantMessageComponent;
5
5
  exports.LoginDialogComponent = require_tui.LoginDialogComponent;
package/dist/tui.js CHANGED
@@ -1 +1 @@
1
- export { h as AssistantMessageComponent, c as LoginDialogComponent, s as LoginSelectorComponent, t as MastraTUI, m as ModelSelectorComponent, l as OMProgressComponent, p as ToolExecutionComponentEnhanced, f as UserMessageComponent, v as applyThemeMode, d as createTUIState, u as formatOMStatus, y as getEditorTheme, b as getMarkdownTheme, x as getThemeMode, S as mastra, C as mastraBrand, w as theme } from "./tui-D5nvojR8.js";
1
+ export { h as AssistantMessageComponent, c as LoginDialogComponent, s as LoginSelectorComponent, t as MastraTUI, m as ModelSelectorComponent, l as OMProgressComponent, p as ToolExecutionComponentEnhanced, f as UserMessageComponent, v as applyThemeMode, d as createTUIState, u as formatOMStatus, y as getEditorTheme, b as getMarkdownTheme, x as getThemeMode, S as mastra, C as mastraBrand, w as theme } from "./tui-Dj2PcyWU.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mastracode",
3
- "version": "0.50.3",
3
+ "version": "0.50.4-alpha.0",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "files": [
@@ -107,18 +107,18 @@
107
107
  "yaml": "^2.9.1",
108
108
  "zod": "^4.6.7",
109
109
  "@mastra/agent-browser": "0.7.0",
110
- "@mastra/code-sdk": "^1.21.0",
111
- "@mastra/core": "1.86.0",
110
+ "@mastra/code-sdk": "^1.22.0-alpha.0",
112
111
  "@mastra/duckdb": "1.19.2",
113
112
  "@mastra/fastembed": "1.4.0",
113
+ "@mastra/core": "1.87.0-alpha.0",
114
114
  "@mastra/github-signals": "0.5.4",
115
- "@mastra/libsql": "1.32.0",
115
+ "@mastra/libsql": "1.33.0-alpha.0",
116
116
  "@mastra/mcp": "2.11.0",
117
117
  "@mastra/memory": "1.41.3",
118
- "@mastra/observability": "1.24.3",
119
- "@mastra/pg": "1.38.0",
120
- "@mastra/stagehand": "0.4.1",
118
+ "@mastra/observability": "1.24.4-alpha.0",
121
119
  "@mastra/schema-compat": "1.4.1",
120
+ "@mastra/pg": "1.39.0-alpha.0",
121
+ "@mastra/stagehand": "0.4.1",
122
122
  "@mastra/tavily": "1.1.4"
123
123
  },
124
124
  "devDependencies": {