/**
 * Source Registry — Pluggable Discovery Provider Framework
 *
 * Orchestrates multiple skill discovery providers (GitHub, skills.sh, npm)
 * and yields deduplicated results.
 */
export class SourceRegistry {
    constructor() {
        this._providers = [];
    }
    get providers() {
        return [...this._providers];
    }
    register(provider) {
        this._providers.push(provider);
    }
    async *discoverAll(options) {
        const seen = new Set();
        const enabled = options?.enabledSources;
        for (const provider of this._providers) {
            if (enabled && !enabled.includes(provider.name)) {
                continue;
            }
            try {
                for await (const repo of provider.discover()) {
                    if (!seen.has(repo.fullName)) {
                        seen.add(repo.fullName);
                        yield repo;
                    }
                }
            }
            catch {
                // Provider failed — skip and continue with others
            }
        }
    }
}
//# sourceMappingURL=source-registry.js.map