mastracode 0.50.4-alpha.0 → 0.51.0-alpha.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.
Files changed (49) hide show
  1. package/CHANGELOG.md +52 -0
  2. package/dist/cli.cjs +1 -1
  3. package/dist/cli.js +1 -1
  4. package/dist/docs/SKILL.md +1 -1
  5. package/dist/docs/assets/SOURCE_MAP.json +1 -1
  6. package/dist/{run-tui-iN-yMNdP.cjs → run-tui-B78GKKLA.cjs} +2 -2
  7. package/dist/{run-tui-Cro2miV4.js → run-tui-BJWu37Sb.js} +2 -2
  8. package/dist/run-tui.cjs +1 -1
  9. package/dist/run-tui.js +1 -1
  10. package/dist/tui/command-dispatch.d.ts +2 -0
  11. package/dist/tui/commands/custom-providers.d.ts +39 -1
  12. package/dist/tui/components/api-key-dialog.d.ts +3 -1
  13. package/dist/tui/components/ask-question-dialog.d.ts +12 -2
  14. package/dist/tui/components/ask-question-inline.d.ts +2 -2
  15. package/dist/tui/components/background-activity-selector.d.ts +7 -2
  16. package/dist/tui/components/custom-editor.d.ts +2 -0
  17. package/dist/tui/components/github-pr-picker.d.ts +9 -2
  18. package/dist/tui/components/goal-cycles-dialog.d.ts +3 -1
  19. package/dist/tui/components/knowledge-browser.d.ts +3 -1
  20. package/dist/tui/components/list-window.d.ts +19 -0
  21. package/dist/tui/components/login-account-manager.d.ts +5 -4
  22. package/dist/tui/components/login-dialog.d.ts +4 -1
  23. package/dist/tui/components/login-mode-selector.d.ts +6 -8
  24. package/dist/tui/components/login-selector.d.ts +10 -13
  25. package/dist/tui/components/mcp-selector.d.ts +3 -1
  26. package/dist/tui/components/menu-chrome.d.ts +42 -0
  27. package/dist/tui/components/menu-list.d.ts +45 -0
  28. package/dist/tui/components/model-selector.d.ts +27 -27
  29. package/dist/tui/components/om-settings.d.ts +11 -7
  30. package/dist/tui/components/picker-list.d.ts +16 -8
  31. package/dist/tui/components/settings-menu.d.ts +29 -0
  32. package/dist/tui/components/settings.d.ts +7 -6
  33. package/dist/tui/components/simple-select.d.ts +1 -1
  34. package/dist/tui/components/text-input.d.ts +14 -0
  35. package/dist/tui/components/thread-selector.d.ts +10 -6
  36. package/dist/tui/components/wrapping-autocomplete-list.d.ts +1 -0
  37. package/dist/tui/components/wrapping-select-list.d.ts +4 -1
  38. package/dist/tui/modal-question.d.ts +3 -0
  39. package/dist/tui/mouse/controller.d.ts +13 -8
  40. package/dist/tui/mouse/pi-tui-internals.d.ts +5 -12
  41. package/dist/tui/overlay.d.ts +9 -1
  42. package/dist/tui/prompt-slot.d.ts +94 -0
  43. package/dist/tui/state.d.ts +5 -2
  44. package/dist/tui/theme.d.ts +5 -2
  45. package/dist/{tui-Dj2PcyWU.js → tui-JGaSJ4Pq.js} +2186 -1146
  46. package/dist/{tui-C7NUOVDN.cjs → tui-dAtLRHBO.cjs} +2184 -1144
  47. package/dist/tui.cjs +1 -1
  48. package/dist/tui.js +1 -1
  49. package/package.json +4 -4
package/CHANGELOG.md CHANGED
@@ -1,5 +1,57 @@
1
1
  # mastracode
2
2
 
3
+ ## 0.51.0-alpha.2
4
+
5
+ ### Minor Changes
6
+
7
+ - Menus now open in place of the prompt instead of as pop-ups over the chat. This includes `/settings`, `/models` and its sub-menus, `/theme`, `/goal`, `/think`, `/threads`, `/login` and the other commands that open a menu. While the full-screen setup is open, menus still appear on top of it. ([#28476](https://github.com/mastra-ai/mastra/pull/28476))
8
+
9
+ - **Lists** share the same layout: type to filter, arrow keys wrap around, the list scrolls only when the cursor reaches its edge, labels and descriptions line up in columns, and Backspace on an empty search goes back. Menus with letter shortcuts (such as `/mcp`) and text inputs keep their own keys.
10
+ - **Height:** a menu fits the terminal it opens in and keeps its height while you filter. Closing it brings back the chat rows it covered. Menus in the prompt's place ignore the `maxHeight` overlay option.
11
+ - **Breadcrumbs:** settings submenus show where you are ("settings › notifications").
12
+ - **API keys:** `/api-keys` removes a stored key with Delete only (Fn+Delete on a Mac laptop). Backspace used to remove it too; it now edits the search, and closes the menu when the search is empty.
13
+ - **Suggestions:** command suggestions no longer scroll the chat or leave blank rows under the status line.
14
+ - **Loading:** slow menus such as `/models` and `/model` show a loading row right away. Esc cancels only the menu it was waiting for.
15
+
16
+ `ModelSelectorComponent` no longer draws its own title, hint line or search field, and `titleColor` has no effect. `getSearchInput()` was removed. If you used it to filter the models, use `setFilter()`:
17
+
18
+ ```ts
19
+ // Before
20
+ selector.getSearchInput().setValue('gpt');
21
+
22
+ // After
23
+ selector.setFilter('gpt');
24
+ ```
25
+
26
+ ## 0.51.0-alpha.1
27
+
28
+ ### Minor Changes
29
+
30
+ - 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))
31
+
32
+ - **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.
33
+ - **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.
34
+ - **Headers** adds or removes extra headers sent on every call. A secret value is masked while it is typed and shows as `••••`.
35
+ - **Auth scheme** sends the API key as `Authorization: Bearer <key>` or as `x-api-key: <key>`.
36
+
37
+ 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**.
38
+
39
+ The choices are saved on the provider in `settings.json`:
40
+
41
+ ```json
42
+ {
43
+ "name": "Acme Gateway",
44
+ "authScheme": "x-api-key",
45
+ "headers": [{ "name": "X-Org-Id", "value": "org-123", "secret": false }]
46
+ }
47
+ ```
48
+
49
+ ### Patch Changes
50
+
51
+ - 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)]:
52
+ - @mastra/core@1.87.0-alpha.1
53
+ - @mastra/code-sdk@1.22.0-alpha.1
54
+
3
55
  ## 0.50.4-alpha.0
4
56
 
5
57
  ### 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-iN-yMNdP.cjs").runTui();
6
+ require("./run-tui-B78GKKLA.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-Cro2miV4.js";
2
+ import { t as runTui } from "./run-tui-BJWu37Sb.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.4-alpha.0"
6
+ version: "0.51.0-alpha.2"
7
7
  ---
8
8
 
9
9
  ## When to use
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.50.4-alpha.0",
2
+ "version": "0.51.0-alpha.2",
3
3
  "package": "mastracode",
4
4
  "exports": {},
5
5
  "modules": {}
@@ -1,4 +1,4 @@
1
- const require_tui = require("./tui-C7NUOVDN.cjs");
1
+ const require_tui = require("./tui-dAtLRHBO.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.4-alpha.0";
267
+ return "0.51.0-alpha.2";
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-Dj2PcyWU.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-JGaSJ4Pq.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.4-alpha.0";
266
+ return "0.51.0-alpha.2";
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-iN-yMNdP.cjs");
2
+ const require_run_tui = require("./run-tui-B78GKKLA.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-Cro2miV4.js";
1
+ export { t as runTui } from "./run-tui-BJWu37Sb.js";
@@ -1,5 +1,7 @@
1
1
  import type { SlashCommandContext } from './commands/types.js';
2
2
  import type { TUIState } from './state.js';
3
+ /** The menu a slash command opens ("models" for "/models"), for the slot's loading row; else undefined. */
4
+ export declare function menuCommandName(input: string): string | undefined;
3
5
  /**
4
6
  * Dispatch a slash command input to the appropriate handler.
5
7
  * Returns true if the command was handled (or was unknown), false if not a command.
@@ -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
@@ -5,6 +5,7 @@
5
5
  */
6
6
  import { Box } from '@earendil-works/pi-tui';
7
7
  import type { Focusable } from '@earendil-works/pi-tui';
8
+ import type { MenuChrome } from './menu-chrome.js';
8
9
  export interface ApiKeyDialogOptions {
9
10
  /** Provider name shown in the title (e.g., "Google") */
10
11
  providerName: string;
@@ -15,7 +16,7 @@ export interface ApiKeyDialogOptions {
15
16
  /** Called when the user cancels */
16
17
  onCancel: () => void;
17
18
  }
18
- export declare class ApiKeyDialogComponent extends Box implements Focusable {
19
+ export declare class ApiKeyDialogComponent extends Box implements Focusable, MenuChrome {
19
20
  private input;
20
21
  private onSubmit;
21
22
  private onCancel;
@@ -23,6 +24,7 @@ export declare class ApiKeyDialogComponent extends Box implements Focusable {
23
24
  get focused(): boolean;
24
25
  set focused(value: boolean);
25
26
  constructor(options: ApiKeyDialogOptions);
27
+ menuTitle(): string;
26
28
  handleInput(data: string): void;
27
29
  }
28
30
  //# sourceMappingURL=api-key-dialog.d.ts.map
@@ -3,9 +3,10 @@
3
3
  * Shows a question with either selectable options or free-text input.
4
4
  * Used by the ask_user tool to collect structured answers from the user.
5
5
  */
6
- import { Box } from '@earendil-works/pi-tui';
6
+ import { Container } from '@earendil-works/pi-tui';
7
7
  import type { Focusable, TUI } from '@earendil-works/pi-tui';
8
8
  import type { AskQuestionSelectionMode } from './ask-question-inline.js';
9
+ import type { MenuChrome, MenuHint } from './menu-chrome.js';
9
10
  export interface AskQuestionDialogOptions {
10
11
  question: string;
11
12
  /** Dialog heading. Defaults to "Question". */
@@ -22,6 +23,8 @@ export interface AskQuestionDialogOptions {
22
23
  * Defaults to false. Enable for prompts that legitimately want paragraph-length replies.
23
24
  */
24
25
  multiline?: boolean;
26
+ /** Show typed text as asterisks, for secrets. Applies to single-line input only. */
27
+ masked?: boolean;
25
28
  allowEmptyInput?: boolean;
26
29
  defaultValue?: string;
27
30
  allowCustomResponse?: boolean;
@@ -35,12 +38,14 @@ export interface AskQuestionDialogOptions {
35
38
  onSubmitMulti?: (answers: string[]) => void;
36
39
  onCancel: () => void;
37
40
  }
38
- export declare class AskQuestionDialogComponent extends Box implements Focusable {
41
+ export declare class AskQuestionDialogComponent extends Container implements Focusable, MenuChrome {
39
42
  private static readonly CUSTOM_RESPONSE_VALUE;
40
43
  private selectList?;
44
+ private readonly title;
41
45
  private input?;
42
46
  private tui?;
43
47
  private multiline;
48
+ private masked;
44
49
  private multiSelect;
45
50
  private allowEmptyInput;
46
51
  private defaultValue?;
@@ -56,8 +61,13 @@ export declare class AskQuestionDialogComponent extends Box implements Focusable
56
61
  set focused(value: boolean);
57
62
  constructor(options: AskQuestionDialogOptions);
58
63
  private buildSelectMode;
64
+ /** Backspace never skips the question (Esc does). */
65
+ readonly menuKeepsBackspace = true;
66
+ menuTitle(): string;
67
+ menuHints(): readonly MenuHint[];
59
68
  /** Whether this prompt should render a multiline editor (vs a single-line input). */
60
69
  private useMultiline;
70
+ /** Add the text input, its hint and the default value. A masked prompt uses `MaskedInput`. */
61
71
  private buildInputMode;
62
72
  private switchToCustomInput;
63
73
  handleInput(data: string): void;
@@ -95,13 +95,13 @@ export declare class AskQuestionBorderedBox {
95
95
  private renderSafe;
96
96
  /**
97
97
  * Borderless card with a colored left bar (▎):
98
- * - waiting for an answer: accent bar, bold question, ❯ options, hint
98
+ * - waiting for an answer: accent bar, bold question, → options, hint
99
99
  * - answered: muted question with the options frozen (✓ on the chosen ones), or "✓ answer" for
100
100
  * free text; a card answered live keeps the height it had while waiting (see render)
101
101
  */
102
102
  private _render;
103
103
  }
104
- /** Option list styling shared by inline prompts: accent ❯ cursor, bold selected label, ●/○ toggles. */
104
+ /** Option list styling shared by inline prompts: the menus' accent → cursor and bold label, ●/○ toggles. */
105
105
  export declare const INLINE_CARD_LIST_STYLE: {
106
106
  readonly cursor: string;
107
107
  readonly checked: string;
@@ -1,6 +1,7 @@
1
- import { Box } from '@earendil-works/pi-tui';
1
+ import { Container } from '@earendil-works/pi-tui';
2
2
  import type { TUI } from '@earendil-works/pi-tui';
3
3
  import type { BackgroundActivity } from '../background-activity.js';
4
+ import type { Filterable, MenuChrome, MenuHint } from './menu-chrome.js';
4
5
  export interface BackgroundActivitySelectorOptions {
5
6
  tui: TUI;
6
7
  activities: BackgroundActivity[];
@@ -8,12 +9,16 @@ export interface BackgroundActivitySelectorOptions {
8
9
  onCancel: () => void;
9
10
  onAbort: (activity: BackgroundActivity) => void;
10
11
  }
11
- export declare class BackgroundActivitySelectorComponent extends Box {
12
+ export declare class BackgroundActivitySelectorComponent extends Container implements MenuChrome {
12
13
  focused: boolean;
13
14
  private readonly list;
14
15
  private readonly getActivity;
15
16
  private readonly onAbort;
16
17
  constructor(options: BackgroundActivitySelectorOptions);
18
+ menuTitle(): string;
19
+ menuHints(): readonly MenuHint[];
20
+ /** Letters are shortcuts here (d aborts), so typing does not filter. */
21
+ menuFilterTarget(): Filterable | undefined;
17
22
  handleInput(data: string): void;
18
23
  }
19
24
  //# sourceMappingURL=background-activity-selector.d.ts.map
@@ -45,6 +45,8 @@ export declare class CustomEditor extends Editor {
45
45
  private lastCursorRow;
46
46
  private lastRenderedRowCount;
47
47
  private lastAutocompleteStartRow;
48
+ /** Rows of the last render taken by the suggestions and the blank row above them. */
49
+ suggestionRows: number;
48
50
  /** Autocomplete list row under the mouse pointer, so hover follows the pointer when the list scrolls. */
49
51
  private hoveredAutocompleteRow;
50
52
  private inputLayout;
@@ -1,5 +1,6 @@
1
1
  import { Box } from '@earendil-works/pi-tui';
2
2
  import type { Focusable, TUI } from '@earendil-works/pi-tui';
3
+ import type { Filterable, MenuChrome, MenuHint } from './menu-chrome.js';
3
4
  export interface GithubPRPickerItem {
4
5
  owner?: string;
5
6
  repo?: string;
@@ -27,8 +28,8 @@ export declare function githubPRId(pr: {
27
28
  repo?: string;
28
29
  number: number;
29
30
  }): string;
30
- export declare class GithubPRPickerDialog extends Box implements Focusable {
31
- private searchInput;
31
+ export declare class GithubPRPickerDialog extends Box implements Focusable, Filterable, MenuChrome {
32
+ private query;
32
33
  private listContainer;
33
34
  private list;
34
35
  private viewTabs;
@@ -60,6 +61,12 @@ export declare class GithubPRPickerDialog extends Box implements Focusable {
60
61
  private buildUI;
61
62
  private renderViewTabs;
62
63
  private cycleView;
64
+ /** Space toggles the highlighted PR, also while searching. */
65
+ readonly menuKeepsSpace = true;
66
+ menuTitle(): string;
67
+ menuHints(): readonly MenuHint[];
68
+ menuFilterTarget(): Filterable;
69
+ setFilter(query: string): void;
63
70
  private filterPullRequests;
64
71
  private hasId;
65
72
  private toggleSelection;
@@ -4,12 +4,13 @@
4
4
  */
5
5
  import { Box } from '@earendil-works/pi-tui';
6
6
  import type { Focusable } from '@earendil-works/pi-tui';
7
+ import type { MenuChrome } from './menu-chrome.js';
7
8
  export interface GoalCyclesDialogOptions {
8
9
  defaultValue: number;
9
10
  onSubmit: (maxCycles: number) => void;
10
11
  onCancel: () => void;
11
12
  }
12
- export declare class GoalCyclesDialogComponent extends Box implements Focusable {
13
+ export declare class GoalCyclesDialogComponent extends Box implements Focusable, MenuChrome {
13
14
  private input;
14
15
  private onSubmit;
15
16
  private onCancel;
@@ -17,6 +18,7 @@ export declare class GoalCyclesDialogComponent extends Box implements Focusable
17
18
  get focused(): boolean;
18
19
  set focused(value: boolean);
19
20
  constructor(options: GoalCyclesDialogOptions);
21
+ menuTitle(): string;
20
22
  handleInput(data: string): void;
21
23
  }
22
24
  //# sourceMappingURL=goal-cycles-dialog.d.ts.map
@@ -1,12 +1,14 @@
1
1
  import type { Component, Focusable, TUI } from '@earendil-works/pi-tui';
2
2
  import type { KnowledgeInspector } from '@mastra/code-sdk';
3
+ import type { MenuChrome, MenuHint } from './menu-chrome.js';
3
4
  export type KnowledgeBrowserSection = 'scopes' | 'nodes' | 'activity';
4
5
  export interface KnowledgeBrowserOptions {
5
6
  tui: TUI;
6
7
  inspector: KnowledgeInspector;
7
8
  onClose: () => void;
8
9
  }
9
- export declare class KnowledgeBrowserComponent implements Component, Focusable {
10
+ export declare class KnowledgeBrowserComponent implements Component, Focusable, MenuChrome {
11
+ menuHints(): readonly MenuHint[];
10
12
  private readonly tui;
11
13
  private readonly inspector;
12
14
  private readonly onClose;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Which rows of a scrolled list are visible. The window stays still while the cursor moves and only
3
+ * scrolls once the cursor reaches its top or bottom edge, like most pickers (pi-tui centers the
4
+ * selection instead, which moves every row under a fixed cursor).
5
+ */
6
+ export declare class ListWindow {
7
+ private start;
8
+ private limit;
9
+ private shown;
10
+ /** Items drawn by the last `range` call. */
11
+ get shownItems(): number;
12
+ /** Shows at most `items` items however many the list asks for (a short terminal); undefined lifts it. */
13
+ setLimit(items: number | undefined): void;
14
+ range(selected: number, total: number, wanted: number): {
15
+ startIndex: number;
16
+ endIndex: number;
17
+ };
18
+ }
19
+ //# sourceMappingURL=list-window.d.ts.map
@@ -6,7 +6,8 @@
6
6
  * Add another account / Back. Selecting an account opens a submenu for
7
7
  * it: Set as active / Re-authenticate… / Remove… / Back.
8
8
  */
9
- import { Box } from '@earendil-works/pi-tui';
9
+ import { Container } from '@earendil-works/pi-tui';
10
+ import type { MenuChrome } from './menu-chrome.js';
10
11
  export interface ManagedAccount {
11
12
  id: string;
12
13
  label: string;
@@ -19,8 +20,7 @@ export interface LoginAccountManagerCallbacks {
19
20
  onActivate(accountId: string): void;
20
21
  onBack(): void;
21
22
  }
22
- export declare class LoginAccountManagerComponent extends Box {
23
- private listContainer;
23
+ export declare class LoginAccountManagerComponent extends Container implements MenuChrome {
24
24
  private list;
25
25
  private mode;
26
26
  private accounts;
@@ -34,8 +34,9 @@ export declare class LoginAccountManagerComponent extends Box {
34
34
  setAccounts(accounts: ManagedAccount[]): void;
35
35
  private rows;
36
36
  private backToMenu;
37
+ /** "Anthropic accounts", or "Anthropic accounts › work" while an account's actions are open. */
38
+ menuTitle(): string;
37
39
  private updateList;
38
- private renderRow;
39
40
  handleInput(keyData: string): void;
40
41
  }
41
42
  //# sourceMappingURL=login-account-manager.d.ts.map
@@ -3,8 +3,11 @@
3
3
  */
4
4
  import { Box } from '@earendil-works/pi-tui';
5
5
  import type { Focusable, TUI } from '@earendil-works/pi-tui';
6
- export declare class LoginDialogComponent extends Box implements Focusable {
6
+ import type { MenuChrome } from './menu-chrome.js';
7
+ export declare class LoginDialogComponent extends Box implements Focusable, MenuChrome {
7
8
  private onComplete;
9
+ private readonly providerName;
10
+ menuTitle(): string;
8
11
  private contentContainer;
9
12
  private input;
10
13
  private tui;
@@ -4,17 +4,15 @@
4
4
  * (for example) "Browser (local callback)" vs "Device code (headless)" without setting
5
5
  * an env var.
6
6
  */
7
- import { Box } from '@earendil-works/pi-tui';
7
+ import { Container } from '@earendil-works/pi-tui';
8
8
  import type { TUI } from '@earendil-works/pi-tui';
9
9
  import type { AuthMode } from '@mastra/code-sdk/auth/types';
10
- export declare class LoginModeSelectorComponent extends Box {
11
- private list;
12
- private modes;
13
- private selectedIndex;
14
- private onSelectCallback;
15
- private onCancelCallback;
10
+ import type { MenuChrome } from './menu-chrome.js';
11
+ export declare class LoginModeSelectorComponent extends Container implements MenuChrome {
12
+ private readonly providerName;
13
+ private readonly list;
16
14
  constructor(providerName: string, modes: ReadonlyArray<AuthMode>, onSelect: (modeId: string) => void, onCancel: () => void);
17
- private updateList;
15
+ menuTitle(): string;
18
16
  handleInput(keyData: string): void;
19
17
  }
20
18
  /**
@@ -1,8 +1,9 @@
1
1
  /**
2
2
  * OAuth provider selector component for /login and /logout commands
3
3
  */
4
- import { Box } from '@earendil-works/pi-tui';
4
+ import { Container } from '@earendil-works/pi-tui';
5
5
  import type { OAuthProviderInterface } from '@mastra/code-sdk/auth/types';
6
+ import type { MenuChrome } from './menu-chrome.js';
6
7
  /**
7
8
  * Interface for auth provider that the selector needs.
8
9
  * Can be satisfied by AgentController or AuthStorage.
@@ -13,19 +14,15 @@ export interface AuthProviderSource {
13
14
  /** Number of registered accounts for the provider, when the source tracks them. */
14
15
  countAccounts?(providerId: string): number;
15
16
  }
16
- export declare class LoginSelectorComponent extends Box {
17
- private listContainer;
18
- private list;
19
- private allProviders;
20
- private selectedIndex;
21
- private mode;
22
- private authSource;
23
- private onSelectCallback;
24
- private onCancelCallback;
17
+ export declare class LoginSelectorComponent extends Container implements MenuChrome {
18
+ private readonly mode;
19
+ private readonly authSource;
20
+ private readonly onCancel;
21
+ private readonly list?;
25
22
  constructor(mode: 'login' | 'logout', authSource: AuthProviderSource, onSelect: (providerId: string) => void, onCancel: () => void);
26
- private loadProviders;
27
- private updateList;
28
- private renderProvider;
23
+ menuTitle(): string;
24
+ /** "✓ stored (2 accounts)" when the provider has stored credentials, else "unconfigured". */
25
+ private status;
29
26
  handleInput(keyData: string): void;
30
27
  }
31
28
  //# sourceMappingURL=login-selector.d.ts.map
@@ -5,6 +5,7 @@
5
5
  import { Box } from '@earendil-works/pi-tui';
6
6
  import type { Focusable, TUI } from '@earendil-works/pi-tui';
7
7
  import type { McpServerStatus, McpSkippedServer } from '@mastra/code-sdk/mcp/types';
8
+ import type { MenuChrome, MenuHint } from './menu-chrome.js';
8
9
  export interface McpSelectorOptions {
9
10
  /** TUI instance for rendering */
10
11
  tui: TUI;
@@ -57,7 +58,8 @@ export interface McpSelectorOptions {
57
58
  /** Callback when selector is dismissed */
58
59
  onClose: () => void;
59
60
  }
60
- export declare class McpSelectorComponent extends Box implements Focusable {
61
+ export declare class McpSelectorComponent extends Box implements Focusable, MenuChrome {
62
+ menuHints(): readonly MenuHint[];
61
63
  private listContainer;
62
64
  private statuses;
63
65
  private skipped;
@@ -0,0 +1,42 @@
1
+ /**
2
+ * What a menu tells the prompt slot about itself. Menus open with a title (`showModalOverlay(…, { title })`);
3
+ * these optional hooks cover what changes while a menu is open.
4
+ */
5
+ import type { Component } from '@earendil-works/pi-tui';
6
+ import type { ListWindow } from './list-window.js';
7
+ /** A menu-specific key shown under the menu as a keycap, e.g. tab to clone a thread. */
8
+ export interface MenuHint {
9
+ key: string;
10
+ label: string;
11
+ }
12
+ /** A list that typing in the prompt slot filters. */
13
+ export interface Filterable {
14
+ setFilter(query: string): void;
15
+ }
16
+ export interface MenuChrome {
17
+ /** Overrides the opening title while the menu is open, e.g. "settings › notifications" in a submenu. */
18
+ menuTitle?(): string | undefined;
19
+ /** Keys that only this menu has. Shared keys (↑↓, enter, esc) are never shown. */
20
+ menuHints?(): readonly MenuHint[];
21
+ /** The list typing filters right now (a submenu's list while it is open), or undefined for none. */
22
+ menuFilterTarget?(): Filterable | undefined;
23
+ /** The scroll window of the list on screen, which the frame shrinks to fit a short terminal. */
24
+ menuWindow?(): ListWindow | undefined;
25
+ /**
26
+ * Backspace on an empty search goes back (closes the menu) unless this is true; the menu then gets
27
+ * it itself (e.g. a question is not skipped).
28
+ */
29
+ readonly menuKeepsBackspace?: boolean;
30
+ /** Space always goes to the menu, even after search text (multi-select lists toggle with it). */
31
+ readonly menuKeepsSpace?: boolean;
32
+ }
33
+ /** The list that typing should filter: the first component in the tree that names one. */
34
+ export declare function findFilterTarget(component: Component): Filterable | undefined;
35
+ /** The scroll window of the list on screen: the first one a component in the tree names. */
36
+ export declare function findMenuWindow(component: Component): ListWindow | undefined;
37
+ /**
38
+ * Lowercases a title's first letter unless its first word is an acronym or a name, so titles read like
39
+ * placeholders: "Select thread" → "select thread", "API keys" and "GitHub signals" stay.
40
+ */
41
+ export declare function lowerFirst<T extends string | undefined>(text: T): T;
42
+ //# sourceMappingURL=menu-chrome.d.ts.map
@@ -0,0 +1,45 @@
1
+ /**
2
+ * The list every menu uses: one row per item with the label in a column sized to the longest label and
3
+ * its description in a dim second column, an accent arrow and bold label on the selected row, wrap-around
4
+ * arrow keys, a window that scrolls only at its edges, and type-to-filter (the prompt slot calls
5
+ * `setFilter` as you type).
6
+ */
7
+ import { Text } from '@earendil-works/pi-tui';
8
+ import type { Component, SelectItem } from '@earendil-works/pi-tui';
9
+ import type { MouseAware, MousePoint, MouseTarget } from '../mouse/hit-test.js';
10
+ import { ListWindow } from './list-window.js';
11
+ import type { Filterable, MenuChrome } from './menu-chrome.js';
12
+ /** Width of a label column that fits every label (up to the cap), gap included. */
13
+ export declare function labelColumnWidth(labels: readonly string[]): number;
14
+ /**
15
+ * One menu row, for lists that draw their own rows (threads, models, MCP servers): cursor, label padded
16
+ * to `column`, then `details`. Colors inside `label` and `details` are kept; the selected label is bold.
17
+ */
18
+ export declare function menuRow(selected: boolean, label: string, details?: string, column?: number): string;
19
+ /** A note under a menu's list ("Session override — …"), starting where the row labels start. */
20
+ export declare function menuNote(text: string, color?: 'dim' | 'warning' | 'error'): Text;
21
+ export declare class MenuList implements Component, Filterable, MenuChrome, MouseAware {
22
+ private readonly maxVisible;
23
+ private items;
24
+ private filteredItems;
25
+ private selectedIndex;
26
+ private readonly window;
27
+ onSelect?: (item: SelectItem) => void;
28
+ onCancel?: () => void;
29
+ onSelectionChange?: (item: SelectItem) => void;
30
+ constructor(items: SelectItem[], maxVisible?: number);
31
+ menuFilterTarget(): Filterable;
32
+ menuWindow(): ListWindow;
33
+ /** Keeps the items whose label fuzzy-matches `query`, best match first, and selects the first. */
34
+ setFilter(query: string): void;
35
+ setSelectedIndex(index: number): void;
36
+ getSelectedItem(): SelectItem | null;
37
+ invalidate(): void;
38
+ render(width: number): string[];
39
+ /** One row per visible item; a click does what Enter would. */
40
+ mouseTarget(point: MousePoint): MouseTarget | undefined;
41
+ private visibleRange;
42
+ handleInput(keyData: string): void;
43
+ private notifySelectionChange;
44
+ }
45
+ //# sourceMappingURL=menu-list.d.ts.map