/** GitHub Copilot CAPI model catalog parsing, active state, and disk cache. */
/** Resolved input-token context window(s) and optional synthesis metadata for a single Copilot model. */
export interface CopilotModelContext {
    contextWindow: number;
    contextWindowOptions?: readonly number[];
    maxInputTokens?: number;
    maxTokens?: number;
    displayName?: string;
    vendor?: string;
    supportedEndpoints?: readonly string[];
    supports?: CopilotModelSupports;
    limits?: CopilotModelLimits;
    modelPickerEnabled?: boolean;
    policyState?: string;
    type?: string;
}
export interface CopilotModelSupports {
    adaptiveThinking?: boolean;
    maxThinkingBudget?: boolean;
    minThinkingBudget?: boolean;
    parallelToolCalls?: boolean;
    reasoningEffort?: boolean;
    reasoningEffortLevels?: readonly string[];
    streaming?: boolean;
    structuredOutputs?: boolean;
    toolCalls?: boolean;
    vision?: boolean;
}
/** Map of model id → resolved context window(s) plus optional synthesis metadata. */
export type CopilotModelCatalog = ReadonlyMap<string, CopilotModelContext>;
/** Safety fallback when a model reports neither `max_prompt_tokens` nor `max_context_window_tokens`. */
export declare const COPILOT_CONTEXT_WINDOW_FALLBACK = 128000;
export declare const COPILOT_CATALOG_API_VERSION = "2026-06-01";
/**
 * Headers GitHub's CAPI expects for catalog reads. Mirrors the editor headers pi-ai already sends
 * for Copilot token refresh and model-policy calls, plus the dated API version.
 */
export declare const COPILOT_CATALOG_HEADERS: Readonly<Record<string, string>>;
/** Default Copilot CAPI base URL for OAuth tokens when no route can be resolved. */
export declare const DEFAULT_COPILOT_API_BASE_URL = "https://api.individual.githubcopilot.com";
/** GitHub Copilot public routing hub for PAT-based `COPILOT_GITHUB_TOKEN` auth. */
export declare const COPILOT_PUBLIC_API_BASE_URL = "https://api.githubcopilot.com";
/** Enterprise Copilot CAPI host for GHES/non-github.com server URLs. */
export declare const COPILOT_ENTERPRISE_API_BASE_URL = "https://api.enterprise.githubcopilot.com";
export declare const COPILOT_GITHUB_TOKEN_ENV = "COPILOT_GITHUB_TOKEN";
export declare const COPILOT_API_TARGET_ENV = "COPILOT_API_TARGET";
export declare const GITHUB_COPILOT_BASE_URL_ENV = "GITHUB_COPILOT_BASE_URL";
export declare const GITHUB_SERVER_URL_ENV = "GITHUB_SERVER_URL";
type CopilotEnvironment = Record<string, string | undefined>;
export declare function copilotTokenFromEnvironment(env?: CopilotEnvironment): string | undefined;
/** Disk-cache freshness window, matching the Copilot CLI's list-models cache TTL. */
export declare const COPILOT_CATALOG_CACHE_TTL_MS: number;
/** Current on-disk cache schema version. */
export declare const COPILOT_CATALOG_CACHE_VERSION: 5;
export declare function copilotApiBaseUrlFromToken(token: string | undefined, enterpriseDomain?: string, env?: CopilotEnvironment): string;
export interface CopilotModelLimits {
    maxPromptTokens?: number;
    maxContextWindowTokens?: number;
    maxOutputTokens?: number;
    defaultContextMax?: number;
    longContextMax?: number;
}
export declare function resolveCopilotModelContext(limits: CopilotModelLimits): CopilotModelContext | undefined;
/**
 * Parse a raw CAPI `/models` response body into an input-token context-window catalog.
 */
export declare function parseCopilotModelCatalog(body: unknown): CopilotModelCatalog;
export interface FetchCopilotModelCatalogOptions {
    /** Valid Copilot CAPI bearer token (e.g. from `modelRegistry.getApiKeyForProvider`). */
    token: string;
    /** Override the resolved base URL; defaults to one derived from the token. */
    baseUrl?: string;
    /** Enterprise domain, used for base-URL resolution when the token lacks a `proxy-ep`. */
    enterpriseDomain?: string;
    /** Extra/override request headers. */
    headers?: Record<string, string>;
    /** Injectable `fetch` for testing. */
    fetchImpl?: typeof fetch;
    /** Abort signal. */
    signal?: AbortSignal;
}
/** Fetch and parse the live Copilot model catalog from CAPI `GET {baseUrl}/models`. */
export declare function fetchCopilotModelCatalog(options: FetchCopilotModelCatalogOptions): Promise<CopilotModelCatalog>;
/** Replace the active catalog the registry derives context windows from. */
export declare function setActiveCopilotModelCatalog(catalog: CopilotModelCatalog): void;
/** The active catalog (empty until a successful auth-gated fetch/cache load). */
export declare function getActiveCopilotModelCatalog(): CopilotModelCatalog;
/** Reset the active catalog (primarily for tests). */
export declare function clearActiveCopilotModelCatalog(): void;
export interface ReadCopilotCatalogCacheOptions {
    /** Expected CAPI host; a cached file from a different host is ignored. */
    host: string;
    /** Current epoch ms (injectable for tests). */
    now?: number;
    /** Freshness window; defaults to {@link COPILOT_CATALOG_CACHE_TTL_MS}. */
    ttlMs?: number;
}
export declare function readCopilotCatalogCache(path: string, options: ReadCopilotCatalogCacheOptions): CopilotModelCatalog | undefined;
export declare function writeCopilotCatalogCache(path: string, baseUrl: string, catalog: CopilotModelCatalog, now?: number): void;
export declare function copilotCatalogCacheHost(baseUrl: string): string;
export declare function copilotCatalogCachePath(agentDir: string): string;
/**
 * Seed the active catalog synchronously from the on-disk cache, gated on a Copilot access token.
 *
 * Called at model-registry construction so a returning user's previously selected long-context
 * window is recognized before startup validation runs — otherwise the persisted choice would warn
 * ("context window 936k is not supported…") and reset until the async refresh completes. The cache
 * TTL is intentionally ignored here: stale-but-present windows are still valid for selection, and
 * the async loader independently refetches on its own freshness window. Returns true when a catalog
 * was applied. No-op (returns false) without a token or a host-matching cached catalog.
 */
export declare function seedActiveCopilotModelCatalogFromCache(accessToken: string | undefined, cachePath: string, now?: number): boolean;
export {};
//# sourceMappingURL=copilot-model-catalog.d.ts.map