export class ModelRegistry {
    models = new Map();
    register(model) {
        if (this.models.has(model.id)) {
            throw new Error(`Model already registered: ${model.id}`);
        }
        this.models.set(model.id, model);
    }
    get(id) {
        if (id === undefined) {
            return undefined;
        }
        return this.models.get(id);
    }
    list() {
        return Array.from(this.models.values());
    }
}
export function registerConfiguredModels(registry, configs, providerFactory) {
    for (const config of configs) {
        registry.register({
            id: config.id,
            displayName: config.displayName,
            baseUrl: config.baseUrl,
            apiKey: config.apiKey,
            contextTokenLimit: config.contextTokenLimit,
            provider: providerFactory(config),
        });
    }
}
