/**
 * context-discovery.ts
 *
 * Multi-provider context window discovery with verbose-first endpoint probing.
 *
 * Implements a provider-agnostic discovery chain that probes endpoints from
 * most-informative (verbose) to least-informative, returning the richest
 * available context window data for each model.
 *
 * Discovery chain (ordered most-verbose to least-verbose):
 *   1. /api/v1/models  — LM Studio rich format (key + max_context_length)
 *   2. /api/tags       — Ollama list + per-model /api/show for context_length
 *   3. /v1/models      — OpenAI compat (id, optionally max_model_len for vLLM)
 *   4. /props          — llama.cpp server-level n_ctx (single context all models)
 *   5. /info           — TGI format (max_input_tokens / max_total_tokens)
 *
 * Feature flag: `local-provider-context-ingestion`
 */
/** Placeholder model ID used when a server-level endpoint has no model list. */
export declare const SERVER_LEVEL_MODEL_ID = "__server__";
/**
 * Extract the origin (scheme + host + port) from a base URL string.
 * E.g. `http://192.168.0.85:1234/v1` → `http://192.168.0.85:1234`
 */
declare function extractOrigin(baseURL: string): string;
/**
 * Probe `/api/v1/models` (LM Studio rich format).
 * Returns model_id → context_length map, or null if the endpoint is absent.
 */
declare function probeLMStudio(origin: string, apiKey?: string): Promise<Map<string, number> | null>;
interface OllamaShowResponse {
    model_info?: Record<string, unknown>;
    modelfile?: string;
    [k: string]: unknown;
}
/**
 * Extract context length from an Ollama `/api/show` response.
 * Tries `model_info.context_length`, then parses `num_ctx` from modelfile.
 */
declare function extractOllamaContextLength(show: OllamaShowResponse): number | null;
/**
 * Probe `/api/tags` (Ollama model list) then per-model `/api/show`.
 * Returns model_id → context_length map, or null if the endpoint is absent.
 */
declare function probeOllama(origin: string, apiKey?: string): Promise<Map<string, number> | null>;
interface OpenAICompatModel {
    id: string;
    /** vLLM exposes this */
    max_model_len?: number;
    max_context_length?: number;
    context_length?: number;
    limits?: {
        max_context_length?: number;
        context_length?: number;
    };
    [k: string]: unknown;
}
declare function extractOpenAIContextLength(model: OpenAICompatModel): number | null;
/**
 * Probe `/v1/models` (OpenAI-compatible endpoint).
 * Returns model_id → context_length map (may be empty if no context fields present),
 * or null if the endpoint is absent.
 */
declare function probeOpenAICompat(baseURL: string, apiKey?: string): Promise<Map<string, number> | null>;
/**
 * Probe `/props` (llama.cpp server-level context).
 * Returns a single-entry map keyed by SERVER_LEVEL_MODEL_ID, or null.
 */
declare function probeLlamaCpp(origin: string, apiKey?: string): Promise<Map<string, number> | null>;
/**
 * Probe `/info` (TGI single-model server info).
 * Prefers max_total_tokens, falls back to max_input_tokens.
 * Returns a single-entry map keyed by SERVER_LEVEL_MODEL_ID, or null.
 */
declare function probeTGI(origin: string, apiKey?: string): Promise<Map<string, number> | null>;
/**
 * Discover context window sizes for all models at the given provider base URL.
 *
 * Probes endpoints in verbose-first order:
 *   1. LM Studio `/api/v1/models`
 *   2. Ollama `/api/tags` + `/api/show`
 *   3. OpenAI-compat `/v1/models`
 *   4. llama.cpp `/props`
 *   5. TGI `/info`
 *
 * The first probe that yields a non-null result populates the map. Subsequent
 * probes only ADD entries for model IDs not yet present — they never overwrite
 * data from a more-informative probe.
 *
 * @param baseURL - Provider base URL (e.g. `http://localhost:11434/v1`).
 *   The `/v1` suffix is used for the OpenAI-compat probe; the origin is
 *   derived automatically for all other probes.
 * @param apiKey  - Optional Bearer token sent with every probe request.
 * @returns Map of model ID → context window in tokens. Empty map if all
 *          probes fail or none return context length data.
 */
export declare function discoverContextWindows(baseURL: string, apiKey?: string): Promise<Map<string, number>>;
export { probeLMStudio as _probeLMStudio, probeOllama as _probeOllama, probeOpenAICompat as _probeOpenAICompat, probeLlamaCpp as _probeLlamaCpp, probeTGI as _probeTGI, extractOrigin as _extractOrigin, extractOllamaContextLength as _extractOllamaContextLength, extractOpenAIContextLength as _extractOpenAIContextLength, };
//# sourceMappingURL=context-discovery.d.ts.map