* 启动新会话
(config: ExecutorSpawnConfig)
| 309 | } |
| 310 | |
| 311 | /** Return a snapshot immediately while a single-flight CLI probe refreshes it. */ |
| 312 | export function getCachedCodexMcpServerNames( |
| 313 | configOverrideArgs: string[] = [], |
| 314 | fallbackConfigPath?: string, |
| 315 | probeCommand?: CommandParts, |
| 316 | environment?: NodeJS.ProcessEnv, |
| 317 | workingDir?: string, |
| 318 | ): Set<string> { |
| 319 | return new Set(getCodexMcpServerCacheEntry( |
| 320 | configOverrideArgs, fallbackConfigPath, probeCommand, environment, workingDir, |
| 321 | ).names); |
| 322 | } |
| 323 | |
| 324 | /** Wait asynchronously for effective project config before constructing launch overrides. */ |
| 325 | export async function getCodexMcpServerNamesForLaunch( |
| 326 | configOverrideArgs: string[] = [], |
| 327 | fallbackConfigPath?: string, |
| 328 | probeCommand?: CommandParts, |
| 329 | environment?: NodeJS.ProcessEnv, |
| 330 | workingDir?: string, |
| 331 | ): Promise<Set<string>> { |
| 332 | const entry = getCodexMcpServerCacheEntry( |
| 333 | configOverrideArgs, fallbackConfigPath, probeCommand, environment, workingDir, |
| 334 | ); |
| 335 | // Parsing project files ourselves could disable MCPs ignored by Codex's trust |
| 336 | // rules and create invalid transport-less entries. Await this key's CLI probe. |
| 337 | await entry.refreshPromise; |
| 338 | return new Set(entry.names); |
| 339 | } |
| 340 | |
| 341 | /** Test-only reset hook; no production caller should need to clear this cache. */ |
| 342 | export function resetCodexMcpServerCache(): void { |
| 343 | codexMcpCache.clear(); |
| 344 | } |
nothing calls this directly
no test coverage detected