import type { AccountModelCatalog } from './account-model-catalog.ts'; /** Transient native OAuth result. Only accountKey is permitted in a published snapshot. */ export interface AccountModelAuth { readonly apiKey: string; /** Already trust-validated by the native credential owner; this source additionally requires an HTTPS root. */ readonly baseURL: string; readonly accountKey: string; readonly availableModelIds?: readonly string[] | ReadonlySet; } export interface AccountModelSourceDependencies { resolveAuth(signal: AbortSignal): Promise; /** Must reject if the account/token is no longer current. This callback must not perform OAuth refresh. */ assertAuthCurrent(auth: AccountModelAuth, signal: AbortSignal): void | Promise; fetch?: typeof globalThis.fetch; /** Public static request headers only; credential/routing/framing headers are refused. */ headers?: Readonly>; nativeApis?: ReadonlyMap; now?: () => number; ttlMs?: number | (() => number); /** Failure backoff for non-force discovery only; never a background retry timer. */ failureCooldownMs?: number | (() => number); timeoutMs?: number; } export interface AccountModelSnapshot extends AccountModelCatalog { readonly accountKey: string; readonly fetchedAt: number; readonly generation: number; } export interface AccountModelSourceView { readonly state: 'idle' | 'loading' | 'ready' | 'stale' | 'error' | 'disposed'; readonly generation: number; readonly modelCount: number; readonly rejectedCount: number; readonly fetchedAt?: number; readonly error?: AccountModelSourceErrorCode; } export interface AccountModelLoadOptions { readonly force?: boolean; readonly signal?: AbortSignal; } declare const codes: readonly ["COPILOT_MODEL_SOURCE_INVALID_CONFIG", "COPILOT_MODEL_SOURCE_INVALID_AUTH", "COPILOT_MODEL_SOURCE_AUTH_FAILED", "COPILOT_MODEL_SOURCE_AUTH_CHANGED", "COPILOT_MODEL_SOURCE_FETCH_FAILED", "COPILOT_MODEL_SOURCE_HTTP_ERROR", "COPILOT_MODEL_SOURCE_REDIRECTED_RESPONSE", "COPILOT_MODEL_SOURCE_BODY_FAILED", "COPILOT_MODEL_SOURCE_RESPONSE_TOO_LARGE", "COPILOT_MODEL_SOURCE_INVALID_RESPONSE", "COPILOT_MODEL_SOURCE_INVALID_CATALOG", "COPILOT_MODEL_SOURCE_INVALIDATED", "COPILOT_MODEL_SOURCE_ABORTED", "COPILOT_MODEL_SOURCE_TIMEOUT", "COPILOT_MODEL_SOURCE_DISPOSED"]; export type AccountModelSourceErrorCode = typeof codes[number]; export declare class AccountModelSourceError extends Error { readonly code: AccountModelSourceErrorCode; constructor(code: AccountModelSourceErrorCode); } /** * Lazy account metadata, not model-call authorization. The owner must invalidate * on credential/account changes and validate the account again before model wire. * Cache reads do not refresh OAuth or claim authority over a separate Core catalog. */ export declare class AccountModelSource { private readonly dependencies; private readonly timeoutMs; private readonly now; private readonly fetch; private readonly headers; private readonly nativeApis; private generation; private disposed; private cache; private flight; private failure; private failedAt; private readonly operations; constructor(dependencies: AccountModelSourceDependencies); private cacheDuration; /** Display only: TTL expiry is allowed, but invalidation and clock guards still apply. * The owner must additionally validate its account/token/entitlement proof before display. */ readDisplaySnapshot(): AccountModelSnapshot | undefined; readSnapshot(): AccountModelSnapshot | undefined; getView(): AccountModelSourceView; load(options?: AccountModelLoadOptions): Promise; /** Revoke definitively rejected metadata and back off passive reuse/recovery. */ rejectSnapshot(snapshot: AccountModelSnapshot): boolean; invalidate(): void; dispose(): void; private start; private current; private validateCurrent; private perform; } export declare function createAccountModelSource(dependencies: AccountModelSourceDependencies): AccountModelSource; export {}; //# sourceMappingURL=account-model-source.d.ts.map