/** * Service Container - Dependency Injection for Orchestrator Services * * Manages service lifecycle, dependencies, and provides a clean way * for services to access each other without tight coupling. */ import type { MCPDefinition } from '../types/connection.js'; import type { ToolInfo } from '../types/discovery.js'; import { TypedEventEmitter, type OrchestratorContext, type OrchestratorState, type MutableOrchestratorState, type ServiceName } from './orchestrator-context.js'; /** * Base interface for all services */ export interface OrchestratorService { /** * Initialize the service (async setup) */ initialize?(): Promise; /** * Cleanup the service (shutdown) */ cleanup?(): Promise; } /** * Service factory function type */ export type ServiceFactory = (context: OrchestratorContext) => T; /** * Service Container implementation * * Manages all orchestrator services with lazy initialization * and proper dependency injection. */ export declare class ServiceContainer implements OrchestratorContext { private services; private factories; private initialized; readonly events: TypedEventEmitter; readonly profileName: string; readonly clientInfo: { name: string; version: string; }; private _state; constructor(profileName?: string); /** * Read-only view of state for services */ get state(): OrchestratorState; /** * Get mutable state (only for StateManager) * @internal */ getMutableState(): MutableOrchestratorState; /** * Register a service factory */ register(name: ServiceName, factory: ServiceFactory): void; /** * Register a service instance directly (for pre-created services) */ registerInstance(name: ServiceName, instance: T): void; /** * Get a service by name * Creates the service lazily if a factory is registered */ getService(name: ServiceName): T; /** * Check if a service is registered */ hasService(name: ServiceName): boolean; /** * Initialize all registered services */ initializeAll(): Promise; /** * Initialize a specific service */ private initializeService; /** * Cleanup all services in reverse order */ cleanup(): Promise; /** * Update state - convenience methods for StateManager * These should only be called by StateManager * @internal */ setDefinition(name: string, definition: MCPDefinition): void; removeDefinition(name: string): void; addToolMapping(toolName: string, mcpName: string): void; removeToolMapping(toolName: string): void; addTool(tool: ToolInfo): void; removeTool(toolName: string, mcpName: string): void; setAllTools(tools: ToolInfo[]): void; setSkillPrompt(name: string, prompt: unknown): void; removeSkillPrompt(name: string): void; } //# sourceMappingURL=service-container.d.ts.map