mirror of
https://github.com/openai/codex.git
synced 2026-09-06 15:29:32 +00:00
## Summary Add an in-memory externally provided Codex auth snapshot with explicit runtime capabilities, installed through the existing `ExternalAuth` provider path. ## Testing - `just fmt-check` - `cargo test -p codex-login --lib externally_provided_auth` - `cargo test -p codex-core --lib external_auth_snapshot_is_installed_from_runtime_config` - `cargo test -p codex-model-provider --lib external_auth` - `cargo test -p codex-mcp-extension --test hosted_apps_mcp hosted_apps_mcp_accepts_external_provided_codex_auth` - `cargo check -p codex-app-server -p codex-core-api -p codex-thread-manager-sample` --------- Co-authored-by: pakrym-oai <pakrym@openai.com>
21 lines
988 B
Rust
21 lines
988 B
Rust
use codex_app_server_protocol::AuthMode as ApiAuthMode;
|
|
use codex_protocol::auth::AuthMode;
|
|
|
|
/// Converts the domain auth mode owned by `codex-protocol` into the app-server wire type owned by
|
|
/// `codex-app-server-protocol`.
|
|
///
|
|
/// The types stay separate so app-server protocol ownership does not leak into domain crates.
|
|
/// Because this crate owns neither type, Rust's orphan rules require an explicit conversion
|
|
/// function instead of a `From` implementation.
|
|
pub(crate) fn auth_mode_to_api(auth_mode: AuthMode) -> ApiAuthMode {
|
|
match auth_mode {
|
|
AuthMode::ApiKey => ApiAuthMode::ApiKey,
|
|
AuthMode::Chatgpt => ApiAuthMode::Chatgpt,
|
|
AuthMode::ChatgptAuthTokens => ApiAuthMode::ChatgptAuthTokens,
|
|
AuthMode::Headers => ApiAuthMode::Headers,
|
|
AuthMode::AgentIdentity => ApiAuthMode::AgentIdentity,
|
|
AuthMode::PersonalAccessToken => ApiAuthMode::PersonalAccessToken,
|
|
AuthMode::BedrockApiKey => ApiAuthMode::BedrockApiKey,
|
|
}
|
|
}
|