import type { ClientEnv } from '@levelcode/common/types/contracts/env';
import type { User } from '@levelcode/common/util/credentials';
export declare const userFromJson: (json: string) => User | null;
/**
 * Get the config directory path based on the environment.
 * Uses the clientEnv to determine the environment suffix.
 */
export declare const getConfigDir: (clientEnv?: ClientEnv) => string;
/**
 * Get the credentials file path based on the environment.
 */
export declare const getCredentialsPath: (clientEnv?: ClientEnv) => string;
export declare const getUserCredentials: (clientEnv?: ClientEnv) => User | null;
/**
 * Claude OAuth credentials stored in the credentials file.
 */
export interface ClaudeOAuthCredentials {
    accessToken: string;
    refreshToken: string;
    expiresAt: number;
    connectedAt: number;
}
/**
 * Get Claude OAuth credentials from file or environment variable.
 * Environment variable takes precedence.
 * @returns OAuth credentials or null if not found
 */
export declare const getClaudeOAuthCredentials: (clientEnv?: ClientEnv) => ClaudeOAuthCredentials | null;
/**
 * Save Claude OAuth credentials to the credentials file.
 * Preserves existing user credentials.
 */
export declare const saveClaudeOAuthCredentials: (credentials: ClaudeOAuthCredentials, clientEnv?: ClientEnv) => void;
/**
 * Clear Claude OAuth credentials from the credentials file.
 * Preserves other credentials.
 */
export declare const clearClaudeOAuthCredentials: (clientEnv?: ClientEnv) => void;
/**
 * Check if Claude OAuth credentials are valid (not expired).
 * Returns true if credentials exist and haven't expired.
 */
export declare const isClaudeOAuthValid: (clientEnv?: ClientEnv) => boolean;
/**
 * Refresh the Claude OAuth access token using the refresh token.
 * Returns the new credentials if successful, null if refresh fails.
 * Uses a mutex to prevent concurrent refresh attempts.
 */
export declare const refreshClaudeOAuthToken: (clientEnv?: ClientEnv) => Promise<ClaudeOAuthCredentials | null>;
/**
 * Get valid Claude OAuth credentials, refreshing if necessary.
 * This is the main function to use when you need credentials for an API call.
 *
 * - Returns credentials immediately if valid (>5 min until expiry)
 * - Attempts refresh if token is expired or near-expiry
 * - Returns null if no credentials or refresh fails
 */
export declare const getValidClaudeOAuthCredentials: (clientEnv?: ClientEnv) => Promise<ClaudeOAuthCredentials | null>;
