| 633 | } |
| 634 | |
| 635 | export class OpenAICodexSDKProvider implements ApiProvider { |
| 636 | static OPENAI_MODELS = [ |
| 637 | // GPT-5.5 models |
| 638 | 'gpt-5.5', |
| 639 | 'gpt-5.5-pro', |
| 640 | // GPT-5.4 models |
| 641 | 'gpt-5.4', |
| 642 | 'gpt-5.4-pro', |
| 643 | // GPT-5.3 Codex models |
| 644 | 'gpt-5.3-codex', |
| 645 | 'gpt-5.3-codex-spark', |
| 646 | // GPT-5.2 models |
| 647 | // Note: gpt-5.2-pro is not currently supported via Codex SDK. |
| 648 | 'gpt-5.2', |
| 649 | 'gpt-5.2-codex', |
| 650 | // GPT-5.1 Codex models |
| 651 | 'gpt-5.1-codex', |
| 652 | 'gpt-5.1-codex-max', |
| 653 | 'gpt-5.1-codex-mini', |
| 654 | // GPT-5 Codex models |
| 655 | 'gpt-5-codex', |
| 656 | 'gpt-5-codex-mini', |
| 657 | // GPT-5 base |
| 658 | 'gpt-5', |
| 659 | ]; |
| 660 | |
| 661 | config: OpenAICodexSDKConfig; |
| 662 | env?: EnvOverrides; |
| 663 | apiKey?: string; |
| 664 | |
| 665 | private providerId = 'openai:codex-sdk'; |
| 666 | private codexModule?: any; |
| 667 | private codexInstances: Map<string, any> = new Map(); |
| 668 | private threads: Map<string, any> = new Map(); |
| 669 | private threadRunQueues: Map<string, Promise<void>> = new Map(); |
| 670 | private deepTracingWarningShown = false; // Show warning once per instance |
| 671 | private ignoredProviderEnvWarningShown = false; |
| 672 | private omittedProcessEnvWarningShown = false; |
| 673 | |
| 674 | constructor( |
| 675 | options: { |
| 676 | id?: string; |
| 677 | config?: OpenAICodexSDKConfig; |
| 678 | env?: EnvOverrides; |
| 679 | } = {}, |
| 680 | ) { |
| 681 | const { config, env, id } = options; |
| 682 | this.config = parseCodexConfig(config); |
| 683 | this.env = env; |
| 684 | this.apiKey = this.getApiKey(); |
| 685 | this.providerId = id ?? this.providerId; |
| 686 | providerRegistry.register(this); |
| 687 | |
| 688 | if ( |
| 689 | this.config.model && |
| 690 | !usesCustomModelProvider(this.config) && |
| 691 | !OpenAICodexSDKProvider.OPENAI_MODELS.includes(this.config.model) |
| 692 | ) { |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…