/** * [WHO]: Provides AuthProviderConfigController + AuthProviderConfigContext — interactive auth/provider configuration * [FROM]: Depends on @catui/ai OAuth helpers, core/model/custom-providers, URL-first setup prompts, config paths, TUI components * [TO]: Consumed by modes/interactive/interactive-mode.ts and model-overlay providerConfig port * [HERE]: modes/interactive/controllers/auth-provider-config-controller.ts — P5 auth/provider-config slice; * built-in provider selection shows a Browse models / API-key action menu so credential updates stay * reachable without a hidden shortcut (parity with custom protocol providers) * * Owns interactive credential/config prompts and OAuth UI. It does not own model selection overlay; * model-overlay consumes this controller through ProviderConfigPort and receives model application * callbacks through a narrow bridge. */ import type { Model } from "@catui/ai/types"; import type { Component, Container, TUI } from "@catui/tui"; import type { ModelRegistry } from "../../../core/model-registry.js"; import { type ProviderSelectorItem } from "../components/oauth-selector.js"; type AnyModel = Model; export interface AuthProviderConfigSurface { showSelector(create: (done: () => void) => { component: Component; focus: Component; }): void; showStatus(message: string): void; showError(message: string): void; promptInput(title: string, placeholder?: string, opts?: { initialValue?: string; }): Promise; /** Titled single-choice option picker; resolves undefined on cancel. */ pickOption(title: string, options: string[]): Promise; requestRender(): void; getUi(): TUI; getEditorContainer(): Container; getEditor(): Component; remountEditorShell(): void; } export interface AuthProviderModelBridge { getCurrentModel(): AnyModel | undefined; setCurrentModel(model: AnyModel): Promise; showModelSelector(initialSearchInput?: string, filterByProvider?: string): void; applySelectedModel(model: AnyModel): Promise; updateAvailableProviderCount(): Promise; } export interface AuthProviderConfigContext { modelRegistry: ModelRegistry; surface: AuthProviderConfigSurface; modelBridge: AuthProviderModelBridge; } export declare class AuthProviderConfigController { private readonly ctx; constructor(ctx: AuthProviderConfigContext); handleApiKeyCommand(): Promise; handleLoginCommand(text: string): Promise; ensureProviderConfiguredForSelection(model: AnyModel): Promise; handleProviderSelectionFromSelector(provider: string, done: () => void): Promise; /** * Action menu after picking a built-in (non-custom-protocol) provider from the * provider selector: browse models or (re)configure the provider API key. * Gives built-in providers the same always-reachable credential entry that * custom protocol providers (e.g. Anthropic-compatible) have on selection. * Both paths continue into the model selector for that provider. */ private showBuiltInProviderActions; showOAuthSelector(mode: "login" | "logout"): Promise; getLoginSelectorProviders(mode: "login" | "logout"): ProviderSelectorItem[]; private getStoredApiKey; private resolveProviderId; promptForProviderApiKey(provider: string, options?: { title?: string; }): Promise; private handleProviderCredentialsCommand; private configureCustomProtocolProvider; private refreshCurrentModelForProvider; private selectConfiguredCustomProvider; private showLoginDialog; } export {};