(options: BaseListOptions, hostOptions: ListHostOptions)
| 103 | } |
| 104 | |
| 105 | async function createListHost(options: BaseListOptions, hostOptions: ListHostOptions): Promise<ExtensionHost> { |
| 106 | const workspacePath = resolveWorkspacePath(options.workspace) |
| 107 | const extensionPath = resolveExtensionPath(options.extension) |
| 108 | const apiKey = options.apiKey || getApiKeyFromEnv("openrouter") |
| 109 | |
| 110 | const extensionHostOptions: ExtensionHostOptions = { |
| 111 | mode: "code", |
| 112 | reasoningEffort: undefined, |
| 113 | user: null, |
| 114 | provider: "openrouter", |
| 115 | model: openRouterDefaultModelId, |
| 116 | apiKey, |
| 117 | workspacePath, |
| 118 | extensionPath, |
| 119 | nonInteractive: true, |
| 120 | ephemeral: hostOptions.ephemeral, |
| 121 | debug: options.debug ?? false, |
| 122 | exitOnComplete: true, |
| 123 | exitOnError: false, |
| 124 | disableOutput: true, |
| 125 | } |
| 126 | |
| 127 | const host = new ExtensionHost(extensionHostOptions) |
| 128 | |
| 129 | await host.activate() |
| 130 | |
| 131 | // Best effort wait; mode/commands requests can still succeed without this. |
| 132 | await pWaitFor(() => host.client.isInitialized(), { |
| 133 | interval: 25, |
| 134 | timeout: 2_000, |
| 135 | }).catch(() => undefined) |
| 136 | |
| 137 | return host |
| 138 | } |
| 139 | |
| 140 | /** |
| 141 | * Send a request to the extension and wait for a matching response message. |
no test coverage detected