import type { OllamaDiagnosticContext, OllamaDiagnosticGate, OllamaDiagnosticOutcome, OllamaDiagnosticPermit, OllamaDiagnosticSnapshot } from "../types/index.js";
export declare const OLLAMA_DIAGNOSTIC_RESET_MS = 300000;
/**
 * Validate the shared failure threshold once and reuse that first-use value.
 * Missing or invalid PROVIDER_FAILURE_THRESHOLD values use the existing default
 * of three; ProviderHealthChecker retains its original initialization point.
 */
export declare function getValidatedProviderFailureThreshold(): number;
/** Return diagnostic error text with URL secrets redacted for logs and status. */
export declare function getOllamaDiagnosticErrorMessage(error: unknown): string;
/**
 * Normalize an endpoint identity without its fragment, retaining path and query.
 * The key can contain credentials and must remain private like the source URL.
 */
export declare function getOllamaDiagnosticEndpointKey(url: string): string;
/**
 * Resolve native /api/tags at the configured Ollama origin, independently of a
 * compatible /v1 base path. OLLAMA_BASE_URL precedes the legacy OLLAMA_API_BASE
 * alias, then localhost; malformed URLs and non-HTTP(S) schemes are rejected.
 */
export declare function resolveOllamaNativeTagsUrl(): string;
/**
 * Capture endpoint identity and model before asynchronous diagnostic work.
 * Later environment changes cannot retarget this context or its health-cache
 * identity; failure accounting remains shared by endpoint rather than model.
 */
export declare function captureOllamaDiagnosticContext(model?: string): OllamaDiagnosticContext;
/**
 * Copy the current policy state after applying initialization or timed expiry.
 * This observation issues no request and records neither failure nor recovery.
 */
export declare function getOllamaDiagnosticSnapshot(context: OllamaDiagnosticContext): OllamaDiagnosticSnapshot;
/**
 * Admit a native probe or report backoff at the current failure threshold.
 * Timed expiry is applied before this decision. Admission captures the clear
 * generation without reserving a request or recording an outcome; callers must
 * record the actual outcome on completion.
 */
export declare function beginOllamaDiagnostic(context: OllamaDiagnosticContext): OllamaDiagnosticGate;
/**
 * Apply timed expiry, then an admitted outcome once to the latest endpoint state.
 * Transport/protocol failures increment its current count; success clears a
 * nonzero count; not-run records no outcome. Timed expiry preserves permits,
 * including those admitted before the boundary and completed after it.
 * Duplicate permits and permits invalidated by explicit clearing are ignored.
 *
 * @returns A copy of the resulting state, or undefined for an ignored permit.
 */
export declare function completeOllamaDiagnostic(attempt: OllamaDiagnosticPermit, outcome: OllamaDiagnosticOutcome): OllamaDiagnosticSnapshot | undefined;
/**
 * Clear every endpoint and advance generation, invalidating in-flight permits.
 * Unlike timed expiry, this prevents an older completion from repopulating state.
 */
export declare function clearOllamaDiagnostics(): void;
/**
 * Separate cached health by captured endpoint and model without splitting the
 * endpoint-wide diagnostic counter. This private key can contain URL secrets.
 */
export declare function getOllamaHealthCacheKey(context: OllamaDiagnosticContext): string;
export declare class OllamaProtocolError extends Error {
    /** Identify an answered tags response whose models envelope is malformed. */
    constructor();
}
/**
 * Require an object containing a models array, including an empty array.
 * Individual model entries are left to existing normalization; a malformed
 * envelope throws OllamaProtocolError rather than appearing as no models.
 */
export declare function readOllamaTagsModels(payload: unknown): unknown[];
