/** * Spawn Adapter Registry * * Registry to manage multiple spawn adapters for different providers. * Provides adapter lookup by ID, by provider, and filtering by capability. * * Delegates to adapter packages in packages/adapters/ via bridge adapters * that map between CLEOSpawnAdapter and AdapterSpawnProvider interfaces. * * @task T5236 * @phase 1C */ import { type Provider } from '@cleocode/caamp'; import type { CLEOSpawnAdapter } from '@cleocode/contracts'; /** * Spawn capability type - subset of provider capabilities related to spawning */ export type SpawnCapability = 'supportsSubagents' | 'supportsProgrammaticSpawn' | 'supportsInterAgentComms' | 'supportsParallelSpawn'; /** * Registry to manage spawn adapters. * * Maintains mappings between adapter IDs, provider IDs, and adapter instances. * Supports registration, lookup, and capability-based filtering. */ export declare class SpawnAdapterRegistry { /** Map of adapter ID to adapter instance */ private adapters; /** Map of provider ID to adapter ID */ private providerAdapters; /** * Register an adapter with the registry. * * @param adapter - The adapter instance to register */ register(adapter: CLEOSpawnAdapter): void; /** * Get an adapter by its unique ID. * * @param adapterId - The adapter identifier * @returns The adapter instance, or undefined if not found */ get(adapterId: string): CLEOSpawnAdapter | undefined; /** * Get the adapter registered for a specific provider. * * @param providerId - The provider identifier * @returns The adapter instance, or undefined if no adapter is registered for this provider */ getForProvider(providerId: string): CLEOSpawnAdapter | undefined; /** * Check if an adapter is registered for a given provider. * * @param providerId - The provider identifier * @returns True if an adapter exists for the provider */ hasAdapterForProvider(providerId: string): boolean; /** * List all registered adapters. * * @returns Array of all registered adapter instances */ list(): CLEOSpawnAdapter[]; /** * List adapters for providers that have spawn capability. * * Queries CAAMP for spawn-capable providers and returns the * corresponding registered adapters. * * @returns Promise resolving to array of spawn-capable adapters */ listSpawnCapable(): Promise; /** * Check if a provider can spawn subagents. * * Uses providerSupportsById to check if the provider supports * the spawn.supportsSubagents capability. * * @param providerId - The provider identifier * @returns True if the provider supports spawning */ canProviderSpawn(providerId: string): Promise; /** * Clear all adapter registrations. * * Removes all adapters and provider mappings from the registry. */ clear(): void; } /** * Get providers by specific spawn capability * * Queries CAAMP for providers that support a specific spawn capability. * * @param capability - The spawn capability to filter by * @returns Array of providers with the specified capability */ export declare function getProvidersWithSpawnCapability(capability: SpawnCapability): Provider[]; /** * Check if any provider supports parallel spawn * * @returns True if at least one provider supports parallel spawn */ export declare function hasParallelSpawnProvider(): boolean; /** * Singleton registry instance. * * Use this instance for all spawn adapter registration and lookup operations. */ export declare const spawnRegistry: SpawnAdapterRegistry; /** * Initialize spawn adapters dynamically from discovered adapter manifests. * * Scans all discovered manifests for adapters with `capabilities.supportsSpawn`, * dynamically imports their spawn provider, and bridges it into the spawn registry. * * Zero hardcoded adapter names — everything derives from manifests. * * @param manifests - Discovered adapter manifests (from AdapterManager.discover()) * @returns Promise that resolves when initialization is complete */ export declare function initializeSpawnAdapters(manifests: import('@cleocode/contracts').AdapterManifest[]): Promise; /** * Initialize the registry with default adapters. * * Legacy entry point that discovers adapters from the project root * and delegates to initializeSpawnAdapters(). Maintains backward * compatibility for callers that don't have manifests handy. * * @returns Promise that resolves when initialization is complete */ export declare function initializeDefaultAdapters(): Promise; //# sourceMappingURL=adapter-registry.d.ts.map