/** * kosha-discovery — Discovery, enrichment, and cache helpers. * * I keep provider discovery and runtime plumbing here so the registry façade * can stay small without losing the existing behavior. * @module */ import type { DiscoverySnapshotV1 } from "./discovery-contract.js"; import type { DiscoveryDependencies, RegistryState } from "./registry-state.js"; import type { CredentialResult, DiscoveryOptions, ProviderDiscoverer, ProviderInfo } from "./types.js"; /** * Canonical, third-party consumable registry manifest path. * I keep it outside the TTL cache directory so tools like jq, duckdb, or * language SDKs can read a single stable file without worrying about * cache envelopes or internal layout changes. */ export declare const REGISTRY_MANIFEST_PATH: string; /** * Run provider discovery, enrichment, caching, and delta emission. */ export declare function registryDiscover(state: RegistryState, dependencies: DiscoveryDependencies, options?: DiscoveryOptions): Promise; /** * Force a fresh discovery pass for one provider or the full registry. */ export declare function registryRefresh(state: RegistryState, discover: (options?: DiscoveryOptions) => Promise, providerId?: string): Promise; /** * Dynamically load discoverers while respecting config and local filters. */ export declare function loadRegistryDiscoverers(state: RegistryState, providerIds?: string[], includeLocal?: boolean): Promise; /** * Dynamically load the credential resolver when available. */ export declare function getRegistryCredentialResolver(): Promise<{ resolve: (providerId: string, explicitKey?: string) => Promise; } | null>; /** * Resolve a credential from config or environment without the credential module. */ export declare function fallbackRegistryCredential(providerId: string, explicitKey?: string): CredentialResult; /** * Enrich the in-memory model set with pricing metadata when available. */ export declare function enrichRegistryModels(state: RegistryState): Promise; /** * Enrichment-only result for the `kosha enrich` CLI command. */ export interface EnrichOnlyResult { /** Total models across all providers. */ modelCount: number; /** Models that gained new cache read/write pricing. */ cachePricingUpdated: number; /** Models that gained new batch pricing. */ batchPricingUpdated: number; } /** * Load cached provider data, re-run LiteLLM enrichment, and persist results. * * This is the lightweight alternative to full re-discovery — no provider API * calls, just a fetch from the litellm community catalogue. Returns `null` * when no cached data is available. */ export declare function registryEnrichOnly(state: RegistryState): Promise; /** * Populate reverse aliases onto discovered models for legacy consumers. */ export declare function populateRegistryModelAliases(state: RegistryState): void; /** * Load provider data from disk cache when it is still fresh. */ export declare function loadRegistryFromCache(state: RegistryState, providerIds?: string[]): Promise; /** * Persist the current provider map to the shared file cache. */ export declare function saveRegistryToCache(state: RegistryState): Promise; /** * Export a stable, human-and-machine-readable manifest of the current * registry state to `~/.kosha/registry.json`. Third-party consumers * (CLIs in other languages, jq pipelines, CI jobs, dashboards) can read * this file directly — it holds the stable v1 discovery snapshot schema, * not the internal cache envelope. * * I make this a best-effort write: if the filesystem refuses, discovery * still completed successfully, so I swallow errors rather than failing * the whole command. */ export declare function exportRegistryManifest(state: RegistryState): Promise; export declare function mergeManifests(previous: DiscoverySnapshotV1 | null, fresh: DiscoverySnapshotV1): DiscoverySnapshotV1; /** * A single pricing-diff event captured at merge time. Persisted to * `/anomalies.json` so consumers can surface "rate moved * unexpectedly" as a UI signal without polling for every merge. */ export interface PricingAnomaly { ts: number; /** Stable model key, e.g. `anthropic:claude-opus-4-7`. */ key: string; /** Which rate moved: `input`, `output`, `cacheRead`, `cacheWrite`, `cacheWrite1h`. */ field: "input" | "output" | "cacheRead" | "cacheWrite" | "cacheWrite1h"; /** Whether the change was on `originPricing` (direct) or `pricing` (proxy). */ side: "origin" | "proxy"; previous: number; current: number; /** Signed fractional delta, e.g. -0.5 = 50% drop, +1.0 = doubled. */ deltaPct: number; /** True when either snapshot carried a promo_override tag for this model. */ promo: boolean; } //# sourceMappingURL=registry-runtime.d.ts.map