/** * Host-side directory mirror: pure computation over the llm registry and the * settings document. Kept free of Cordis so `node --test` can exercise it * without a host. The caller (src/host/index.ts) supplies faces, subscribes * to `llm/adapters-updated` + `settings/document-updated`, and persists via * `settings.update` with a deep-equal guard (see catalogsEqual). * * Only ids and display names cross into the mirror — provider profiles may * carry secrets (api keys), which stay host-side. Malformed rows are skipped, * never fatal: the card degrades to whatever is parseable. */ import type { DirectoryCatalog, DirectoryModel, DirectoryProvider } from './config.js'; /** Minimal structural face of the host llm service used by the mirror. */ export type LlmDirectoryFace = { listProviders?(): unknown; listConfigurableProviders?(): unknown; }; /** * Join live routes with the configurable directory, mirroring the built-in * Models page: declared directory rows first (in declaration order, `active` * derived from live membership), then live-only routes appended. * * - `registered`: live routes (`{ id, name }`). * - `directory`: configurable providers (`{ provider, displayName, … }`). * * Either side may be absent/malformed (older hosts, booting registries); the * join degrades to whatever side parses instead of blanking the dropdown. */ export declare function joinDirectoryProviders(registered: unknown, directory: unknown): DirectoryProvider[]; /** * Synthesize per-provider model rows from settings namespace values. Most * llm plugins expose `{ providers: [{ id|provider, models: [{id,name}|id] }] }` * inside their section value; string model entries are accepted as bare ids. * Providers with no parseable models are omitted (the card falls back to * free text / `*` for those). */ export declare function synthesizeDirectoryModels(namespaces: ReadonlyArray<{ value?: unknown; }>): Array<{ provider: string; models: DirectoryModel[]; }>; /** * Compute the full mirror snapshot. Every face is optional and every throw * degrades to empty: a booting registry or an undescribed document must never * fail the mirror pass — the next trigger recomputes. */ export declare function computeDirectoryCatalog(llm: LlmDirectoryFace | undefined, namespaces: ReadonlyArray<{ ns?: unknown; value?: unknown; }>): DirectoryCatalog; /** Deep-equal guard so mirror writes never loop: unchanged means no write. */ export declare function catalogsEqual(a: DirectoryCatalog | undefined, b: DirectoryCatalog | undefined): boolean; //# sourceMappingURL=directory.d.ts.map