mastracode 0.51.0-alpha.1 → 0.51.0-alpha.3
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 +31 -0
- package/dist/cli.cjs +1 -1
- package/dist/cli.js +1 -1
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/{run-tui-BU5p-oWh.cjs → run-tui-B0HV2VbC.cjs} +2 -2
- package/dist/{run-tui-Bb5I2Op2.js → run-tui-DE7Qe0Lk.js} +2 -2
- package/dist/run-tui.cjs +1 -1
- package/dist/run-tui.js +1 -1
- package/dist/tui/command-dispatch.d.ts +2 -0
- package/dist/tui/components/api-key-dialog.d.ts +3 -1
- package/dist/tui/components/ask-question-dialog.d.ts +8 -2
- package/dist/tui/components/ask-question-inline.d.ts +2 -2
- package/dist/tui/components/background-activity-selector.d.ts +7 -2
- package/dist/tui/components/custom-editor.d.ts +2 -0
- package/dist/tui/components/github-pr-picker.d.ts +9 -2
- package/dist/tui/components/goal-cycles-dialog.d.ts +3 -1
- package/dist/tui/components/knowledge-browser.d.ts +3 -1
- package/dist/tui/components/list-window.d.ts +19 -0
- package/dist/tui/components/login-account-manager.d.ts +5 -4
- package/dist/tui/components/login-dialog.d.ts +4 -1
- package/dist/tui/components/login-mode-selector.d.ts +6 -8
- package/dist/tui/components/login-selector.d.ts +10 -13
- package/dist/tui/components/mcp-selector.d.ts +3 -1
- package/dist/tui/components/menu-chrome.d.ts +42 -0
- package/dist/tui/components/menu-list.d.ts +45 -0
- package/dist/tui/components/model-selector.d.ts +27 -27
- package/dist/tui/components/om-settings.d.ts +11 -7
- package/dist/tui/components/picker-list.d.ts +16 -8
- package/dist/tui/components/settings-menu.d.ts +29 -0
- package/dist/tui/components/settings.d.ts +7 -6
- package/dist/tui/components/simple-select.d.ts +1 -1
- package/dist/tui/components/text-input.d.ts +14 -0
- package/dist/tui/components/thread-selector.d.ts +10 -6
- package/dist/tui/components/wrapping-autocomplete-list.d.ts +1 -0
- package/dist/tui/components/wrapping-select-list.d.ts +4 -1
- package/dist/tui/mouse/controller.d.ts +13 -8
- package/dist/tui/mouse/pi-tui-internals.d.ts +5 -12
- package/dist/tui/overlay.d.ts +9 -1
- package/dist/tui/prompt-slot.d.ts +94 -0
- package/dist/tui/state.d.ts +5 -2
- package/dist/tui/theme.d.ts +5 -2
- package/dist/{tui-DhXpcMRs.js → tui-JGaSJ4Pq.js} +4420 -3765
- package/dist/{tui-vycpsgSv.cjs → tui-dAtLRHBO.cjs} +5601 -4946
- package/dist/tui.cjs +1 -1
- package/dist/tui.js +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,36 @@
|
|
|
1
1
|
# mastracode
|
|
2
2
|
|
|
3
|
+
## 0.51.0-alpha.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [[`67c1571`](https://github.com/mastra-ai/mastra/commit/67c15714862bbc881bb5191a079abc39ec62c45e)]:
|
|
8
|
+
- @mastra/core@1.87.0-alpha.2
|
|
9
|
+
- @mastra/code-sdk@1.22.0-alpha.2
|
|
10
|
+
|
|
11
|
+
## 0.51.0-alpha.2
|
|
12
|
+
|
|
13
|
+
### Minor Changes
|
|
14
|
+
|
|
15
|
+
- 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))
|
|
16
|
+
|
|
17
|
+
- **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.
|
|
18
|
+
- **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.
|
|
19
|
+
- **Breadcrumbs:** settings submenus show where you are ("settings › notifications").
|
|
20
|
+
- **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.
|
|
21
|
+
- **Suggestions:** command suggestions no longer scroll the chat or leave blank rows under the status line.
|
|
22
|
+
- **Loading:** slow menus such as `/models` and `/model` show a loading row right away. Esc cancels only the menu it was waiting for.
|
|
23
|
+
|
|
24
|
+
`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()`:
|
|
25
|
+
|
|
26
|
+
```ts
|
|
27
|
+
// Before
|
|
28
|
+
selector.getSearchInput().setValue('gpt');
|
|
29
|
+
|
|
30
|
+
// After
|
|
31
|
+
selector.setFilter('gpt');
|
|
32
|
+
```
|
|
33
|
+
|
|
3
34
|
## 0.51.0-alpha.1
|
|
4
35
|
|
|
5
36
|
### Minor Changes
|
package/dist/cli.cjs
CHANGED
package/dist/cli.js
CHANGED
package/dist/docs/SKILL.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const require_tui = require("./tui-
|
|
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.51.0-alpha.
|
|
267
|
+
return "0.51.0-alpha.3";
|
|
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-
|
|
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.51.0-alpha.
|
|
266
|
+
return "0.51.0-alpha.3";
|
|
267
267
|
}
|
|
268
268
|
/** Whether the invocation is `mastracode --version` or `mastracode -v`. */
|
|
269
269
|
function isVersionCommand(argv) {
|
package/dist/run-tui.cjs
CHANGED
package/dist/run-tui.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as runTui } from "./run-tui-
|
|
1
|
+
export { t as runTui } from "./run-tui-DE7Qe0Lk.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.
|
|
@@ -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 {
|
|
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". */
|
|
@@ -37,9 +38,10 @@ export interface AskQuestionDialogOptions {
|
|
|
37
38
|
onSubmitMulti?: (answers: string[]) => void;
|
|
38
39
|
onCancel: () => void;
|
|
39
40
|
}
|
|
40
|
-
export declare class AskQuestionDialogComponent extends
|
|
41
|
+
export declare class AskQuestionDialogComponent extends Container implements Focusable, MenuChrome {
|
|
41
42
|
private static readonly CUSTOM_RESPONSE_VALUE;
|
|
42
43
|
private selectList?;
|
|
44
|
+
private readonly title;
|
|
43
45
|
private input?;
|
|
44
46
|
private tui?;
|
|
45
47
|
private multiline;
|
|
@@ -59,6 +61,10 @@ export declare class AskQuestionDialogComponent extends Box implements Focusable
|
|
|
59
61
|
set focused(value: boolean);
|
|
60
62
|
constructor(options: AskQuestionDialogOptions);
|
|
61
63
|
private buildSelectMode;
|
|
64
|
+
/** Backspace never skips the question (Esc does). */
|
|
65
|
+
readonly menuKeepsBackspace = true;
|
|
66
|
+
menuTitle(): string;
|
|
67
|
+
menuHints(): readonly MenuHint[];
|
|
62
68
|
/** Whether this prompt should render a multiline editor (vs a single-line input). */
|
|
63
69
|
private useMultiline;
|
|
64
70
|
/** Add the text input, its hint and the default value. A masked prompt uses `MaskedInput`. */
|
|
@@ -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,
|
|
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
|
|
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 {
|
|
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
|
|
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
|
|
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 {
|
|
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
|
|
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
|
-
|
|
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 {
|
|
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
|
-
|
|
11
|
-
|
|
12
|
-
private
|
|
13
|
-
private
|
|
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
|
-
|
|
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 {
|
|
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
|
|
17
|
-
private
|
|
18
|
-
private
|
|
19
|
-
private
|
|
20
|
-
private
|
|
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
|
-
|
|
27
|
-
|
|
28
|
-
private
|
|
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
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Model selector
|
|
3
|
-
* Uses pi-tui overlay pattern with search and fuzzy filtering.
|
|
2
|
+
* Model selector menu for switching between available models, filtered as you type (fuzzy).
|
|
4
3
|
*/
|
|
5
|
-
import {
|
|
6
|
-
import type {
|
|
4
|
+
import type { Component, Focusable, TUI } from '@earendil-works/pi-tui';
|
|
5
|
+
import type { MouseAware, MousePoint, MouseTarget } from '../mouse/hit-test.js';
|
|
6
|
+
import type { ListWindow } from './list-window.js';
|
|
7
|
+
import type { Filterable, MenuChrome } from './menu-chrome.js';
|
|
7
8
|
export interface ModelItem {
|
|
8
9
|
/** Full model ID (e.g., "anthropic/claude-sonnet-4") */
|
|
9
10
|
id: string;
|
|
@@ -27,9 +28,9 @@ export interface ModelSelectorOptions {
|
|
|
27
28
|
models: ModelItem[];
|
|
28
29
|
/** Currently selected model ID */
|
|
29
30
|
currentModelId?: string;
|
|
30
|
-
/** Optional title for the selector */
|
|
31
|
+
/** Optional title for the selector (its search placeholder) */
|
|
31
32
|
title?: string;
|
|
32
|
-
/**
|
|
33
|
+
/** @deprecated Ignored: menus show their title as the search placeholder. */
|
|
33
34
|
titleColor?: string;
|
|
34
35
|
/** Callback when a model is selected */
|
|
35
36
|
onSelect: (model: ModelItem) => void;
|
|
@@ -55,38 +56,37 @@ export declare function makeCustomModelItem(id: string, models: ModelItem[]): Mo
|
|
|
55
56
|
* entry.
|
|
56
57
|
*/
|
|
57
58
|
export declare function toCanonicalModelItems(models: ModelItem[]): ModelItem[];
|
|
58
|
-
export declare class ModelSelectorComponent
|
|
59
|
-
|
|
60
|
-
private
|
|
61
|
-
private allModels;
|
|
59
|
+
export declare class ModelSelectorComponent implements Component, Focusable, Filterable, MenuChrome, MouseAware {
|
|
60
|
+
focused: boolean;
|
|
61
|
+
private readonly allModels;
|
|
62
62
|
private filteredModels;
|
|
63
63
|
private selectedIndex;
|
|
64
|
-
private
|
|
65
|
-
|
|
66
|
-
private
|
|
67
|
-
private
|
|
68
|
-
private
|
|
69
|
-
private
|
|
70
|
-
private
|
|
71
|
-
|
|
72
|
-
|
|
64
|
+
private query;
|
|
65
|
+
/** Whether the custom "Use: ..." item is showing at the top */
|
|
66
|
+
private hasCustomItem;
|
|
67
|
+
private readonly list;
|
|
68
|
+
private readonly labelColumn;
|
|
69
|
+
private readonly currentModelId?;
|
|
70
|
+
private readonly onSelectCallback;
|
|
71
|
+
private readonly onCancelCallback;
|
|
72
|
+
private readonly tui;
|
|
73
|
+
private readonly title;
|
|
73
74
|
constructor(options: ModelSelectorOptions);
|
|
74
|
-
|
|
75
|
+
menuWindow(): ListWindow;
|
|
76
|
+
mouseTarget(point: MousePoint): MouseTarget | undefined;
|
|
77
|
+
menuTitle(): string;
|
|
78
|
+
menuFilterTarget(): Filterable;
|
|
79
|
+
setFilter(query: string): void;
|
|
75
80
|
private sortModels;
|
|
76
81
|
/**
|
|
77
82
|
* Puts each Codex Fast entry directly under its standard model. A Fast entry that is the current model stays first,
|
|
78
83
|
* with its standard model right below it. `:fast` on any other provider is part of the model name and stays put.
|
|
79
84
|
*/
|
|
80
85
|
private keepFastEntriesNextToStandard;
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
private filterModels;
|
|
84
|
-
private makeCustomModelItem;
|
|
86
|
+
invalidate(): void;
|
|
87
|
+
render(width: number): string[];
|
|
85
88
|
private updateList;
|
|
86
89
|
private renderRow;
|
|
87
|
-
private confirmIndex;
|
|
88
90
|
handleInput(keyData: string): void;
|
|
89
|
-
private handleSelect;
|
|
90
|
-
getSearchInput(): Input;
|
|
91
91
|
}
|
|
92
92
|
//# sourceMappingURL=model-selector.d.ts.map
|