/**
 * local-context-ingestion.ts
 *
 * Local provider `max_context_length` ingestion.
 *
 * Fetches the /v1/models endpoint for local/custom providers and extracts
 * per-model `max_context_length` values. Results are keyed by model ID and
 * stored in an in-memory cache per provider.
 *
 * Feature flag: `local-provider-context-ingestion`
 * When disabled, this module is a no-op and callers fall back to the
 * statically-configured context window.
 *
 * Provenance ladder (highest to lowest):
 *   provider_api     — value from /v1/models max_context_length
 *   configured_cap   — explicit contextWindow in custom provider config
 *   fallback         — DEFAULT_CONTEXT_WINDOW constant
 */
/**
 * Provenance tag for a resolved context window value.
 *
 * - `provider_api`   — sourced from the provider's /v1/models endpoint
 * - `configured_cap` — explicit value from the custom provider config file
 * - `fallback`       — DEFAULT_CONTEXT_WINDOW (no config, no API response)
 */
export type ContextWindowProvenance = 'provider_api' | 'configured_cap' | 'fallback';
/**
 * A fully-resolved context window with its provenance and metadata.
 */
export interface ResolvedContextWindow {
    /** Effective context window in tokens, ready for use in budgeting. */
    tokens: number;
    /** How this value was resolved. */
    provenance: ContextWindowProvenance;
    /**
     * When provenance is `provider_api`, the raw value from the API.
     * May differ from `tokens` when a configured_cap is applied.
     */
    apiReportedTokens?: number;
    /**
     * When provenance is `provider_api`, the safe cap that was applied
     * (equal to `tokens` when no cap was enforced).
     */
    safeCap?: number;
}
/**
 * Default fallback context window when neither the API nor the config
 * provides a value.
 */
export declare const DEFAULT_CONTEXT_WINDOW = 8192;
/**
 * Ingest context window data from a local provider's /v1/models endpoint.
 *
 * Results are cached in-memory for `CACHE_TTL_MS`. Repeated calls within the
 * TTL return the cached value immediately without making a network request.
 *
 * @param providerName - Unique provider name (used as cache key).
 * @param baseURL      - Provider base URL (e.g. `http://localhost:11434/v1`).
 * @param apiKey       - Optional API key sent as Bearer token.
 * @returns Map of model ID → raw context length from the API, or null if
 *          the provider is offline or returned an unrecognised response.
 */
export declare class LocalContextIngestionService {
    private readonly providerCache;
    ingestProviderContextWindows(providerName: string, baseURL: string, apiKey?: string): Promise<Map<string, number> | null>;
    clearProviderCache(providerName: string): void;
    clearAllCaches(): void;
    getDiagnostics(): Array<{
        providerName: string;
        fetchedAt: number;
        modelCount: number;
        failed: boolean;
    }>;
}
/**
 * Resolve the effective context window for a single model with provenance.
 *
 * Priority ladder:
 *   1. provider_api  — `apiContextLength` when valid (> 0)
 *   2. configured_cap — `configuredContextWindow` when valid (> 0)
 *   3. fallback      — `DEFAULT_CONTEXT_WINDOW`
 *
 * @param modelId                - Model ID (for logging).
 * @param apiContextLength       - Context length from /v1/models (null if not available).
 * @param configuredContextWindow - Context window from custom provider config (0 if not set).
 * @returns Resolved context window with provenance metadata.
 */
export declare function resolveContextWindow(modelId: string, apiContextLength: number | null, configuredContextWindow: number): ResolvedContextWindow;
//# sourceMappingURL=local-context-ingestion.d.ts.map