/** * AdapterManager: central registry for provider adapters. * Handles adapter lifecycle (discovery, initialization, health, disposal) * and tracks the active adapter for the current session. * * @task T5240 */ import type { AdapterHealthStatus, AdapterManifest, CLEOProviderAdapter } from '@cleocode/contracts'; /** Summary info for an adapter without exposing the full instance. */ export interface AdapterInfo { id: string; name: string; version: string; provider: string; healthy: boolean; active: boolean; } /** * Central adapter manager. Singleton per process. * * Lifecycle: * 1. discover() — scan for adapter packages and their manifests * 2. activate(id) — load, initialize, and set as active adapter * 3. getActive() — return the current active adapter * 4. dispose() — clean up all initialized adapters */ export declare class AdapterManager { private static instance; private adapters; private manifests; private hookCleanups; private activeId; private projectRoot; private constructor(); static getInstance(projectRoot: string): AdapterManager; /** Reset singleton (for testing). */ static resetInstance(): void; /** * Discover adapter manifests from packages/adapters/. * Returns manifests found (does not load adapter code yet). */ discover(): AdapterManifest[]; /** * Auto-detect which adapters match the current environment * and return their manifest IDs. */ detectActive(): string[]; /** * Load and initialize an adapter by manifest ID. * Dynamically imports from the manifest's packagePath — no hardcoded adapters. */ activate(adapterId: string): Promise; /** Get the currently active adapter, or null if none. */ getActive(): CLEOProviderAdapter | null; /** Get the active adapter's ID, or null. */ getActiveId(): string | null; /** Get a specific adapter by ID. */ get(adapterId: string): CLEOProviderAdapter | null; /** Get the manifest for a specific adapter. */ getManifest(adapterId: string): AdapterManifest | null; /** List all known adapters with summary info. */ listAdapters(): AdapterInfo[]; /** Run health check on all initialized adapters. */ healthCheckAll(): Promise>; /** Health check a single adapter. */ healthCheck(adapterId: string): Promise; /** Dispose all initialized adapters. */ dispose(): Promise; /** Dispose a single adapter. */ disposeAdapter(adapterId: string): Promise; /** * Wire an adapter's hook event map into CLEO's HookRegistry. * Creates bridging handlers at priority 50 for each mapped event. */ private wireAdapterHooks; /** * Clean up hook registrations for an adapter. */ private cleanupAdapterHooks; } //# sourceMappingURL=manager.d.ts.map