import { CLAUDE_REMOTE_PROVIDER_SETTINGS_DEFINITION } from './definitions/claudeRemote.js';
import { CODEX_PROVIDER_SETTINGS_DEFINITION } from './definitions/codex.js';
import { OPENCODE_PROVIDER_SETTINGS_DEFINITION } from './definitions/opencode.js';
const ALL_DEFINITIONS = Object.freeze([
    CODEX_PROVIDER_SETTINGS_DEFINITION,
    OPENCODE_PROVIDER_SETTINGS_DEFINITION,
    CLAUDE_REMOTE_PROVIDER_SETTINGS_DEFINITION,
]);
export function getAllProviderSettingsDefinitions() {
    return ALL_DEFINITIONS;
}
export function getProviderSettingsDefinition(providerId) {
    return (ALL_DEFINITIONS.find((d) => d.providerId === providerId) ?? null);
}
export function assertProviderSettingsRegistryValid(definitions = ALL_DEFINITIONS) {
    assertProviderSettingsRegistryValidFor(definitions);
}
export function assertProviderSettingsRegistryValidFor(definitions) {
    const seenProviders = new Set();
    const seenKeys = new Set();
    for (const def of definitions) {
        if (seenProviders.has(def.providerId)) {
            throw new Error(`Duplicate provider settings definition: ${def.providerId}`);
        }
        seenProviders.add(def.providerId);
        for (const key of Object.keys(def.fields)) {
            if (seenKeys.has(key)) {
                throw new Error(`Provider settings key "${key}" is defined more than once across providers`);
            }
            seenKeys.add(key);
        }
    }
}
//# sourceMappingURL=registry.js.map