From 8b944ef8d45b38bcc746a256004c07509d5fe381 Mon Sep 17 00:00:00 2001 From: Matthew Zeng Date: Thu, 6 Nov 2025 16:36:55 -0800 Subject: [PATCH] update --- .../app-server-protocol/src/protocol/common.rs | 4 ++++ codex-rs/app-server-protocol/src/protocol/v1.rs | 6 ++++++ .../app-server/src/codex_message_processor.rs | 15 +++++++++++++++ 3 files changed, 25 insertions(+) diff --git a/codex-rs/app-server-protocol/src/protocol/common.rs b/codex-rs/app-server-protocol/src/protocol/common.rs index a7ae035d48..8cb8737de6 100644 --- a/codex-rs/app-server-protocol/src/protocol/common.rs +++ b/codex-rs/app-server-protocol/src/protocol/common.rs @@ -279,6 +279,10 @@ client_request_definitions! { params: #[ts(type = "undefined")] #[serde(skip_serializing_if = "Option::is_none")] Option<()>, response: v1::GetUserAgentResponse, }, + GetClientInfo { + params: #[ts(type = "undefined")] #[serde(skip_serializing_if = "Option::is_none")] Option<()>, + response: v1::GetClientInfoResponse, + }, UserInfo { params: #[ts(type = "undefined")] #[serde(skip_serializing_if = "Option::is_none")] Option<()>, response: v1::UserInfoResponse, diff --git a/codex-rs/app-server-protocol/src/protocol/v1.rs b/codex-rs/app-server-protocol/src/protocol/v1.rs index d518abc1bd..ceedd2de51 100644 --- a/codex-rs/app-server-protocol/src/protocol/v1.rs +++ b/codex-rs/app-server-protocol/src/protocol/v1.rs @@ -254,6 +254,12 @@ pub struct GetUserAgentResponse { pub user_agent: String, } +#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] +#[serde(rename_all = "camelCase")] +pub struct GetClientInfoResponse { + pub client_version: String, +} + #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] #[serde(rename_all = "camelCase")] pub struct UserInfoResponse { diff --git a/codex-rs/app-server/src/codex_message_processor.rs b/codex-rs/app-server/src/codex_message_processor.rs index ebfaed58c1..9cec36d237 100644 --- a/codex-rs/app-server/src/codex_message_processor.rs +++ b/codex-rs/app-server/src/codex_message_processor.rs @@ -33,6 +33,7 @@ use codex_app_server_protocol::FuzzyFileSearchResponse; use codex_app_server_protocol::GetAccountRateLimitsResponse; use codex_app_server_protocol::GetAuthStatusParams; use codex_app_server_protocol::GetAuthStatusResponse; +use codex_app_server_protocol::GetClientInfoResponse; use codex_app_server_protocol::GetConversationSummaryParams; use codex_app_server_protocol::GetConversationSummaryResponse; use codex_app_server_protocol::GetUserAgentResponse; @@ -158,6 +159,7 @@ use uuid::Uuid; type PendingInterruptQueue = Vec<(RequestId, ApiVersion)>; type PendingInterrupts = Arc>>; +const CODEX_CLI_VERSION: &str = env!("CARGO_PKG_VERSION"); // Duration before a ChatGPT login attempt is abandoned. const LOGIN_CHATGPT_TIMEOUT: Duration = Duration::from_secs(10 * 60); struct ActiveLogin { @@ -340,6 +342,12 @@ impl CodexMessageProcessor { } => { self.get_user_agent(request_id).await; } + ClientRequest::GetClientInfo { + request_id, + params: _, + } => { + self.get_client_info(request_id).await; + } ClientRequest::UserInfo { request_id, params: _, @@ -858,6 +866,13 @@ impl CodexMessageProcessor { self.outgoing.send_response(request_id, response).await; } + async fn get_client_info(&self, request_id: RequestId) { + let response = GetClientInfoResponse { + client_version: CODEX_CLI_VERSION.to_string(), + }; + self.outgoing.send_response(request_id, response).await; + } + async fn get_account_rate_limits(&self, request_id: RequestId) { match self.fetch_account_rate_limits().await { Ok(rate_limits) => {