mastracode 0.50.3 → 0.51.0-alpha.1

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,50 @@
1
1
  # mastracode
2
2
 
3
+ ## 0.51.0-alpha.1
4
+
5
+ ### Minor Changes
6
+
7
+ - Added a connection test, models from the endpoint, custom headers and an auth scheme choice to `/custom-providers`. Select a provider to find them: ([#31565](https://github.com/mastra-ai/mastra/pull/31565))
8
+
9
+ - **Add model** now offers the models the endpoint lists that are not added yet, one at a time or all at once, and still takes a typed ID. If the endpoint does not answer within a few seconds, it asks for the ID as before.
10
+ - **Test connection** calls the endpoint's model list and shows how many models it lists and how long it took. A failure shows the status, the URL called and the error text the endpoint returned.
11
+ - **Headers** adds or removes extra headers sent on every call. A secret value is masked while it is typed and shows as `••••`.
12
+ - **Auth scheme** sends the API key as `Authorization: Bearer <key>` or as `x-api-key: <key>`.
13
+
14
+ When an edit moves a provider's base URL to another origin, its secret headers are removed so their values are never sent to the new address. Add them again under **Headers**.
15
+
16
+ The choices are saved on the provider in `settings.json`:
17
+
18
+ ```json
19
+ {
20
+ "name": "Acme Gateway",
21
+ "authScheme": "x-api-key",
22
+ "headers": [{ "name": "X-Org-Id", "value": "org-123", "secret": false }]
23
+ }
24
+ ```
25
+
26
+ ### Patch Changes
27
+
28
+ - Updated dependencies [[`ad3d59f`](https://github.com/mastra-ai/mastra/commit/ad3d59f4a7c3557e3871b047ee48075a84731698), [`ad3d59f`](https://github.com/mastra-ai/mastra/commit/ad3d59f4a7c3557e3871b047ee48075a84731698), [`ad3d59f`](https://github.com/mastra-ai/mastra/commit/ad3d59f4a7c3557e3871b047ee48075a84731698), [`ad3d59f`](https://github.com/mastra-ai/mastra/commit/ad3d59f4a7c3557e3871b047ee48075a84731698), [`f19b0cf`](https://github.com/mastra-ai/mastra/commit/f19b0cf20c347921358943bb70c14051493088de), [`18439ea`](https://github.com/mastra-ai/mastra/commit/18439ea68fd5b009119e80af05cabc5ce5004c2b), [`21aee63`](https://github.com/mastra-ai/mastra/commit/21aee631dbb59e843b265706438865928185d500), [`6ae02c2`](https://github.com/mastra-ai/mastra/commit/6ae02c23a7aff35f229f46cc413c661309016e95)]:
29
+ - @mastra/core@1.87.0-alpha.1
30
+ - @mastra/code-sdk@1.22.0-alpha.1
31
+
32
+ ## 0.50.4-alpha.0
33
+
34
+ ### Patch Changes
35
+
36
+ - 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))
37
+
38
+ 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: …`.
39
+
40
+ - 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)]:
41
+ - @mastra/observability@1.24.4-alpha.0
42
+ - @mastra/core@1.87.0-alpha.0
43
+ - @mastra/pg@1.39.0-alpha.0
44
+ - @mastra/libsql@1.33.0-alpha.0
45
+ - @mastra/code-sdk@1.22.0-alpha.0
46
+ - @mastra/mcp@2.11.0
47
+
3
48
  ## 0.50.3
4
49
 
5
50
  ### 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-BU5p-oWh.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-Bb5I2Op2.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.51.0-alpha.1"
7
7
  ---
8
8
 
9
9
  ## When to use
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.50.3",
2
+ "version": "0.51.0-alpha.1",
3
3
  "package": "mastracode",
4
4
  "exports": {},
5
5
  "modules": {}
@@ -1,4 +1,4 @@
1
- const require_tui = require("./tui-guTrLOOr.cjs");
1
+ const require_tui = require("./tui-vycpsgSv.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.51.0-alpha.1";
268
268
  }
269
269
  /** Whether the invocation is `mastracode --version` or `mastracode -v`. */
270
270
  function isVersionCommand(argv) {
@@ -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-DhXpcMRs.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.51.0-alpha.1";
267
267
  }
268
268
  /** Whether the invocation is `mastracode --version` or `mastracode -v`. */
269
269
  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-BU5p-oWh.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-Bb5I2Op2.js";
@@ -1,8 +1,46 @@
1
1
  import { removeCustomProviderFromSettings, upsertCustomProviderInSettings } from '@mastra/code-sdk/onboarding/custom-providers';
2
- import type { GlobalSettings } from '@mastra/code-sdk/onboarding/settings';
2
+ import type { CustomProviderAuthScheme, CustomProviderHeader, CustomProviderSetting, GlobalSettings } from '@mastra/code-sdk/onboarding/settings';
3
3
  import type { SlashCommandContext } from './types.js';
4
4
  export { removeCustomProviderFromSettings, upsertCustomProviderInSettings };
5
5
  export declare function addModelToCustomProviderInSettings(settings: GlobalSettings, providerId: string, modelName: string): boolean;
6
6
  export declare function removeModelFromCustomProviderInSettings(settings: GlobalSettings, providerId: string, modelName: string): boolean;
7
+ /**
8
+ * Add several model ids to a provider at once and return how many were new.
9
+ * Ids already configured and blank ids are skipped.
10
+ */
11
+ export declare function addModelsToCustomProviderInSettings(settings: GlobalSettings, providerId: string, modelNames: readonly string[]): number;
12
+ /**
13
+ * The model IDs from an endpoint's list that are worth offering to add.
14
+ *
15
+ * IDs are read the way `parseCustomProviders` reads saved models: trimmed, and
16
+ * with a leading `<providerId>/` removed. Otherwise `acme/foo` would be saved,
17
+ * read back as `foo`, and offered again forever. IDs already configured are
18
+ * left out, and so are IDs equal to a label in `reservedLabels`, because the
19
+ * menu matches picks by label and such an ID would trigger that action.
20
+ */
21
+ export declare function endpointModelsToOffer(listed: readonly string[], provider: Pick<CustomProviderSetting, 'name' | 'models'>, reservedLabels: readonly string[]): string[];
22
+ /**
23
+ * Change how a provider sends its API key. Returns why the change is refused,
24
+ * or undefined once it is applied. A saved custom header may already use the
25
+ * header the new scheme writes, so the headers are checked against it first.
26
+ */
27
+ export declare function setCustomProviderAuthSchemeInSettings(settings: GlobalSettings, providerId: string, authScheme: CustomProviderAuthScheme): string | undefined;
28
+ /**
29
+ * Add a custom header to a provider. Returns why the header is refused, or
30
+ * undefined once it is added.
31
+ */
32
+ export declare function addHeaderToCustomProviderInSettings(settings: GlobalSettings, providerId: string, header: CustomProviderHeader): string | undefined;
33
+ /** Remove a custom header from a provider by name, ignoring case. Returns whether one was removed. */
34
+ export declare function removeHeaderFromCustomProviderInSettings(settings: GlobalSettings, providerId: string, headerName: string): boolean;
35
+ /**
36
+ * Split a provider's headers for an edit that moves it from `previousUrl` to
37
+ * `nextUrl`. A saved secret is never sent to a new origin unless the user
38
+ * types it again, so secret headers are dropped when the origin changes.
39
+ * A header saved without a `secret` flag counts as secret.
40
+ */
41
+ export declare function headersForCustomProviderUrlChange(headers: readonly CustomProviderHeader[], previousUrl: string, nextUrl: string): {
42
+ kept: CustomProviderHeader[];
43
+ removed: CustomProviderHeader[];
44
+ };
7
45
  export declare function handleCustomProvidersCommand(ctx: SlashCommandContext): Promise<void>;
8
46
  //# sourceMappingURL=custom-providers.d.ts.map
@@ -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);
@@ -22,6 +22,8 @@ export interface AskQuestionDialogOptions {
22
22
  * Defaults to false. Enable for prompts that legitimately want paragraph-length replies.
23
23
  */
24
24
  multiline?: boolean;
25
+ /** Show typed text as asterisks, for secrets. Applies to single-line input only. */
26
+ masked?: boolean;
25
27
  allowEmptyInput?: boolean;
26
28
  defaultValue?: string;
27
29
  allowCustomResponse?: boolean;
@@ -41,6 +43,7 @@ export declare class AskQuestionDialogComponent extends Box implements Focusable
41
43
  private input?;
42
44
  private tui?;
43
45
  private multiline;
46
+ private masked;
44
47
  private multiSelect;
45
48
  private allowEmptyInput;
46
49
  private defaultValue?;
@@ -58,6 +61,7 @@ export declare class AskQuestionDialogComponent extends Box implements Focusable
58
61
  private buildSelectMode;
59
62
  /** Whether this prompt should render a multiline editor (vs a single-line input). */
60
63
  private useMultiline;
64
+ /** Add the text input, its hint and the default value. A masked prompt uses `MaskedInput`. */
61
65
  private buildInputMode;
62
66
  private switchToCustomInput;
63
67
  handleInput(data: string): void;
@@ -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';
@@ -13,10 +13,13 @@ export type ModalQuestionOptions = {
13
13
  allowCustomResponse?: boolean;
14
14
  selectedOptionLabel?: string;
15
15
  multiline?: boolean;
16
+ /** Show typed text as asterisks, for secrets. */
17
+ masked?: boolean;
16
18
  overlay?: {
17
19
  widthPercent?: number;
18
20
  maxHeight?: OverlayOptions['maxHeight'];
19
21
  };
20
22
  };
23
+ /** Show a question dialog over the TUI and resolve with the answer, or null when the user cancels. */
21
24
  export declare function askModalQuestion(tui: TUI, options: ModalQuestionOptions): Promise<string | null>;
22
25
  //# sourceMappingURL=modal-question.d.ts.map