/** Browser projection of the Host-owned authentication RPC. */ import type { SnapshotStore } from '@deepseek-ai/dsh-client-store'; import type { CodexAuthRpcClient } from '../rpc-contract.ts'; import type { CodexAuthState, CodexLoginMethod, CodexNetworkState, CodexProxyMode, CodexResetCreditsSnapshot, CodexResetRedeemOutcome, CodexUsageSnapshot } from '../types.ts'; /** One UI action crossing the wire. */ export type CodexAuthAction = 'login' | 'cancel' | 'logout' | 'proxy-mode' | 'reset-redeem'; /** Lifecycle of one banked-reset redemption attempt. */ export type CodexRedeemStatus = 'idle' | 'redeeming' | 'done' | 'error'; /** Snapshot rendered by the settings page. */ export interface CodexAuthCardState { status: 'idle' | 'loading' | 'ready' | 'error'; auth: CodexAuthState; networkStatus: 'idle' | 'loading' | 'ready' | 'error'; network: CodexNetworkState | null; usageStatus: 'idle' | 'loading' | 'ready' | 'error'; usage: CodexUsageSnapshot | null; resetStatus: 'idle' | 'loading' | 'ready' | 'error'; resetCredits: CodexResetCreditsSnapshot | null; redeemStatus: CodexRedeemStatus; redeemResult: CodexResetRedeemOutcome | null; action: CodexAuthAction | null; actionFailed: boolean; } /** Registration-side business face for the Codex settings page. */ export interface CodexAuthCardFace { hooks: { codexAuth: SnapshotStore; }; isLoopback: boolean; load: () => void; refresh: () => void; setProxyMode: (mode: CodexProxyMode) => void; loadResetCredits: () => void; redeemResetCredit: () => void; login: (method: CodexLoginMethod) => void; cancel: () => void; logout: () => void; } /** Join RPC replies and connection invalidations into one observable view. */ export declare class CodexAuthCardController { private readonly remote; readonly store: SnapshotStore; private loadGeneration; private resetGeneration; constructor(remote: CodexAuthRpcClient); /** Read auth, network, and usage concurrently; the latest invocation wins. */ load(silent?: boolean): Promise; private accept; /** Drop banked-reset state; only a connected account can hold resets. */ private clearResetState; /** * Load the banked-reset listing for the redemption dialog. A non-silent * invocation also clears any previous redemption result, so reopening the * dialog starts from a clean confirmation state. */ loadResetCredits(silent?: boolean): void; private runResetCredits; /** Redeem one banked reset; OpenAI chooses the credit when several exist. */ redeemResetCredit(): void; private runRedeem; setProxyMode(mode: CodexProxyMode): void; private runProxyMode; login(method: CodexLoginMethod): void; cancel(): void; logout(): void; private run; /** Build the stable face registered into the Settings slot. */ face(isLoopback: boolean): CodexAuthCardFace; }