| 116 | } |
| 117 | |
| 118 | export class ExtensionHost extends EventEmitter implements ExtensionHostInterface { |
| 119 | // Extension lifecycle. |
| 120 | private vscode: ReturnType<typeof createVSCodeAPI> | null = null |
| 121 | private extensionModule: ExtensionModule | null = null |
| 122 | private extensionAPI: unknown = null |
| 123 | private options: ExtensionHostOptions |
| 124 | private isReady = false |
| 125 | private messageListener: ((message: ExtensionMessage) => void) | null = null |
| 126 | private initialSettings: RooCodeSettings |
| 127 | |
| 128 | // Console suppression. |
| 129 | private originalConsole: { |
| 130 | log: typeof console.log |
| 131 | warn: typeof console.warn |
| 132 | error: typeof console.error |
| 133 | debug: typeof console.debug |
| 134 | info: typeof console.info |
| 135 | } | null = null |
| 136 | |
| 137 | private originalProcessEmitWarning: typeof process.emitWarning | null = null |
| 138 | |
| 139 | // Ephemeral storage. |
| 140 | private ephemeralStorageDir: string | null = null |
| 141 | private previousCliRuntimeEnv: string | undefined |
| 142 | |
| 143 | // ========================================================================== |
| 144 | // Managers - These do all the heavy lifting |
| 145 | // ========================================================================== |
| 146 | |
| 147 | /** |
| 148 | * ExtensionClient: Single source of truth for agent loop state. |
| 149 | * Handles message processing and state detection. |
| 150 | */ |
| 151 | public readonly client: ExtensionClient |
| 152 | |
| 153 | /** |
| 154 | * OutputManager: Handles all CLI output and streaming. |
| 155 | * Uses Observable pattern internally for stream tracking. |
| 156 | */ |
| 157 | private outputManager: OutputManager |
| 158 | |
| 159 | /** |
| 160 | * PromptManager: Handles all user input collection. |
| 161 | * Provides readline, yes/no, and timed prompts. |
| 162 | */ |
| 163 | private promptManager: PromptManager |
| 164 | |
| 165 | /** |
| 166 | * AskDispatcher: Routes asks to appropriate handlers. |
| 167 | * Uses type guards (isIdleAsk, isInteractiveAsk, etc.) from client module. |
| 168 | */ |
| 169 | private askDispatcher: AskDispatcher |
| 170 | |
| 171 | // ========================================================================== |
| 172 | // Constructor |
| 173 | // ========================================================================== |
| 174 | |
| 175 | constructor(options: ExtensionHostOptions) { |
nothing calls this directly
no outgoing calls
no test coverage detected