// engine/errors/registry-loader.ts — SPEC-902: Singleton error recovery registry
import { join } from 'node:path';
import { RecoveryRegistry } from './recovery-registry.js';
const PACKAGE_REGISTRY_PATH = join(process.cwd(), 'src', 'config', 'registries', 'error-recovery.json');
let cachedRegistry;
export function getErrorRecoveryRegistry() {
    if (cachedRegistry === undefined) {
        cachedRegistry = new RecoveryRegistry({ rulesPath: PACKAGE_REGISTRY_PATH });
        // Load synchronously for startup — fire-and-forget
        cachedRegistry.load().catch((err) => {
            console.warn('[Planu] Failed to load error recovery registry:', err);
        });
    }
    return cachedRegistry;
}
export function invalidateErrorRegistryCache() {
    cachedRegistry = undefined;
}
//# sourceMappingURL=registry-loader.js.map