/**
 * Integration registry — mirrors src/channels/registry.ts.
 *
 * Each agent adapter calls registerIntegration() at module-load time; the
 * hub looks them up by name. Keeps adapters decoupled and lets community
 * adapters slot in by importing one more module.
 */
const FACTORIES = new Map();
export function registerIntegration(name, factory) {
    FACTORIES.set(name, factory);
}
export async function makeIntegration(name, cfg) {
    const factory = FACTORIES.get(name);
    if (!factory) {
        throw new Error(`unknown integration "${name}". Known: ${Array.from(FACTORIES.keys()).join(", ") || "(none registered)"}`);
    }
    return await factory(cfg);
}
export function listAvailableIntegrations() {
    return Array.from(FACTORIES.keys()).sort();
}
/** Test hook — clear the registry between unit tests. */
export function _resetIntegrationsForTest() {
    FACTORIES.clear();
    builtinsRegistered = false;
}
// Lazy registration of built-in adapters. Each module calls
// registerIntegration() at import time.
let builtinsRegistered = false;
export async function registerBuiltinIntegrations() {
    if (builtinsRegistered)
        return;
    builtinsRegistered = true;
    await import("./claude-code/observer.js");
    await import("./codex/observer.js");
    // Additional adapters register here as they land (opencode, aider, …).
}
//# sourceMappingURL=registry.js.map