/** * LLM Executor Registry * * Central registry for LLM executors following the Service Locator pattern. * Provides: * - Runtime provider switching * - Global mock injection for testing * - Factory methods for common use cases * * SOLID Principles: * - Single Responsibility: Manages LLM executor lifecycle only * - Open/Closed: New providers can be added without modifying existing code * - Dependency Inversion: Clients depend on ILLMExecutor, not concrete implementations */ import { ILLMExecutor, ILLMExecutorFactory, LLMProviderInfo } from './interfaces'; import { MockLLMExecutor } from './mock-llm-executor'; /** * Global LLM Executor Registry * Singleton pattern for application-wide LLM executor management */ export declare class LLMExecutorRegistry implements ILLMExecutorFactory { private static instance; private executors; private defaultProviderId; private overrideExecutor; private constructor(); /** * Get the singleton instance */ static getInstance(): LLMExecutorRegistry; /** * Reset the singleton (useful for testing) */ static reset(): void; /** * Create/get an LLM executor for the specified provider */ create(providerId: string, _config?: Record): ILLMExecutor; /** * Get available provider IDs */ getAvailableProviders(): string[]; /** * Check if a provider is available */ isProviderAvailable(providerId: string): Promise; /** * Register a new LLM executor */ registerExecutor(providerId: string, executor: ILLMExecutor): void; /** * Unregister an LLM executor */ unregisterExecutor(providerId: string): boolean; /** * Set the default provider */ setDefaultProvider(providerId: string): void; /** * Get the default provider ID */ getDefaultProviderId(): string; /** * Get the current LLM executor * Returns override executor if set, otherwise the default */ getExecutor(providerId?: string): ILLMExecutor; /** * Get provider information for all registered executors */ getAllProviderInfo(): LLMProviderInfo[]; /** * Override the executor globally (for testing) * All calls to getExecutor() will return this executor */ setOverride(executor: ILLMExecutor | null): void; /** * Clear the global override */ clearOverride(): void; /** * Check if an override is currently set */ hasOverride(): boolean; /** * Enable mock mode for testing * This sets a mock executor as the global override */ enableMockMode(mockExecutor?: MockLLMExecutor): MockLLMExecutor; /** * Disable mock mode */ disableMockMode(): void; /** * Run a function with mock mode enabled, then restore */ withMock(fn: (mock: MockLLMExecutor) => Promise, mockExecutor?: MockLLMExecutor): Promise; } /** * Get the global LLM executor (convenience function) */ export declare function getLLMExecutor(providerId?: string): ILLMExecutor; /** * Enable mock mode globally (convenience function for tests) */ export declare function enableMockLLM(mockExecutor?: MockLLMExecutor): MockLLMExecutor; /** * Disable mock mode globally (convenience function for tests) */ export declare function disableMockLLM(): void; /** * Run code with mock LLM (convenience function for tests) */ export declare function withMockLLM(fn: (mock: MockLLMExecutor) => Promise, mockExecutor?: MockLLMExecutor): Promise; export { ILLMExecutor, LLMExecutionOptions, LLMExecutionResult, LLMProviderInfo } from './interfaces'; export { ClaudeLLMExecutor } from './claude-llm-executor'; export { MockLLMExecutor, MockLLMExecutorFactory } from './mock-llm-executor'; //# sourceMappingURL=llm-executor-registry.d.ts.map