@wrongstack/tui 0.277.1 → 0.280.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -124,6 +124,82 @@ type HistoryEntry = {
124
124
  detail?: string | undefined;
125
125
  };
126
126
 
127
+ /** One saved API key / OAuth token, with the secret already masked. */
128
+ interface AuthKeyRow {
129
+ label: string;
130
+ /** Pre-masked display form ("sk-a…f3k2" / "••••••") — never the secret. */
131
+ masked: string;
132
+ createdAt: string;
133
+ active: boolean;
134
+ authMethod?: 'api_key' | 'oauth' | 'session_token' | undefined;
135
+ expiresAt?: string | undefined;
136
+ }
137
+ /** One saved provider from ~/.wrongstack/config.json. */
138
+ interface AuthProviderRow {
139
+ id: string;
140
+ type?: string | undefined;
141
+ family?: string | undefined;
142
+ baseUrl?: string | undefined;
143
+ models: string[];
144
+ envVars: string[];
145
+ keys: AuthKeyRow[];
146
+ }
147
+ /** One models.dev catalog entry offered by "Add provider (catalog)". */
148
+ interface AuthCatalogRow {
149
+ id: string;
150
+ name: string;
151
+ family: string;
152
+ apiBase?: string | undefined;
153
+ envVars: string[];
154
+ /** Already present in the saved config (shown as ◉). */
155
+ saved: boolean;
156
+ }
157
+ /** One local-LLM preset (OmniRoute / Ollama / vLLM / LM Studio). */
158
+ interface AuthLocalPresetRow {
159
+ id: string;
160
+ label: string;
161
+ defaultBaseUrl: string;
162
+ noAuth: boolean;
163
+ hint: string;
164
+ }
165
+ type AuthOAuthKind = 'chatgpt' | 'claude' | 'copilot';
166
+ /**
167
+ * Bridge the CLI flows use to talk to the panel while a flow runs.
168
+ * `prompt` REJECTS when the user cancels (Esc) — flows treat a thrown
169
+ * prompt as user-cancel, which aborts before anything is saved.
170
+ */
171
+ interface AuthFlowIo {
172
+ onLog(line: string): void;
173
+ prompt(question: string, opts: {
174
+ secret: boolean;
175
+ }): Promise<string>;
176
+ signal: AbortSignal;
177
+ }
178
+ interface AuthFlowResult {
179
+ ok: boolean;
180
+ message?: string | undefined;
181
+ }
182
+ /**
183
+ * Host callbacks the CLI provides. Simple mutations return an error
184
+ * string (or null on success); multi-step interactions run as "flows"
185
+ * that log and prompt through {@link AuthFlowIo}.
186
+ */
187
+ interface AuthPanelHost {
188
+ listProviders(): Promise<AuthProviderRow[]>;
189
+ listCatalog(): Promise<AuthCatalogRow[]>;
190
+ localPresets(): AuthLocalPresetRow[];
191
+ setActiveKey(providerId: string, label: string): Promise<string | null>;
192
+ deleteKey(providerId: string, label: string): Promise<string | null>;
193
+ removeProvider(providerId: string): Promise<string | null>;
194
+ addKey(providerId: string, io: AuthFlowIo): Promise<AuthFlowResult>;
195
+ updateKey(providerId: string, label: string, io: AuthFlowIo): Promise<AuthFlowResult>;
196
+ editField(providerId: string, field: 'family' | 'baseUrl' | 'models', io: AuthFlowIo): Promise<AuthFlowResult>;
197
+ addCatalogProvider(catalogId: string, io: AuthFlowIo): Promise<AuthFlowResult>;
198
+ addCustomProvider(io: AuthFlowIo): Promise<AuthFlowResult>;
199
+ addLocal(presetId: string, io: AuthFlowIo): Promise<AuthFlowResult>;
200
+ oauthLogin(kind: AuthOAuthKind, io: AuthFlowIo): Promise<AuthFlowResult>;
201
+ }
202
+
127
203
  interface ProviderOption {
128
204
  id: string;
129
205
  family: string;
@@ -146,6 +222,21 @@ type CacheTtl = (typeof CACHE_TTLS)[number];
146
222
  /** All possible statusline chip keys. */
147
223
  type StatuslineItem = 'version' | 'state' | 'model' | 'tokens' | 'cache' | 'queue' | 'processes' | 'hint' | 'index' | 'breaker' | 'todos' | 'plan' | 'tasks' | 'fleet' | 'fleet_agents' | 'git' | 'elapsed' | 'context' | 'cost' | 'working_dir' | 'project' | 'yolo' | 'autonomy' | 'eternal_stage' | 'goal' | 'mode' | 'auto_proceed' | 'sessions' | 'tools' | 'token_saving' | 'brain' | 'mailbox' | 'enhance' | 'debug_stream' | 'next_steps';
148
224
 
225
+ interface PluginPickerItem {
226
+ name: string;
227
+ enabled: boolean;
228
+ risk: 'low' | 'medium' | 'high';
229
+ summary: string;
230
+ /**
231
+ * When false the row is locked: the picker renders a 🔒 marker and ignores
232
+ * Enter/←/→ on it. Core plugins (security, prompts, skills, sync, git, …)
233
+ * and the critical guard plugins (secret-scanner, branch-guard) set this
234
+ * to false so they stay visible in the menu but cannot be toggled off —
235
+ * matching the rationale in `PLUGIN_AUDIT_ENTRIES`.
236
+ */
237
+ lockable?: boolean | undefined;
238
+ }
239
+
149
240
  /** Thin view over a SessionSummary for the resume picker. */
150
241
  interface ResumeSessionEntry {
151
242
  id: string;
@@ -259,6 +350,8 @@ interface RunTuiOptions {
259
350
  yolo?: boolean | undefined;
260
351
  /** Query live YOLO state from the permission policy. */
261
352
  getYolo?: (() => boolean) | undefined;
353
+ /** Set live YOLO state from TUI-owned controls such as ConfirmPrompt. */
354
+ onYolo?: ((enabled: boolean) => boolean) | undefined;
262
355
  /** Query the live autonomy mode. */
263
356
  getAutonomy?: (() => 'off' | 'suggest' | 'auto' | 'eternal' | 'eternal-parallel') | undefined;
264
357
  /**
@@ -501,6 +594,20 @@ interface RunTuiOptions {
501
594
  * error string on failure (so the TUI can display it as a hint).
502
595
  */
503
596
  saveSettings?: ((s: Settings) => string | null | Promise<string | null>) | undefined;
597
+ /** Load toggleable plugin rows for the interactive plugin picker. */
598
+ getPluginItems?: (() => PluginPickerItem[]) | undefined;
599
+ /** Toggle one plugin from the interactive picker and return refreshed rows. */
600
+ onPluginToggle?: ((name: string) => Promise<{
601
+ items: PluginPickerItem[];
602
+ message?: string | undefined;
603
+ error?: string | undefined;
604
+ }>) | undefined;
605
+ /**
606
+ * Host for the interactive `/auth` panel (provider/key management, OAuth
607
+ * sign-in, local-server add). The CLI builds this from its vault +
608
+ * models registry; when absent, `/auth` falls back to plain text.
609
+ */
610
+ authHost?: AuthPanelHost | undefined;
504
611
  /**
505
612
  * Predict likely next steps after a completed turn. The CLI wires this from
506
613
  * the session provider and the `/next` toggle; it returns [] when prediction
@@ -763,4 +870,4 @@ interface ParseNextStepsResult {
763
870
  */
764
871
  declare function parseNextSteps(content: string, strict?: boolean, requireHeading?: boolean): ParseNextStepsResult;
765
872
 
766
- export { type ParseNextStepsResult, type ParsedNextStep, type RunTuiOptions, type Settings, parseInline, parseNextSteps, replaySessionEvents, runTui };
873
+ export { type AuthCatalogRow, type AuthFlowIo, type AuthFlowResult, type AuthKeyRow, type AuthLocalPresetRow, type AuthOAuthKind, type AuthPanelHost, type AuthProviderRow, type ParseNextStepsResult, type ParsedNextStep, type PluginPickerItem, type RunTuiOptions, type Settings, parseInline, parseNextSteps, replaySessionEvents, runTui };