Move auth code into login crate (#15150)

- Move the auth implementation and token data into codex-login.
- Keep codex-core re-exporting that surface from codex-login for
existing callers.

---------

Co-authored-by: Codex <noreply@openai.com>
This commit is contained in:
Ahmed Ibrahim
2026-03-19 18:58:17 -07:00
committed by GitHub
co-authored by Codex
parent ded7854f09
commit 2aa4873802
35 changed files with 262 additions and 209 deletions
+11 -1
View File
@@ -36,13 +36,23 @@ pub enum ToolDecisionSource {
User,
}
/// Maps to core AuthMode to avoid a circular dependency on codex-core.
/// Maps to API/auth `AuthMode` to avoid a circular dependency on codex-core.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Display)]
pub enum TelemetryAuthMode {
ApiKey,
Chatgpt,
}
impl From<codex_app_server_protocol::AuthMode> for TelemetryAuthMode {
fn from(mode: codex_app_server_protocol::AuthMode) -> Self {
match mode {
codex_app_server_protocol::AuthMode::ApiKey => Self::ApiKey,
codex_app_server_protocol::AuthMode::Chatgpt
| codex_app_server_protocol::AuthMode::ChatgptAuthTokens => Self::Chatgpt,
}
}
}
/// Start a metrics timer using the globally installed metrics client.
pub fn start_global_timer(name: &str, tags: &[(&str, &str)]) -> MetricsResult<Timer> {
let Some(metrics) = crate::metrics::global() else {