/**
 * Model truth aggregator — merges config + runtime + discovery + catalog.
 * This is the Phase A read-side source of truth.
 */
import type { OwlCodaConfig, ConfiguredModel } from './config.js';
import { type PlatformVisibilityInfo, type RuntimeProbeResult } from './runtime-probe.js';
import type { DiscoveredModel, DiscoveryResult, BackendConfig } from './backends/types.js';
import { type PlatformCatalog } from './models/catalog.js';
import { type ModelContextCapability } from './model-capabilities.js';
export type AvailabilityKind = 'ok' | 'missing_key' | 'endpoint_down' | 'router_missing' | 'orphan_discovered' | 'alias_conflict' | 'warming' | 'unknown';
export type ModelAvailability = {
    kind: 'ok';
} | {
    kind: 'missing_key';
    envName?: string;
} | {
    kind: 'endpoint_down';
    url: string;
    reason: string;
} | {
    kind: 'router_missing';
    reason?: string;
    visibilityRule?: string;
    gateStatus?: string;
    blockReason?: string;
    truthSurface?: string;
    diagnosticSurface?: string;
    loadedInventorySurface?: string;
    deprecatedFallback?: boolean;
} | {
    kind: 'orphan_discovered';
} | {
    kind: 'alias_conflict';
    with: string;
} | {
    kind: 'warming';
} | {
    kind: 'unknown';
    reason: string;
};
export interface ModelStatus {
    id: string;
    label: string;
    providerKind: 'local' | 'cloud' | 'unknown';
    isDefault: boolean;
    role?: string;
    contextCapability?: ModelContextCapability;
    presentIn: {
        config: boolean;
        router: boolean;
        discovered: boolean;
        catalog: boolean;
    };
    availability: ModelAvailability;
    raw: {
        config?: ConfiguredModel;
        discovered?: DiscoveredModel;
        catalogEntry?: PlatformCatalog['models'][number];
        routerEntry?: string[];
    };
}
export interface ModelTruthState {
    refreshedAt: number;
    ttlMs: number;
    cacheHit: boolean;
}
export interface ModelTruthSnapshot extends ModelTruthState {
    configSourceLabel?: string;
    statuses: ModelStatus[];
    byModelId: Record<string, ModelStatus>;
    runtimeOk: boolean;
    runtimeSource: RuntimeProbeResult['source'] | null;
    runtimeLocalProtocol: RuntimeProbeResult['localRuntimeProtocol'] | null;
    runtimeProbeDetail: string;
    runtimeModelCount: number;
    platformVisibility?: PlatformVisibilityInfo | null;
}
export interface ModelTruthDeps {
    getConfig: () => OwlCodaConfig;
    probeRuntimeSurface: (routerUrl: string, timeoutMs: number) => Promise<RuntimeProbeResult>;
    discoverBackends: (configs?: BackendConfig[], timeoutMs?: number) => Promise<DiscoveryResult>;
    loadCatalog: () => PlatformCatalog | null;
    now: () => number;
}
export interface ModelTruthOptions {
    ttlMs?: number;
    routerProbeTimeoutMs?: number;
    discoveryTimeoutMs?: number;
    deps?: Partial<ModelTruthDeps>;
}
export declare class ModelTruthAggregator {
    private readonly deps;
    private readonly ttlMs;
    private readonly routerProbeTimeoutMs;
    private readonly discoveryTimeoutMs;
    private cache;
    constructor(configProvider: () => OwlCodaConfig, options?: ModelTruthOptions);
    invalidate(): void;
    getStatusByModelId(modelId: string): ModelStatus | undefined;
    getSnapshot(options?: {
        skipCache?: boolean;
    }): Promise<ModelTruthSnapshot>;
    private buildSnapshot;
}
