/** * ModelPickerDataProvider, enriched model picker data surface. * * Combines ModelDefinition records from the provider registry with * ProviderHealthDomainState and ModelDomainState to produce a single, * sorted, health-enriched ModelPickerData snapshot for UI consumption. * * This class is a data provider only, it contains no rendering logic. * Subscribe to change notifications and call getSnapshot() to render. */ import type { ModelDefinition } from '../../../providers/registry.js'; import type { ProviderRegistry } from '../../../providers/registry.js'; import type { BenchmarkStore } from '../../../providers/model-benchmarks.js'; import type { ProviderHealthDomainState } from '../../store/domains/provider-health.js'; import type { ModelDomainState } from '../../store/domains/model.js'; import type { ModelPickerData } from './types.js'; /** Options for constructing a ModelPickerDataProvider. */ export interface ModelPickerDataProviderOptions { /** * Initial set of pinned model registry keys. * Call updatePinnedIds() to update at runtime. */ readonly pinnedIds?: ReadonlySet | undefined; readonly benchmarkStore: Pick; readonly providerRegistry: Pick; } /** * ModelPickerDataProvider produces enriched model picker data snapshots. * * Usage: * ```ts * const provider = new ModelPickerDataProvider(models, healthState, modelState); * const unsub = provider.subscribe(() => { * const data = provider.getSnapshot(); * // render data.entries or data.groups * }); * // When health or model state changes: * provider.updateHealthState(newHealthState); * provider.updateModelState(newModelState); * // Cleanup: * unsub(); * provider.dispose(); * ``` */ export declare class ModelPickerDataProvider { private _models; private _healthState; private _modelState; private _pinnedIds; private _snapshot; private readonly benchmarkStore; private readonly providerRegistry; private readonly _subscribers; constructor(models: readonly ModelDefinition[], healthState: ProviderHealthDomainState, modelState: ModelDomainState, options: ModelPickerDataProviderOptions); /** * Return the current enriched model picker data snapshot. * This is updated synchronously when state changes via update methods. */ getSnapshot(): ModelPickerData; /** * Register a callback invoked whenever the snapshot changes. * @returns An unsubscribe function. */ subscribe(callback: () => void): () => void; /** * Update the model list (e.g. after registry reload). * Triggers a snapshot rebuild and notifies subscribers. */ updateModels(models: readonly ModelDefinition[]): void; /** * Update health state (e.g. on ProviderHealthDomainState change). * Triggers a snapshot rebuild and notifies subscribers. */ updateHealthState(healthState: ProviderHealthDomainState): void; /** * Update model domain state (e.g. on active model or fallback change). * Triggers a snapshot rebuild and notifies subscribers. */ updateModelState(modelState: ModelDomainState): void; /** * Update the pinned/favorites model registry-key set. * Triggers a snapshot rebuild and notifies subscribers. */ updatePinnedIds(pinnedIds: ReadonlySet): void; /** * Release all subscriber references. * Does not clear internal state, getSnapshot() remains usable after disposal. */ dispose(): void; private _rebuild; private _buildSnapshot; private _notify; } //# sourceMappingURL=data-provider.d.ts.map