/**
 * Common helpers used across streaming adapters when surfacing failures
 * out of provider-specific error shapes into our unified domain types.
 */
import type { StopReason } from "../types.js";
/**
 * Canonical, provider-agnostic identifiers used to tag failure modes coming
 * back from upstream LLM endpoints.
 */
export declare enum ProviderErrorCode {
    /** Authentication failed (invalid API key). */
    AUTHENTICATION_FAILED = "AUTHENTICATION_FAILED",
    /** Rate limit exceeded. */
    RATE_LIMITED = "RATE_LIMITED",
    /** Request timed out. */
    TIMEOUT = "TIMEOUT",
    /** Network connection error. */
    NETWORK_ERROR = "NETWORK_ERROR",
    /** Invalid request parameters. */
    INVALID_REQUEST = "INVALID_REQUEST",
    /** Provider service unavailable. */
    SERVICE_UNAVAILABLE = "SERVICE_UNAVAILABLE",
    /** Content policy violation. */
    CONTENT_FILTERED = "CONTENT_FILTERED",
    /** Unknown or unexpected error. */
    UNKNOWN = "UNKNOWN"
}
/**
 * Error type emitted by adapters once a raw provider error has been
 * normalised; carries a coded reason plus the original payload for callers
 * that want to drill deeper.
 */
export declare class ProviderError extends Error {
    readonly code: ProviderErrorCode;
    readonly originalError?: unknown | undefined;
    constructor(message: string, code: ProviderErrorCode, originalError?: unknown | undefined);
}
/**
 * Translates the assorted stop-reason strings different providers emit into
 * the small closed StopReason enum the rest of the stack relies on.
 */
export declare function mapProviderStopReason(reason: string | null | undefined, provider: string): StopReason;
/**
 * Renders a human-readable string for any error value, tagging it with the
 * provider name and embedding the error code when one is available.
 */
export declare function formatProviderError(error: unknown, providerName: string): string;
/**
 * Heuristic for whether a failure is worth another attempt: classified codes
 * map directly, while generic errors are sniffed by message text.
 */
export declare function isRetryableError(error: unknown): boolean;
