@ngandu/ulicode 0.0.6
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 +1081 -0
- package/README.md +312 -0
- package/dist/agents/definitions/ask.agent.md +53 -0
- package/dist/agents/definitions/audit-tests.agent.md +138 -0
- package/dist/agents/definitions/build.agent.md +111 -0
- package/dist/agents/definitions/execute.agent.md +99 -0
- package/dist/agents/definitions/explore.agent.md +57 -0
- package/dist/agents/definitions/fast.agent.md +48 -0
- package/dist/agents/definitions/plan-mode.agent.md +102 -0
- package/dist/agents/definitions/planner.agent.md +59 -0
- package/dist/chunk-3YYDXNUH.js +854 -0
- package/dist/chunk-3YYDXNUH.js.map +1 -0
- package/dist/chunk-IEV2IT3O.cjs +873 -0
- package/dist/chunk-IEV2IT3O.cjs.map +1 -0
- package/dist/chunk-MBWGSXBT.js +11927 -0
- package/dist/chunk-MBWGSXBT.js.map +1 -0
- package/dist/chunk-MS5RYNRK.js +137 -0
- package/dist/chunk-MS5RYNRK.js.map +1 -0
- package/dist/chunk-OXFO76JC.js +2633 -0
- package/dist/chunk-OXFO76JC.js.map +1 -0
- package/dist/chunk-PKRLG6A4.js +1756 -0
- package/dist/chunk-PKRLG6A4.js.map +1 -0
- package/dist/chunk-PUVEPQQ3.cjs +1805 -0
- package/dist/chunk-PUVEPQQ3.cjs.map +1 -0
- package/dist/chunk-R6JK3DE3.cjs +148 -0
- package/dist/chunk-R6JK3DE3.cjs.map +1 -0
- package/dist/chunk-Y3HWP75B.cjs +11974 -0
- package/dist/chunk-Y3HWP75B.cjs.map +1 -0
- package/dist/chunk-Y5PO67TG.cjs +2659 -0
- package/dist/chunk-Y5PO67TG.cjs.map +1 -0
- package/dist/cli.cjs +372 -0
- package/dist/cli.cjs.map +1 -0
- package/dist/cli.d.cts +1 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +370 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.cjs +16 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +165 -0
- package/dist/index.d.ts +165 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/permissions-NRD36MYI.cjs +40 -0
- package/dist/permissions-NRD36MYI.cjs.map +1 -0
- package/dist/permissions-RC7CYR5H.js +3 -0
- package/dist/permissions-RC7CYR5H.js.map +1 -0
- package/dist/project-q9WpahUs.d.cts +329 -0
- package/dist/project-q9WpahUs.d.ts +329 -0
- package/dist/storage-6P53PQBL.cjs +24 -0
- package/dist/storage-6P53PQBL.cjs.map +1 -0
- package/dist/storage-QELMNBZ2.js +3 -0
- package/dist/storage-QELMNBZ2.js.map +1 -0
- package/dist/tui.cjs +76 -0
- package/dist/tui.cjs.map +1 -0
- package/dist/tui.d.cts +1013 -0
- package/dist/tui.d.ts +1013 -0
- package/dist/tui.js +3 -0
- package/dist/tui.js.map +1 -0
- package/package.json +107 -0
package/dist/tui.d.ts
ADDED
|
@@ -0,0 +1,1013 @@
|
|
|
1
|
+
import { Container, Focusable, TUI, MarkdownTheme, Editor, EditorTheme, ProcessTerminal, Text, CombinedAutocompleteProvider, Box, Input } from '@mariozechner/pi-tui';
|
|
2
|
+
import { HarnessMessage, OMStatus, OMProgressState, TaskItem, Harness } from '@mastra/core/harness';
|
|
3
|
+
export { OMProgressState, OMStatus } from '@mastra/core/harness';
|
|
4
|
+
import { Workspace } from '@mastra/core/workspace';
|
|
5
|
+
import { H as HookManager, A as AuthStorage, a as McpManager, P as ProjectInfo, O as OAuthProviderInterface } from './project-q9WpahUs.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Onboarding "packs" — predefined model configurations for each mode.
|
|
9
|
+
*
|
|
10
|
+
* Each pack assigns a default model to every configured mode,
|
|
11
|
+
* plus an OM (observational memory) model.
|
|
12
|
+
*/
|
|
13
|
+
interface ModePack {
|
|
14
|
+
id: string;
|
|
15
|
+
name: string;
|
|
16
|
+
description: string;
|
|
17
|
+
models: Record<string, string>;
|
|
18
|
+
}
|
|
19
|
+
interface ModePackOption {
|
|
20
|
+
id: string;
|
|
21
|
+
label: string;
|
|
22
|
+
color?: string;
|
|
23
|
+
}
|
|
24
|
+
interface OMPack {
|
|
25
|
+
id: string;
|
|
26
|
+
name: string;
|
|
27
|
+
description: string;
|
|
28
|
+
modelId: string;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Inline onboarding component.
|
|
33
|
+
*
|
|
34
|
+
* Walks the user through a multi-step wizard:
|
|
35
|
+
* 1. Welcome
|
|
36
|
+
* 2. Auth / Login prompt
|
|
37
|
+
* 3. Mode pack selection (model preset for every configured mode)
|
|
38
|
+
* 4. OM pack selection (observational memory model)
|
|
39
|
+
* 5. YOLO mode toggle
|
|
40
|
+
*
|
|
41
|
+
* The component renders each step inline in the conversation stream.
|
|
42
|
+
* On completion it fires `onComplete` with the collected choices.
|
|
43
|
+
*/
|
|
44
|
+
|
|
45
|
+
interface OnboardingResult {
|
|
46
|
+
modePack: ModePack;
|
|
47
|
+
omPack: OMPack;
|
|
48
|
+
yolo: boolean;
|
|
49
|
+
/** True if the user chose to log in (auth flow handled externally). */
|
|
50
|
+
loginRequested: boolean;
|
|
51
|
+
loginProvider?: string;
|
|
52
|
+
}
|
|
53
|
+
/** Previously saved selections to pre-populate when re-running /setup. */
|
|
54
|
+
interface PreviousSetupChoices {
|
|
55
|
+
modePackId: string | null;
|
|
56
|
+
omPackId: string | null;
|
|
57
|
+
yolo: boolean | null;
|
|
58
|
+
}
|
|
59
|
+
interface OnboardingOptions {
|
|
60
|
+
tui: TUI;
|
|
61
|
+
/** OAuth providers available for login. label=display name, value=provider id */
|
|
62
|
+
authProviders: Array<{
|
|
63
|
+
label: string;
|
|
64
|
+
value: string;
|
|
65
|
+
loggedIn: boolean;
|
|
66
|
+
}>;
|
|
67
|
+
/** Whether to show the direct API-key login method in the auth step. */
|
|
68
|
+
allowApiKeyLogin?: boolean;
|
|
69
|
+
/** Available mode packs (pre-filtered by provider access). */
|
|
70
|
+
modePacks: ModePack[];
|
|
71
|
+
/** Ordered mode metadata used for pack rendering and custom pack selection. */
|
|
72
|
+
packModes: ModePackOption[];
|
|
73
|
+
/** Available OM packs (pre-filtered by provider access). */
|
|
74
|
+
omPacks: OMPack[];
|
|
75
|
+
/** Whether the user has any provider access (API key or OAuth) — even for providers without a built-in pack. */
|
|
76
|
+
hasProviderAccess: boolean;
|
|
77
|
+
/** Previously saved choices — used to highlight current selections when re-running. */
|
|
78
|
+
previous?: PreviousSetupChoices;
|
|
79
|
+
/** Called when the wizard completes. */
|
|
80
|
+
onComplete: (result: OnboardingResult) => void;
|
|
81
|
+
/** Called if the user cancels the wizard (Esc on welcome). */
|
|
82
|
+
onCancel: () => void;
|
|
83
|
+
/** Called when the user requests login during onboarding. */
|
|
84
|
+
onLogin: (providerId: string, done: () => void) => void;
|
|
85
|
+
/** Called when the user chooses the direct API-key login flow during onboarding. */
|
|
86
|
+
onSetApiKey: (done: () => void) => void;
|
|
87
|
+
/** Show the model selector overlay and return the chosen model ID (or undefined on cancel). */
|
|
88
|
+
onSelectModel: (title: string, modeColor?: string) => Promise<string | undefined>;
|
|
89
|
+
}
|
|
90
|
+
declare class OnboardingInlineComponent extends Container implements Focusable {
|
|
91
|
+
private tui;
|
|
92
|
+
private options;
|
|
93
|
+
private currentStep;
|
|
94
|
+
private stepBox;
|
|
95
|
+
private selectList?;
|
|
96
|
+
private activeInlineQuestion?;
|
|
97
|
+
private _finished;
|
|
98
|
+
private loginRequested;
|
|
99
|
+
private loginProvider?;
|
|
100
|
+
private selectedModePack;
|
|
101
|
+
private selectedOmPack;
|
|
102
|
+
private selectedYolo;
|
|
103
|
+
private _focused;
|
|
104
|
+
get focused(): boolean;
|
|
105
|
+
set focused(value: boolean);
|
|
106
|
+
constructor(options: OnboardingOptions);
|
|
107
|
+
get finished(): boolean;
|
|
108
|
+
/** Programmatically cancel the wizard (e.g. on Ctrl+C). */
|
|
109
|
+
cancel(): void;
|
|
110
|
+
/** Refresh the available mode packs (e.g. after a login grants new provider access). */
|
|
111
|
+
updateModePacks(packs: ModePack[]): void;
|
|
112
|
+
/** Refresh the available OM packs (e.g. after a login grants new provider access). */
|
|
113
|
+
updateOmPacks(packs: OMPack[]): void;
|
|
114
|
+
/** Update whether the user has any provider access (e.g. after a login). */
|
|
115
|
+
updateHasProviderAccess(hasAccess: boolean): void;
|
|
116
|
+
private clearStep;
|
|
117
|
+
private renderStep;
|
|
118
|
+
private stepCount;
|
|
119
|
+
private makeBox;
|
|
120
|
+
private renderWelcome;
|
|
121
|
+
private renderAuth;
|
|
122
|
+
private renderClaudeMaxWarning;
|
|
123
|
+
/** Text component showing details for the currently highlighted mode pack. */
|
|
124
|
+
private modePackDetail?;
|
|
125
|
+
private renderModePack;
|
|
126
|
+
private updateModePackDetail;
|
|
127
|
+
private promptCustomPackName;
|
|
128
|
+
private runCustomPackFlow;
|
|
129
|
+
private renderOmPack;
|
|
130
|
+
private runCustomOmFlow;
|
|
131
|
+
private renderYolo;
|
|
132
|
+
private renderDone;
|
|
133
|
+
private collapseStep;
|
|
134
|
+
handleInput(data: string): void;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Metadata for a slash command
|
|
139
|
+
*/
|
|
140
|
+
interface SlashCommandMetadata {
|
|
141
|
+
/** Command name (e.g., "git:commit") */
|
|
142
|
+
name: string;
|
|
143
|
+
/** Human-readable description */
|
|
144
|
+
description: string;
|
|
145
|
+
/** The command template with variables */
|
|
146
|
+
template: string;
|
|
147
|
+
/** Source file path */
|
|
148
|
+
sourcePath: string;
|
|
149
|
+
/** Namespace derived from directory structure */
|
|
150
|
+
namespace?: string;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* Inline ask question component.
|
|
155
|
+
* Shows a question with either selectable options or free-text input
|
|
156
|
+
* directly in the conversation flow instead of as an overlay dialog.
|
|
157
|
+
*/
|
|
158
|
+
|
|
159
|
+
interface AskQuestionInlineOptions {
|
|
160
|
+
question: string;
|
|
161
|
+
options?: Array<{
|
|
162
|
+
label: string;
|
|
163
|
+
description?: string;
|
|
164
|
+
}>;
|
|
165
|
+
/** Format the text shown after an answer is selected. Defaults to `question → answer`. */
|
|
166
|
+
formatResult?: (answer: string) => string;
|
|
167
|
+
/** If provided, determines whether an answer should be shown with error styling (red ✗). */
|
|
168
|
+
isNegativeAnswer?: (answer: string) => boolean;
|
|
169
|
+
/** Allow submitting an empty string in free-text mode. */
|
|
170
|
+
allowEmptyInput?: boolean;
|
|
171
|
+
onSubmit: (answer: string) => void;
|
|
172
|
+
onCancel: () => void;
|
|
173
|
+
}
|
|
174
|
+
declare class AskQuestionInlineComponent extends Container implements Focusable {
|
|
175
|
+
private contentBox;
|
|
176
|
+
private selectList?;
|
|
177
|
+
private input?;
|
|
178
|
+
private onSubmit;
|
|
179
|
+
private onCancel;
|
|
180
|
+
private formatResult?;
|
|
181
|
+
private isNegativeAnswer?;
|
|
182
|
+
private allowEmptyInput;
|
|
183
|
+
private answered;
|
|
184
|
+
private questionText;
|
|
185
|
+
private _focused;
|
|
186
|
+
get focused(): boolean;
|
|
187
|
+
set focused(value: boolean);
|
|
188
|
+
constructor(options: AskQuestionInlineOptions, _ui: TUI);
|
|
189
|
+
private buildSelectMode;
|
|
190
|
+
private buildInputMode;
|
|
191
|
+
private handleAnswer;
|
|
192
|
+
private handleCancel;
|
|
193
|
+
handleInput(data: string): void;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* Component that renders an assistant message with streaming support.
|
|
198
|
+
*/
|
|
199
|
+
|
|
200
|
+
declare class AssistantMessageComponent extends Container {
|
|
201
|
+
private contentContainer;
|
|
202
|
+
private hideThinkingBlock;
|
|
203
|
+
private markdownTheme;
|
|
204
|
+
private lastMessage?;
|
|
205
|
+
private _id;
|
|
206
|
+
constructor(message?: HarnessMessage, hideThinkingBlock?: boolean, markdownTheme?: MarkdownTheme);
|
|
207
|
+
invalidate(): void;
|
|
208
|
+
setHideThinkingBlock(hide: boolean): void;
|
|
209
|
+
updateContent(message: HarnessMessage): void;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* Platform-specific clipboard image extraction.
|
|
214
|
+
*
|
|
215
|
+
* Checks the system clipboard for image data and returns it as base64.
|
|
216
|
+
* Uses synchronous execution (execSync) since this only runs on paste events.
|
|
217
|
+
*/
|
|
218
|
+
interface ClipboardImage {
|
|
219
|
+
data: string;
|
|
220
|
+
mimeType: string;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* Custom editor that handles app-level keybindings for Mastra Code.
|
|
225
|
+
*/
|
|
226
|
+
|
|
227
|
+
type AppAction = 'clear' | 'exit' | 'suspend' | 'undo' | 'toggleThinking' | 'expandTools' | 'followUp' | 'cycleMode' | 'toggleYolo';
|
|
228
|
+
declare class CustomEditor extends Editor {
|
|
229
|
+
private actionHandlers;
|
|
230
|
+
onCtrlD?: () => void;
|
|
231
|
+
escapeEnabled: boolean;
|
|
232
|
+
onImagePaste?: (image: ClipboardImage) => void;
|
|
233
|
+
onOpenFileSelector?: () => void;
|
|
234
|
+
private pendingBracketedPaste;
|
|
235
|
+
constructor(tui: TUI, theme: EditorTheme);
|
|
236
|
+
onAction(action: AppAction, handler: () => unknown): void;
|
|
237
|
+
private maybeHandleBracketedPaste;
|
|
238
|
+
private shouldPasteClipboardImage;
|
|
239
|
+
private getClipboardImageForPastedRemoteImageUrl;
|
|
240
|
+
private readPastedImageSource;
|
|
241
|
+
private normalizePastedPathLike;
|
|
242
|
+
private normalizePastedImageUrl;
|
|
243
|
+
private normalizePastedFilePath;
|
|
244
|
+
private getImageMimeType;
|
|
245
|
+
private handleExplicitPaste;
|
|
246
|
+
handleInput(data: string): void;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
interface PendingFileAttachment {
|
|
250
|
+
absolutePath: string;
|
|
251
|
+
relativePath: string;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
/**
|
|
255
|
+
* Manages the gradient sweep animation state.
|
|
256
|
+
* Call `start()` when agent begins working, `stop()` when idle.
|
|
257
|
+
* On each tick, call `getOffset()` to get the current sweep position.
|
|
258
|
+
*/
|
|
259
|
+
declare class GradientAnimator {
|
|
260
|
+
private offset;
|
|
261
|
+
private intervalId;
|
|
262
|
+
private onTick;
|
|
263
|
+
private _isFadingOut;
|
|
264
|
+
private _isFadingIn;
|
|
265
|
+
private _fadeProgress;
|
|
266
|
+
constructor(onTick: () => void);
|
|
267
|
+
start(): void;
|
|
268
|
+
/**
|
|
269
|
+
* Smoothly fade the gradient to idle state over ~500ms.
|
|
270
|
+
*/
|
|
271
|
+
fadeOut(): void;
|
|
272
|
+
stop(): void;
|
|
273
|
+
getOffset(): number;
|
|
274
|
+
/** 0 = full animation, 1 = fully idle. Use to interpolate colors. */
|
|
275
|
+
getFadeProgress(): number;
|
|
276
|
+
isFadingOut(): boolean;
|
|
277
|
+
isRunning(): boolean;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
/**
|
|
281
|
+
* TUI component for rendering OM observation markers in chat history.
|
|
282
|
+
* Supports updating in-place (start → end/failed).
|
|
283
|
+
*/
|
|
284
|
+
|
|
285
|
+
type OMMarkerData = {
|
|
286
|
+
type: 'om_observation_start';
|
|
287
|
+
tokensToObserve: number;
|
|
288
|
+
operationType?: 'observation' | 'reflection';
|
|
289
|
+
} | {
|
|
290
|
+
type: 'om_observation_end';
|
|
291
|
+
tokensObserved: number;
|
|
292
|
+
observationTokens: number;
|
|
293
|
+
durationMs: number;
|
|
294
|
+
operationType?: 'observation' | 'reflection';
|
|
295
|
+
} | {
|
|
296
|
+
type: 'om_observation_failed';
|
|
297
|
+
error: string;
|
|
298
|
+
tokensAttempted?: number;
|
|
299
|
+
operationType?: 'observation' | 'reflection';
|
|
300
|
+
} | {
|
|
301
|
+
type: 'om_buffering_start';
|
|
302
|
+
operationType: 'observation' | 'reflection';
|
|
303
|
+
tokensToBuffer: number;
|
|
304
|
+
} | {
|
|
305
|
+
type: 'om_buffering_end';
|
|
306
|
+
operationType: 'observation' | 'reflection';
|
|
307
|
+
tokensBuffered: number;
|
|
308
|
+
bufferedTokens: number;
|
|
309
|
+
observations?: string;
|
|
310
|
+
} | {
|
|
311
|
+
type: 'om_buffering_failed';
|
|
312
|
+
operationType: 'observation' | 'reflection';
|
|
313
|
+
error: string;
|
|
314
|
+
} | {
|
|
315
|
+
type: 'om_activation';
|
|
316
|
+
operationType: 'observation' | 'reflection';
|
|
317
|
+
tokensActivated: number;
|
|
318
|
+
observationTokens: number;
|
|
319
|
+
};
|
|
320
|
+
/**
|
|
321
|
+
* Renders an inline OM observation marker in the chat history.
|
|
322
|
+
* Can be updated in-place to transition from start → end/failed.
|
|
323
|
+
*/
|
|
324
|
+
declare class OMMarkerComponent extends Container {
|
|
325
|
+
private textChild;
|
|
326
|
+
constructor(data: OMMarkerData);
|
|
327
|
+
/**
|
|
328
|
+
* Update the marker in-place (e.g., from start → end).
|
|
329
|
+
*/
|
|
330
|
+
update(data: OMMarkerData): void;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
/**
|
|
334
|
+
* Observational Memory progress indicator component.
|
|
335
|
+
* Shows when OM is observing or reflecting on conversation history.
|
|
336
|
+
*/
|
|
337
|
+
|
|
338
|
+
/**
|
|
339
|
+
* Component that displays OM progress in the status line area.
|
|
340
|
+
* Shows a compact indicator when observation/reflection is happening.
|
|
341
|
+
*/
|
|
342
|
+
declare class OMProgressComponent extends Container {
|
|
343
|
+
private state;
|
|
344
|
+
private statusText;
|
|
345
|
+
constructor();
|
|
346
|
+
updateProgress(progress: {
|
|
347
|
+
pendingTokens: number;
|
|
348
|
+
threshold: number;
|
|
349
|
+
thresholdPercent: number;
|
|
350
|
+
observationTokens: number;
|
|
351
|
+
reflectionThreshold: number;
|
|
352
|
+
reflectionThresholdPercent: number;
|
|
353
|
+
}): void;
|
|
354
|
+
startObservation(cycleId: string, _tokensToObserve: number): void;
|
|
355
|
+
endObservation(): void;
|
|
356
|
+
startReflection(cycleId: string): void;
|
|
357
|
+
endReflection(): void;
|
|
358
|
+
failOperation(): void;
|
|
359
|
+
getStatus(): OMStatus;
|
|
360
|
+
private updateDisplay;
|
|
361
|
+
private renderProgressBar;
|
|
362
|
+
private spinnerFrame;
|
|
363
|
+
private getSpinner;
|
|
364
|
+
render(maxWidth: number): string[];
|
|
365
|
+
}
|
|
366
|
+
/**
|
|
367
|
+
* @deprecated Use formatObservationStatus and formatReflectionStatus instead
|
|
368
|
+
*/
|
|
369
|
+
declare function formatOMStatus(state: OMProgressState): string;
|
|
370
|
+
|
|
371
|
+
/**
|
|
372
|
+
* Inline plan approval component.
|
|
373
|
+
* Shows a submitted plan as rendered markdown with Approve/Reject/Request Changes options
|
|
374
|
+
* directly in the conversation flow.
|
|
375
|
+
*/
|
|
376
|
+
|
|
377
|
+
interface PlanApprovalInlineOptions {
|
|
378
|
+
planId: string;
|
|
379
|
+
title: string;
|
|
380
|
+
plan: string;
|
|
381
|
+
onApprove: () => void;
|
|
382
|
+
onReject: (feedback?: string) => void;
|
|
383
|
+
}
|
|
384
|
+
declare class PlanApprovalInlineComponent extends Container implements Focusable {
|
|
385
|
+
private contentBox;
|
|
386
|
+
private selectList?;
|
|
387
|
+
private feedbackInput?;
|
|
388
|
+
private onApprove;
|
|
389
|
+
private onReject;
|
|
390
|
+
private resolved;
|
|
391
|
+
private mode;
|
|
392
|
+
private planTitle;
|
|
393
|
+
private planContent;
|
|
394
|
+
private _focused;
|
|
395
|
+
get focused(): boolean;
|
|
396
|
+
set focused(value: boolean);
|
|
397
|
+
constructor(options: PlanApprovalInlineOptions, _ui: TUI);
|
|
398
|
+
private handleSelection;
|
|
399
|
+
private handleApprove;
|
|
400
|
+
private handleReject;
|
|
401
|
+
private switchToFeedbackMode;
|
|
402
|
+
private showResult;
|
|
403
|
+
handleInput(data: string): void;
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
/**
|
|
407
|
+
* SlashCommandComponent - renders a bordered box for slash command messages
|
|
408
|
+
* showing the command name as a heading and truncated content that can be
|
|
409
|
+
* expanded with ctrl+e. The full content is still sent to the assistant.
|
|
410
|
+
*/
|
|
411
|
+
|
|
412
|
+
declare class SlashCommandComponent extends Container {
|
|
413
|
+
private commandName;
|
|
414
|
+
private contentLines;
|
|
415
|
+
private expanded;
|
|
416
|
+
constructor(commandName: string, content?: string);
|
|
417
|
+
setExpanded(expanded: boolean): void;
|
|
418
|
+
private rebuild;
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
/**
|
|
422
|
+
* Common interface and shared types for tool execution components
|
|
423
|
+
*/
|
|
424
|
+
interface ToolResult {
|
|
425
|
+
content: Array<{
|
|
426
|
+
type: string;
|
|
427
|
+
text?: string;
|
|
428
|
+
data?: string;
|
|
429
|
+
mimeType?: string;
|
|
430
|
+
}>;
|
|
431
|
+
isError: boolean;
|
|
432
|
+
}
|
|
433
|
+
interface IToolExecutionComponent {
|
|
434
|
+
updateArgs(args: unknown): void;
|
|
435
|
+
updateResult(result: ToolResult, isPartial?: boolean): void;
|
|
436
|
+
setExpanded(expanded: boolean): void;
|
|
437
|
+
/** Append streaming output for shell commands */
|
|
438
|
+
appendStreamingOutput?(output: string): void;
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
/**
|
|
442
|
+
* Subagent execution rendering component.
|
|
443
|
+
* Shows real-time activity from a delegated subagent task using
|
|
444
|
+
* the same bordered box style as shell/view tools:
|
|
445
|
+
* - Top border
|
|
446
|
+
* - Task description (always visible)
|
|
447
|
+
* - Streaming tool call activity (capped rolling window)
|
|
448
|
+
* - Bottom border with agent type, model, status, duration
|
|
449
|
+
*/
|
|
450
|
+
|
|
451
|
+
interface SubagentExecutionOptions {
|
|
452
|
+
/** When true, auto-collapse to a single summary line on completion. Default false. */
|
|
453
|
+
collapseOnComplete?: boolean;
|
|
454
|
+
}
|
|
455
|
+
declare class SubagentExecutionComponent extends Container implements IToolExecutionComponent {
|
|
456
|
+
private ui;
|
|
457
|
+
private agentType;
|
|
458
|
+
private task;
|
|
459
|
+
private modelId?;
|
|
460
|
+
private toolCalls;
|
|
461
|
+
private done;
|
|
462
|
+
private isError;
|
|
463
|
+
private startTime;
|
|
464
|
+
private durationMs;
|
|
465
|
+
private finalResult?;
|
|
466
|
+
private expanded;
|
|
467
|
+
private collapseOnComplete;
|
|
468
|
+
constructor(agentType: string, task: string, ui: TUI, modelId?: string, options?: SubagentExecutionOptions);
|
|
469
|
+
addToolStart(name: string, args: unknown): void;
|
|
470
|
+
addToolEnd(name: string, result: unknown, isError: boolean): void;
|
|
471
|
+
finish(isError: boolean, durationMs: number, result?: string): void;
|
|
472
|
+
setExpanded(expanded: boolean): void;
|
|
473
|
+
toggleExpanded(): void;
|
|
474
|
+
updateArgs(_args: unknown): void;
|
|
475
|
+
updateResult(_result: unknown, _isPartial: boolean): void;
|
|
476
|
+
private rebuild;
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
/**
|
|
480
|
+
* Task progress component for the TUI.
|
|
481
|
+
* Shows a persistent, compact display of the current task list.
|
|
482
|
+
* Hidden when no tasks exist OR when all tasks are completed.
|
|
483
|
+
* Renders between status and editor.
|
|
484
|
+
*/
|
|
485
|
+
|
|
486
|
+
declare class TaskProgressComponent extends Container {
|
|
487
|
+
private tasks;
|
|
488
|
+
constructor();
|
|
489
|
+
/**
|
|
490
|
+
* Replace the entire task list and re-render.
|
|
491
|
+
*/
|
|
492
|
+
updateTasks(tasks: TaskItem[]): void;
|
|
493
|
+
/**
|
|
494
|
+
* Get the current task list (read-only copy).
|
|
495
|
+
*/
|
|
496
|
+
getTasks(): TaskItem[];
|
|
497
|
+
private rebuildDisplay;
|
|
498
|
+
private formatTaskLine;
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
/**
|
|
502
|
+
* Component that renders a user message.
|
|
503
|
+
*/
|
|
504
|
+
|
|
505
|
+
declare class UserMessageComponent extends Container {
|
|
506
|
+
constructor(text: string, markdownTheme?: MarkdownTheme);
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
/**
|
|
510
|
+
* Shared TUI state — the single source of truth for all mutable state
|
|
511
|
+
* in the Mastra TUI. Extracted so that slash commands, event handlers,
|
|
512
|
+
* and other modules can operate on the state without coupling to the
|
|
513
|
+
* MastraTUI class.
|
|
514
|
+
*/
|
|
515
|
+
|
|
516
|
+
interface MastraTUIOptions {
|
|
517
|
+
/** The harness instance to control */
|
|
518
|
+
harness: Harness<any>;
|
|
519
|
+
/** Hook manager for session lifecycle hooks */
|
|
520
|
+
hookManager?: HookManager;
|
|
521
|
+
/** Auth storage for OAuth login/logout */
|
|
522
|
+
authStorage?: AuthStorage;
|
|
523
|
+
/** MCP manager for server status and reload */
|
|
524
|
+
mcpManager?: McpManager;
|
|
525
|
+
/**
|
|
526
|
+
* @deprecated Workspace is now obtained from the Harness.
|
|
527
|
+
* Configure workspace via HarnessConfig.workspace instead.
|
|
528
|
+
* Kept as fallback for backward compatibility.
|
|
529
|
+
*/
|
|
530
|
+
workspace?: Workspace;
|
|
531
|
+
/** Initial message to send on startup */
|
|
532
|
+
initialMessage?: string;
|
|
533
|
+
/** Whether to show verbose startup info */
|
|
534
|
+
verbose?: boolean;
|
|
535
|
+
/** App name for header */
|
|
536
|
+
appName?: string;
|
|
537
|
+
/** App version for header */
|
|
538
|
+
version?: string;
|
|
539
|
+
/** Use inline questions instead of dialog overlays */
|
|
540
|
+
inlineQuestions?: boolean;
|
|
541
|
+
}
|
|
542
|
+
interface TUIState {
|
|
543
|
+
harness: Harness<any>;
|
|
544
|
+
options: MastraTUIOptions;
|
|
545
|
+
hookManager?: HookManager;
|
|
546
|
+
authStorage?: AuthStorage;
|
|
547
|
+
mcpManager?: McpManager;
|
|
548
|
+
workspace?: Workspace;
|
|
549
|
+
ui: TUI;
|
|
550
|
+
chatContainer: Container;
|
|
551
|
+
editorContainer: Container;
|
|
552
|
+
editor: CustomEditor;
|
|
553
|
+
footer: Container;
|
|
554
|
+
terminal: ProcessTerminal;
|
|
555
|
+
isInitialized: boolean;
|
|
556
|
+
gradientAnimator?: GradientAnimator;
|
|
557
|
+
streamingComponent?: AssistantMessageComponent;
|
|
558
|
+
streamingMessage?: HarnessMessage;
|
|
559
|
+
pendingTools: Map<string, IToolExecutionComponent>;
|
|
560
|
+
/** Position hint for task_write inline rendering when streaming */
|
|
561
|
+
taskWriteInsertIndex: number;
|
|
562
|
+
/** Track all tool IDs seen during current stream (prevents duplicates) */
|
|
563
|
+
seenToolCallIds: Set<string>;
|
|
564
|
+
/** Track subagent tool call IDs to skip in trailing content logic */
|
|
565
|
+
subagentToolCallIds: Set<string>;
|
|
566
|
+
/** Track all tools for expand/collapse */
|
|
567
|
+
allToolComponents: IToolExecutionComponent[];
|
|
568
|
+
/** Track slash command boxes for expand/collapse */
|
|
569
|
+
allSlashCommandComponents: SlashCommandComponent[];
|
|
570
|
+
/** Track active subagent tasks */
|
|
571
|
+
pendingSubagents: Map<string, SubagentExecutionComponent>;
|
|
572
|
+
toolOutputExpanded: boolean;
|
|
573
|
+
hideThinkingBlock: boolean;
|
|
574
|
+
quietMode: boolean;
|
|
575
|
+
/** True when we want a new thread but haven't created it yet */
|
|
576
|
+
pendingNewThread: boolean;
|
|
577
|
+
/** Track the most recent ask_user tool for inline question placement */
|
|
578
|
+
lastAskUserComponent?: IToolExecutionComponent;
|
|
579
|
+
/** Saved editor text for Alt+Z undo */
|
|
580
|
+
lastClearedText: string;
|
|
581
|
+
lastClearedFileAttachments: PendingFileAttachment[];
|
|
582
|
+
activeInlineQuestion?: AskQuestionInlineComponent;
|
|
583
|
+
/** Queue of pending inline questions waiting to be shown (when one is already active) */
|
|
584
|
+
pendingInlineQuestions: Array<() => void>;
|
|
585
|
+
activeInlinePlanApproval?: PlanApprovalInlineComponent;
|
|
586
|
+
activeOnboarding?: OnboardingInlineComponent;
|
|
587
|
+
lastSubmitPlanComponent?: IToolExecutionComponent;
|
|
588
|
+
/** User-message follow-ups queued while the agent is running */
|
|
589
|
+
pendingFollowUpMessages: Array<{
|
|
590
|
+
content: string;
|
|
591
|
+
displayContent: string;
|
|
592
|
+
images?: Array<{
|
|
593
|
+
data: string;
|
|
594
|
+
mimeType: string;
|
|
595
|
+
}>;
|
|
596
|
+
}>;
|
|
597
|
+
/** FIFO ordering across queued follow-up messages and slash commands */
|
|
598
|
+
pendingQueuedActions: Array<'message' | 'slash'>;
|
|
599
|
+
/** Follow-up messages rendered while streaming so tool output stays above them */
|
|
600
|
+
followUpComponents: UserMessageComponent[];
|
|
601
|
+
/** Slash commands queued while the agent is running */
|
|
602
|
+
pendingSlashCommands: string[];
|
|
603
|
+
/** Active approval dialog dismiss callback — called on Ctrl+C to unblock the dialog */
|
|
604
|
+
pendingApprovalDismiss: (() => void) | null;
|
|
605
|
+
projectInfo: ProjectInfo;
|
|
606
|
+
statusLine?: Text;
|
|
607
|
+
memoryStatusLine?: Text;
|
|
608
|
+
modelAuthStatus: {
|
|
609
|
+
hasAuth: boolean;
|
|
610
|
+
apiKeyEnvVar?: string;
|
|
611
|
+
};
|
|
612
|
+
omProgressComponent?: OMProgressComponent;
|
|
613
|
+
activeOMMarker?: OMMarkerComponent;
|
|
614
|
+
activeBufferingMarker?: OMMarkerComponent;
|
|
615
|
+
activeActivationMarker?: OMMarkerComponent;
|
|
616
|
+
taskProgress?: TaskProgressComponent;
|
|
617
|
+
autocompleteProvider?: CombinedAutocompleteProvider;
|
|
618
|
+
customSlashCommands: SlashCommandMetadata[];
|
|
619
|
+
/** Pending images from clipboard paste */
|
|
620
|
+
pendingImages: Array<{
|
|
621
|
+
data: string;
|
|
622
|
+
mimeType: string;
|
|
623
|
+
}>;
|
|
624
|
+
pendingFileAttachments: PendingFileAttachment[];
|
|
625
|
+
composerAttachmentLine?: Text;
|
|
626
|
+
lastCtrlCTime: number;
|
|
627
|
+
/** Track user-initiated aborts (Ctrl+C/Esc) vs system aborts */
|
|
628
|
+
userInitiatedAbort: boolean;
|
|
629
|
+
unsubscribe?: () => void;
|
|
630
|
+
}
|
|
631
|
+
/**
|
|
632
|
+
* Create the initial TUIState from options.
|
|
633
|
+
* Instantiates TUI framework objects (terminal, containers, editor)
|
|
634
|
+
* and sets all mutable fields to their defaults.
|
|
635
|
+
*/
|
|
636
|
+
declare function createTUIState(options: MastraTUIOptions): TUIState;
|
|
637
|
+
|
|
638
|
+
declare class MastraTUI {
|
|
639
|
+
private state;
|
|
640
|
+
private updateCheckTimer;
|
|
641
|
+
private hasShownUpdateBanner;
|
|
642
|
+
private static readonly DOUBLE_CTRL_C_MS;
|
|
643
|
+
constructor(options: MastraTUIOptions);
|
|
644
|
+
/**
|
|
645
|
+
* Run the TUI. This is the main entry point.
|
|
646
|
+
*/
|
|
647
|
+
run(): Promise<void>;
|
|
648
|
+
/**
|
|
649
|
+
* Fire off a message without blocking the main loop.
|
|
650
|
+
* Errors are handled via harness events.
|
|
651
|
+
*/
|
|
652
|
+
private fireMessage;
|
|
653
|
+
private queueFollowUpMessage;
|
|
654
|
+
private openProjectFileSelector;
|
|
655
|
+
/**
|
|
656
|
+
* Stop the TUI and clean up.
|
|
657
|
+
*/
|
|
658
|
+
stop(): void;
|
|
659
|
+
private init;
|
|
660
|
+
private refreshModelAuthStatus;
|
|
661
|
+
/** Cached event context – built once, reused for every event. */
|
|
662
|
+
private _ectx;
|
|
663
|
+
private getEventContext;
|
|
664
|
+
private handleEvent;
|
|
665
|
+
private buildProviderAccess;
|
|
666
|
+
private syncThreadActivePackMetadata;
|
|
667
|
+
private showHookWarnings;
|
|
668
|
+
private runStopHook;
|
|
669
|
+
private runUserPromptHook;
|
|
670
|
+
/**
|
|
671
|
+
* Insert a child into the chat container before any follow-up user messages.
|
|
672
|
+
* If no follow-ups are pending, appends to end.
|
|
673
|
+
*/
|
|
674
|
+
private addChildBeforeFollowUps;
|
|
675
|
+
private getUserInput;
|
|
676
|
+
/**
|
|
677
|
+
* One-time startup check: if the user has Anthropic OAuth credentials and
|
|
678
|
+
* hasn't yet acknowledged the Claude Max ToS warning, show it now.
|
|
679
|
+
*/
|
|
680
|
+
private checkClaudeMaxOAuthWarning;
|
|
681
|
+
/**
|
|
682
|
+
* Get the workspace, preferring harness-owned workspace over the direct option.
|
|
683
|
+
*/
|
|
684
|
+
private getResolvedWorkspace;
|
|
685
|
+
private buildCommandContext;
|
|
686
|
+
private buildEventContext;
|
|
687
|
+
private handleSlashCommand;
|
|
688
|
+
performLogin(providerId: string): Promise<void>;
|
|
689
|
+
performApiKeyLogin(): Promise<void>;
|
|
690
|
+
showOnboarding(): Promise<void>;
|
|
691
|
+
private applyOnboardingResult;
|
|
692
|
+
private shouldShowOnboarding;
|
|
693
|
+
/**
|
|
694
|
+
* Check GitHub releases for a newer version and prompt the user to update.
|
|
695
|
+
* - If the user previously dismissed this version, show a passive note instead.
|
|
696
|
+
* - If the fetch fails or we're already up-to-date, silently return.
|
|
697
|
+
* @param passive When true, only show an info message (used for periodic rechecks).
|
|
698
|
+
*/
|
|
699
|
+
private checkForUpdate;
|
|
700
|
+
/**
|
|
701
|
+
* Show an inline Y/N prompt offering to auto-update.
|
|
702
|
+
*/
|
|
703
|
+
private showUpdatePrompt;
|
|
704
|
+
}
|
|
705
|
+
|
|
706
|
+
/**
|
|
707
|
+
* Enhanced tool execution component with better collapsible support.
|
|
708
|
+
* This will replace the existing tool-execution.ts
|
|
709
|
+
*/
|
|
710
|
+
|
|
711
|
+
interface ToolExecutionOptions {
|
|
712
|
+
showImages?: boolean;
|
|
713
|
+
autoCollapse?: boolean;
|
|
714
|
+
collapsedByDefault?: boolean;
|
|
715
|
+
}
|
|
716
|
+
/**
|
|
717
|
+
* Enhanced tool execution component with collapsible sections
|
|
718
|
+
*/
|
|
719
|
+
declare class ToolExecutionComponentEnhanced extends Container implements IToolExecutionComponent {
|
|
720
|
+
private contentBox;
|
|
721
|
+
private toolName;
|
|
722
|
+
private args;
|
|
723
|
+
private expanded;
|
|
724
|
+
private isPartial;
|
|
725
|
+
private ui;
|
|
726
|
+
private result?;
|
|
727
|
+
private options;
|
|
728
|
+
private collapsible?;
|
|
729
|
+
private startTime;
|
|
730
|
+
private streamingOutput;
|
|
731
|
+
constructor(toolName: string, args: unknown, options: ToolExecutionOptions | undefined, ui: TUI);
|
|
732
|
+
updateArgs(args: unknown): void;
|
|
733
|
+
updateResult(result: ToolResult, isPartial?: boolean): void;
|
|
734
|
+
/**
|
|
735
|
+
* Append streaming shell output.
|
|
736
|
+
* Only for execute_command tool - shows live output while command runs.
|
|
737
|
+
*/
|
|
738
|
+
appendStreamingOutput(output: string): void;
|
|
739
|
+
setExpanded(expanded: boolean): void;
|
|
740
|
+
toggleExpanded(): void;
|
|
741
|
+
invalidate(): void;
|
|
742
|
+
private updateBgColor;
|
|
743
|
+
/**
|
|
744
|
+
* Full clear-and-rebuild. Called when:
|
|
745
|
+
* - args change (updateArgs)
|
|
746
|
+
* - result arrives or changes (updateResult)
|
|
747
|
+
* - expand/collapse on a tool with no collapsible child
|
|
748
|
+
* - initial construction
|
|
749
|
+
*/
|
|
750
|
+
private rebuild;
|
|
751
|
+
private renderViewToolEnhanced;
|
|
752
|
+
private renderBashToolEnhanced;
|
|
753
|
+
private renderProcessToolEnhanced;
|
|
754
|
+
private renderEditToolEnhanced;
|
|
755
|
+
private parseLSPDiagnostics;
|
|
756
|
+
private generateDiffLines;
|
|
757
|
+
private renderWriteToolEnhanced;
|
|
758
|
+
private renderListFilesEnhanced;
|
|
759
|
+
private renderTaskWriteEnhanced;
|
|
760
|
+
private renderWebSearchEnhanced;
|
|
761
|
+
/**
|
|
762
|
+
* Format web search results as a clean list of titles + URLs.
|
|
763
|
+
* Handles both Anthropic provider results (JSON array with encryptedContent)
|
|
764
|
+
* and Tavily results (markdown-formatted text).
|
|
765
|
+
*/
|
|
766
|
+
private formatWebSearchResults;
|
|
767
|
+
private renderGenericToolEnhanced;
|
|
768
|
+
/**
|
|
769
|
+
* Format a compact args preview as key="value" pairs.
|
|
770
|
+
* Long values are truncated, multiline values show first line + count.
|
|
771
|
+
* Returns an array of formatted lines.
|
|
772
|
+
*/
|
|
773
|
+
private formatArgsPreview;
|
|
774
|
+
private getStatusIndicator;
|
|
775
|
+
private getDurationSuffix;
|
|
776
|
+
private getFormattedOutput;
|
|
777
|
+
/**
|
|
778
|
+
* Render an error result using the enhanced error display component
|
|
779
|
+
*/
|
|
780
|
+
private renderErrorResult;
|
|
781
|
+
}
|
|
782
|
+
|
|
783
|
+
/**
|
|
784
|
+
* Model selector component for switching between available models.
|
|
785
|
+
* Uses pi-tui overlay pattern with search and fuzzy filtering.
|
|
786
|
+
*/
|
|
787
|
+
|
|
788
|
+
interface ModelItem {
|
|
789
|
+
/** Full model ID (e.g., "anthropic/claude-sonnet-4") */
|
|
790
|
+
id: string;
|
|
791
|
+
/** Provider name (e.g., "anthropic") */
|
|
792
|
+
provider: string;
|
|
793
|
+
/** Model name without provider (e.g., "claude-sonnet-4") */
|
|
794
|
+
modelName: string;
|
|
795
|
+
/** Whether the API key for this provider is available */
|
|
796
|
+
hasApiKey: boolean;
|
|
797
|
+
/** Environment variable name for the API key (e.g., "ANTHROPIC_API_KEY") */
|
|
798
|
+
apiKeyEnvVar?: string;
|
|
799
|
+
/** Number of times this model has been selected (for ranking) */
|
|
800
|
+
useCount?: number;
|
|
801
|
+
}
|
|
802
|
+
interface ModelSelectorOptions {
|
|
803
|
+
/** TUI instance for rendering */
|
|
804
|
+
tui: TUI;
|
|
805
|
+
/** List of available models */
|
|
806
|
+
models: ModelItem[];
|
|
807
|
+
/** Currently selected model ID */
|
|
808
|
+
currentModelId?: string;
|
|
809
|
+
/** Optional title for the selector */
|
|
810
|
+
title?: string;
|
|
811
|
+
/** Optional hex color for the title background (e.g. mode color) */
|
|
812
|
+
titleColor?: string;
|
|
813
|
+
/** Callback when a model is selected */
|
|
814
|
+
onSelect: (model: ModelItem) => void;
|
|
815
|
+
/** Callback when selection is cancelled */
|
|
816
|
+
onCancel: () => void;
|
|
817
|
+
}
|
|
818
|
+
declare class ModelSelectorComponent extends Box implements Focusable {
|
|
819
|
+
private searchInput;
|
|
820
|
+
private listContainer;
|
|
821
|
+
private allModels;
|
|
822
|
+
private filteredModels;
|
|
823
|
+
private selectedIndex;
|
|
824
|
+
private currentModelId?;
|
|
825
|
+
private onSelectCallback;
|
|
826
|
+
private onCancelCallback;
|
|
827
|
+
private tui;
|
|
828
|
+
private title;
|
|
829
|
+
private titleColor?;
|
|
830
|
+
private _focused;
|
|
831
|
+
get focused(): boolean;
|
|
832
|
+
set focused(value: boolean);
|
|
833
|
+
constructor(options: ModelSelectorOptions);
|
|
834
|
+
private buildUI;
|
|
835
|
+
private sortModels;
|
|
836
|
+
/** Whether the custom "Use: ..." item is showing at the top */
|
|
837
|
+
private hasCustomItem;
|
|
838
|
+
private filterModels;
|
|
839
|
+
private makeCustomModelItem;
|
|
840
|
+
private updateList;
|
|
841
|
+
handleInput(keyData: string): void;
|
|
842
|
+
private handleSelect;
|
|
843
|
+
getSearchInput(): Input;
|
|
844
|
+
}
|
|
845
|
+
|
|
846
|
+
/**
|
|
847
|
+
* OAuth provider selector component for /login and /logout commands
|
|
848
|
+
*/
|
|
849
|
+
|
|
850
|
+
/**
|
|
851
|
+
* Interface for auth provider that the selector needs.
|
|
852
|
+
* Can be satisfied by Harness or AuthStorage.
|
|
853
|
+
*/
|
|
854
|
+
interface AuthProviderSource {
|
|
855
|
+
getOAuthProviders(): OAuthProviderInterface[];
|
|
856
|
+
isLoggedIn(providerId: string): boolean;
|
|
857
|
+
}
|
|
858
|
+
declare class LoginSelectorComponent extends Box {
|
|
859
|
+
private listContainer;
|
|
860
|
+
private allProviders;
|
|
861
|
+
private selectedIndex;
|
|
862
|
+
private mode;
|
|
863
|
+
private authSource;
|
|
864
|
+
private onSelectCallback;
|
|
865
|
+
private onCancelCallback;
|
|
866
|
+
constructor(mode: 'login' | 'logout', authSource: AuthProviderSource, onSelect: (providerId: string) => void, onCancel: () => void);
|
|
867
|
+
private loadProviders;
|
|
868
|
+
private updateList;
|
|
869
|
+
handleInput(keyData: string): void;
|
|
870
|
+
}
|
|
871
|
+
|
|
872
|
+
/**
|
|
873
|
+
* Login dialog component - handles OAuth login flow UI
|
|
874
|
+
*/
|
|
875
|
+
|
|
876
|
+
declare class LoginDialogComponent extends Box implements Focusable {
|
|
877
|
+
private onComplete;
|
|
878
|
+
private contentContainer;
|
|
879
|
+
private input;
|
|
880
|
+
private tui;
|
|
881
|
+
private abortController;
|
|
882
|
+
private inputResolver?;
|
|
883
|
+
private inputRejecter?;
|
|
884
|
+
private _focused;
|
|
885
|
+
get focused(): boolean;
|
|
886
|
+
set focused(value: boolean);
|
|
887
|
+
constructor(tui: TUI, providerId: string, onComplete: (success: boolean, message?: string) => void);
|
|
888
|
+
get signal(): AbortSignal;
|
|
889
|
+
private cancel;
|
|
890
|
+
/**
|
|
891
|
+
* Called by onAuth callback - show URL and optional instructions
|
|
892
|
+
*/
|
|
893
|
+
showAuth(url: string, instructions?: string): void;
|
|
894
|
+
/**
|
|
895
|
+
* Called by onPrompt callback - show prompt and wait for input
|
|
896
|
+
*/
|
|
897
|
+
showPrompt(message: string, placeholder?: string): Promise<string>;
|
|
898
|
+
/**
|
|
899
|
+
* Show progress message
|
|
900
|
+
*/
|
|
901
|
+
showProgress(message: string): void;
|
|
902
|
+
handleInput(data: string): void;
|
|
903
|
+
}
|
|
904
|
+
|
|
905
|
+
/**
|
|
906
|
+
* Theme system for the Mastra Code TUI.
|
|
907
|
+
* Simplified from pi-mono's theme system.
|
|
908
|
+
*/
|
|
909
|
+
|
|
910
|
+
type ThemeMode = 'dark' | 'light';
|
|
911
|
+
declare function getThemeMode(): ThemeMode;
|
|
912
|
+
declare const mastraBrand: {
|
|
913
|
+
readonly purple: "#7f45e0";
|
|
914
|
+
readonly green: "#059669";
|
|
915
|
+
readonly orange: "#fdac53";
|
|
916
|
+
readonly pink: "#ff69cc";
|
|
917
|
+
readonly blue: "#2563eb";
|
|
918
|
+
readonly red: "#DC5663";
|
|
919
|
+
readonly yellow: "#e7e67b";
|
|
920
|
+
};
|
|
921
|
+
interface MastraSurface {
|
|
922
|
+
bg: string;
|
|
923
|
+
antiGrid: string;
|
|
924
|
+
elevationSm: string;
|
|
925
|
+
elevationLg: string;
|
|
926
|
+
hover: string;
|
|
927
|
+
white: string;
|
|
928
|
+
specialGray: string;
|
|
929
|
+
mainGray: string;
|
|
930
|
+
darkGray: string;
|
|
931
|
+
borderAntiGrid: string;
|
|
932
|
+
borderElevation: string;
|
|
933
|
+
}
|
|
934
|
+
type MastraPalette = typeof mastraBrand & MastraSurface;
|
|
935
|
+
/** Mastra palette — brand colors are constant, surface colors adapt to theme mode. */
|
|
936
|
+
declare const mastra: MastraPalette;
|
|
937
|
+
type ThemeColor = 'accent' | 'border' | 'borderAccent' | 'borderMuted' | 'success' | 'error' | 'warning' | 'muted' | 'dim' | 'text' | 'thinkingText' | 'userMessageText' | 'toolTitle' | 'toolOutput' | 'toolBorderPending' | 'toolBorderSuccess' | 'toolBorderError' | 'function' | 'path' | 'number';
|
|
938
|
+
type ThemeBg = 'selectedBg' | 'userMessageBg' | 'systemReminderBg' | 'toolPendingBg' | 'toolSuccessBg' | 'toolErrorBg' | 'overlayBg' | 'errorBg';
|
|
939
|
+
interface ThemeColors {
|
|
940
|
+
accent: string;
|
|
941
|
+
border: string;
|
|
942
|
+
borderAccent: string;
|
|
943
|
+
borderMuted: string;
|
|
944
|
+
success: string;
|
|
945
|
+
error: string;
|
|
946
|
+
warning: string;
|
|
947
|
+
muted: string;
|
|
948
|
+
dim: string;
|
|
949
|
+
text: string;
|
|
950
|
+
thinkingText: string;
|
|
951
|
+
userMessageBg: string;
|
|
952
|
+
userMessageText: string;
|
|
953
|
+
systemReminderBg: string;
|
|
954
|
+
toolPendingBg: string;
|
|
955
|
+
toolSuccessBg: string;
|
|
956
|
+
toolErrorBg: string;
|
|
957
|
+
toolBorderPending: string;
|
|
958
|
+
toolBorderSuccess: string;
|
|
959
|
+
toolBorderError: string;
|
|
960
|
+
toolTitle: string;
|
|
961
|
+
toolOutput: string;
|
|
962
|
+
selectedBg: string;
|
|
963
|
+
overlayBg: string;
|
|
964
|
+
errorBg: string;
|
|
965
|
+
path: string;
|
|
966
|
+
number: string;
|
|
967
|
+
function: string;
|
|
968
|
+
}
|
|
969
|
+
/**
|
|
970
|
+
* Get the current theme colors.
|
|
971
|
+
*/
|
|
972
|
+
declare function getTheme(): ThemeColors;
|
|
973
|
+
/**
|
|
974
|
+
* Set the current theme.
|
|
975
|
+
*/
|
|
976
|
+
declare function setTheme(colors: ThemeColors): void;
|
|
977
|
+
/**
|
|
978
|
+
* Apply a theme mode, updating both the surface palette and the theme colors.
|
|
979
|
+
*/
|
|
980
|
+
declare function applyThemeMode(mode: ThemeMode): void;
|
|
981
|
+
/**
|
|
982
|
+
* Apply foreground color from theme.
|
|
983
|
+
*/
|
|
984
|
+
declare function fg(color: ThemeColor, text: string): string;
|
|
985
|
+
/**
|
|
986
|
+
* Apply background color from theme.
|
|
987
|
+
*/
|
|
988
|
+
declare function bg(color: ThemeBg, text: string): string;
|
|
989
|
+
/**
|
|
990
|
+
* Apply bold styling.
|
|
991
|
+
*/
|
|
992
|
+
declare function bold(text: string): string;
|
|
993
|
+
/**
|
|
994
|
+
* Apply italic styling.
|
|
995
|
+
*/
|
|
996
|
+
declare function italic(text: string): string;
|
|
997
|
+
/**
|
|
998
|
+
* Apply dim styling.
|
|
999
|
+
*/
|
|
1000
|
+
declare function dim(text: string): string;
|
|
1001
|
+
declare const theme: {
|
|
1002
|
+
fg: typeof fg;
|
|
1003
|
+
bg: typeof bg;
|
|
1004
|
+
bold: typeof bold;
|
|
1005
|
+
italic: typeof italic;
|
|
1006
|
+
dim: typeof dim;
|
|
1007
|
+
getTheme: typeof getTheme;
|
|
1008
|
+
setTheme: typeof setTheme;
|
|
1009
|
+
};
|
|
1010
|
+
declare function getMarkdownTheme(): MarkdownTheme;
|
|
1011
|
+
declare function getEditorTheme(): EditorTheme;
|
|
1012
|
+
|
|
1013
|
+
export { AssistantMessageComponent, type IToolExecutionComponent, LoginDialogComponent, LoginSelectorComponent, MastraTUI, type MastraTUIOptions, type ModelItem, ModelSelectorComponent, type ModelSelectorOptions, OMProgressComponent, type TUIState, type ThemeBg, type ThemeColor, type ThemeColors, type ThemeMode, ToolExecutionComponentEnhanced, type ToolExecutionOptions, type ToolResult, UserMessageComponent, applyThemeMode, createTUIState, formatOMStatus, getEditorTheme, getMarkdownTheme, getThemeMode, mastra, mastraBrand, theme };
|