import { type AuthCredential, type AuthCredentialStore, type StoredAuthCredential } from "@oh-my-pi/pi-ai";
import type { RawSettings as Settings } from "../config/settings.js";
/**
 * Unified SQLite storage for agent settings, model usage, and auth credentials.
 * Delegates auth credential operations to AuthCredentialStore from @oh-my-pi/pi-ai.
 * Uses singleton pattern per database path; access via AgentStorage.open().
 */
export declare class AgentStorage {
    #private;
    private constructor();
    /**
     * Returns singleton instance for the given database path, creating if needed.
     * Retries on the `SQLITE_BUSY` family (including `SQLITE_BUSY_RECOVERY`) with
     * exponential backoff. See issue #2421.
     * @param dbPath - Path to the SQLite database file (defaults to config path)
     * @returns AgentStorage instance for the given path
     */
    static open(dbPath?: string): Promise<AgentStorage>;
    /** @internal Reset all singletons and close their databases — test-only. */
    static resetInstance(): void;
    /**
     * Reads legacy settings persisted in the agent.db `settings` table.
     * The canonical settings store is `config.yml`; this accessor only
     * exists so the config loader can migrate values from older installs.
     * @returns Settings object, or null if no settings are stored
     */
    getSettings(): Settings | null;
    /**
     * Records model usage, updating the last-used timestamp.
     * @param modelKey - Model key in "provider/modelId" format
     */
    recordModelUsage(modelKey: string): void;
    /**
     * Gets model keys ordered by most recently used.
     * Results are cached until recordModelUsage is called.
     * @returns Array of model keys ("provider/modelId") in MRU order
     */
    getModelUsageOrder(): string[];
    /**
     * Checks if any auth credentials exist in storage.
     * @returns True if at least one credential is stored
     */
    hasAuthCredentials(): boolean;
    /**
     * Returns the underlying {@link AuthCredentialStore} so callers that need
     * the lower-level pi-ai abstraction (e.g. `findAnthropicAuth(store)`) can
     * reuse this storage's open database connection instead of opening their
     * own.
     */
    get authStore(): AuthCredentialStore;
    /**
     * Lists auth credentials, optionally filtered by provider.
     * Only returns active (non-disabled) credentials by default.
     * @param provider - Optional provider name to filter by
     * @param includeDisabled - If true, includes disabled credentials
     * @returns Array of stored credentials with their database IDs
     */
    listAuthCredentials(provider?: string, includeDisabled?: boolean): StoredAuthCredential[];
    /**
     * Atomically replaces all credentials for a provider.
     * Useful for OAuth token refresh where old tokens should be discarded.
     * @param provider - Provider name (e.g., "anthropic", "openai")
     * @param credentials - New credentials to store
     * @returns Array of newly stored credentials with their database IDs
     */
    replaceAuthCredentialsForProvider(provider: string, credentials: AuthCredential[]): StoredAuthCredential[];
    /**
     * Updates an existing auth credential by ID.
     * @param id - Database row ID of the credential to update
     * @param credential - New credential data
     */
    updateAuthCredential(id: number, credential: AuthCredential): void;
    /**
     * Disables an auth credential by ID with a persisted cause.
     * @param id - Database row ID of the credential to disable
     * @param disabledCause - Human-readable cause stored with the disabled row
     */
    deleteAuthCredential(id: number, disabledCause: string): void;
    /**
     * Disables all auth credentials for a provider with a persisted cause.
     * @param provider - Provider name whose credentials should be disabled
     * @param disabledCause - Human-readable cause stored with the disabled rows
     */
    deleteAuthCredentialsForProvider(provider: string, disabledCause: string): void;
    /**
     * Gets a cached value by key. Returns null if not found or expired.
     */
    getCache(key: string): string | null;
    /**
     * Sets a cached value with expiry time (unix seconds).
     */
    setCache(key: string, value: string, expiresAtSec: number): void;
    /**
     * Deletes expired cache entries. Call periodically for cleanup.
     */
    cleanExpiredCache(): void;
}
