import type { LLMProvider } from '@dexto/llm';
import type { TuiAgentBackend } from '../agent-backend.js';
export interface TuiShutdownHandle {
    stop?: (() => Promise<void>) | undefined;
}
export interface TuiAuthConfig {
    token?: string | undefined;
    refreshToken?: string | undefined;
    userId?: string | undefined;
    email?: string | undefined;
    expiresAt?: number | undefined;
    createdAt: number;
    dextoApiKey?: string | undefined;
    dextoKeyId?: string | undefined;
    dextoApiKeySource?: 'provisioned' | 'user-supplied' | undefined;
}
export interface TuiDeviceApiKeyLoginResult {
    dextoApiKey: string;
    dextoKeyId: string;
    dextoKeyDisplay: string;
}
export interface TuiDeviceLoginPrompt {
    userCode: string;
    verificationUrl: string;
    verificationUrlComplete: string | null;
    expiresIn: number;
}
export type TuiDextoApiKeyProvisionStatusLevel = 'info' | 'success' | 'warning' | 'error';
export interface TuiDextoApiKeyProvisionStatus {
    level: TuiDextoApiKeyProvisionStatusLevel;
    message: string;
}
export interface TuiPersistedLoginResult {
    email?: string | undefined;
    userId?: string | undefined;
    keyId?: string | undefined;
    hasDextoApiKey: boolean;
}
export interface TuiRuntimeServices {
    registerGracefulShutdown?: (getAgent: () => TuiShutdownHandle, options: {
        inkMode: boolean;
    }) => void;
    capture?: (event: string, properties?: Record<string, unknown>) => void;
    applyLayeredEnvironmentLoading?: () => Promise<void>;
    getProviderDisplayName?: (provider: LLMProvider | string) => string;
    isValidApiKeyFormat?: (apiKey: string, provider: LLMProvider) => boolean;
    getProviderInstructions?: (provider: LLMProvider) => {
        title: string;
        content: string;
        url?: string | undefined;
    } | null;
    performDeviceCodeLogin?: (options?: {
        signal?: AbortSignal | undefined;
        onPrompt?: ((prompt: TuiDeviceLoginPrompt) => void) | undefined;
    }) => Promise<TuiDeviceApiKeyLoginResult>;
    persistDeviceApiKeyLoginResult?: (result: TuiDeviceApiKeyLoginResult) => Promise<TuiPersistedLoginResult>;
    ensureDextoApiKeyForAuthToken?: (authToken: string, options?: {
        onStatus?: ((status: TuiDextoApiKeyProvisionStatus) => void) | undefined;
    }) => Promise<{
        dextoApiKey: string;
        keyId: string | null;
    } | null>;
    loadAuth?: () => Promise<TuiAuthConfig | null>;
    storeAuth?: (config: TuiAuthConfig) => Promise<void>;
    removeAuth?: () => Promise<void>;
    removeDextoApiKeyFromEnv?: (options?: {
        expectedValue?: string;
    }) => Promise<{
        removed: boolean;
        targetEnvPath: string;
    }>;
    isUsingDextoCredits?: () => Promise<boolean>;
    canUseDextoProvider?: () => Promise<boolean>;
    buildDextoBillingUrl?: (options: {
        creditsUsd: number;
    }) => string;
    openDextoBillingPage?: (options: {
        url?: string | undefined;
    }) => Promise<void>;
}
export declare function setTuiRuntimeServices(adapter: TuiRuntimeServices): void;
export declare function getTuiRuntimeServices(): TuiRuntimeServices;
export declare function registerGracefulShutdown(getAgent: () => TuiAgentBackend, options: {
    inkMode: boolean;
}): void;
export declare function captureAnalytics(event: string, properties?: Record<string, unknown>): void;
export declare function applyLayeredEnvironmentLoading(): Promise<void>;
export declare function getProviderDisplayName(provider: LLMProvider | string): string;
export declare function isValidApiKeyFormat(apiKey: string, provider: LLMProvider): boolean;
export declare function getProviderInstructions(provider: LLMProvider): {
    title: string;
    content: string;
    url?: string | undefined;
} | null;
export declare function performDeviceCodeLogin(options?: {
    signal?: AbortSignal | undefined;
    onPrompt?: ((prompt: TuiDeviceLoginPrompt) => void) | undefined;
}): Promise<TuiDeviceApiKeyLoginResult>;
export declare function persistDeviceApiKeyLoginResult(result: TuiDeviceApiKeyLoginResult): Promise<TuiPersistedLoginResult>;
export declare function ensureDextoApiKeyForAuthToken(authToken: string, options?: {
    onStatus?: ((status: TuiDextoApiKeyProvisionStatus) => void) | undefined;
}): Promise<{
    dextoApiKey: string;
    keyId: string | null;
} | null>;
export declare function loadAuth(): Promise<TuiAuthConfig | null>;
export declare function storeAuth(config: TuiAuthConfig): Promise<void>;
export declare function removeAuth(): Promise<void>;
export declare function removeDextoApiKeyFromEnv(options?: {
    expectedValue?: string;
}): Promise<{
    removed: boolean;
    targetEnvPath: string;
}>;
export declare function isUsingDextoCredits(): Promise<boolean>;
export declare function canUseDextoProvider(): Promise<boolean>;
export declare function buildDextoBillingUrl(options: {
    creditsUsd: number;
}): string;
export declare function openDextoBillingPage(options: {
    url?: string | undefined;
}): Promise<void>;
//# sourceMappingURL=index.d.ts.map