import { TUI, type Component, type Focusable } from '@earendil-works/pi-tui'; import { ModelRegistry, ModelRuntime } from '@earendil-works/pi-coding-agent'; /** pi 0.82 keeps `AuthStatus` inside its unexported provider-composer module; the * only public handle on the shape is the registry method that returns it. */ type AuthStatus = ReturnType; import { type BindingId, type BindingResolution } from '../../core/keybindings/index.js'; import { type SetupPackageId, type SetupPackageManifestEntry, type SetupSubmission, type SetupSystemToolState } from './setup-core.js'; /** Centered, selection-following [start, end) slice of `count` items that * always includes `selected`, clamped to at most `capacity` entries. Mirrors * the oauth/config/session selector formula used elsewhere in pi. Exported for * direct unit coverage of the windowing math (see setup-providers-viewport.test.ts). */ export declare function visibleRange(count: number, selected: number, capacity: number): { start: number; end: number; }; type ProviderAuthType = 'oauth' | 'api_key'; type ProviderRow = { providerId: string; name: string; managed: boolean; authType: ProviderAuthType; label?: string; preferred?: boolean; cooldownUntil?: number; configured?: boolean; source?: AuthStatus['source']; sourceLabel?: string; accountId?: string; }; /** Curated setup-catalog view over pi's OAuth providers + the model registry. */ export declare function buildProviderCatalog(runtime: ModelRuntime, registry: ModelRegistry): ProviderRow[]; /** Classifies a `startLogin` failure into a user-facing status line. */ export declare function classifyLoginFailure(error: unknown, aborted: boolean): string; export declare class SetupWizard implements Component, Focusable { private readonly manifest; private readonly installedPackageIds; private readonly systemTools; private readonly exaInput; private readonly keyInput; private readonly brokerWarningInput; private readonly brokerHardCapInput; private readonly openingBindings; private readonly keyDraft; private readonly terminalRows; private readonly selectedPackageIds; private readonly selectedSystemTools; private readonly providers; private readonly models; private activeTab; private pluginIndex; private systemIndex; private expandedPluginId; private confirming; private keyIndex; private keyScroll; private keyFilter; private filteringKeys; private editingKey; private keyEditError; private keyDiagnostics; private keyConfirm; private keyNotice; private brokerLimitIndex; private brokerLimitNotice; private cachedWidth; private cachedHeight; private cachedLines; private _focused; onSubmit?: (submission: SetupSubmission) => void; onCancel?: () => void; constructor(manifest: SetupPackageManifestEntry[], installedPackageIds: Set, systemTools: SetupSystemToolState[], tui: TUI, agentDir: string, runtime: ModelRuntime, registry: ModelRegistry, openingBindings: BindingResolution, rawKeybindings: unknown, terminalRows: () => number); set focused(value: boolean); get focused(): boolean; invalidate(): void; private setTab; private moveTab; private cancel; dispose(): void; private matches; /** Human hint label for an action, derived from the opening snapshot so footers * reflect the effective (possibly remapped) gestures the wizard actually honors. */ private label; /** Like `label`, but drops gestures a focused pi text Input consumes as data * (single printable chars and the arrow keys), so the Exa footer does * not claim keys that never reach the wizard while a field owns focus. */ private fieldSafeLabel; private handleGlobalTabSwitch; private selectedPackage; private selectedSystem; private movePlugin; private moveSystem; private togglePackage; private toggleSystem; private toggleDetails; private hasPendingInstalls; private buildSubmission; private finalize; private filteredKeybindings; private selectedKeybinding; private moveKey; private keyViewportLines; private keyPageSize; private beginKeyEdit; private commitKeyEdit; private cancelKeyEdit; private saveKeybindings; private refreshTmuxBindingsAfterSave; private confirmKeyAction; private selectedBrokerLimitInput; private moveBrokerLimit; private saveBrokerLimits; private handleBrokerLimitsInput; private handleKeybindingsInput; handleInput(data: string): void; private renderHeader; private renderFooter; private renderProviders; private renderPlugins; private renderSystems; private renderExa; private renderConfirm; private keyRowHasMessage; private keyLineCost; private renderKeybindings; private renderModels; private renderBrokerLimits; render(width: number): string[]; } export declare function runSetup(): Promise; export {};