Compare commits

...

1 Commits

Author SHA1 Message Date
Matthew Zeng
8b944ef8d4 update 2025-11-06 16:36:55 -08:00
3 changed files with 25 additions and 0 deletions

View File

@@ -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,

View File

@@ -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 {

View File

@@ -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<Mutex<HashMap<ConversationId, PendingInterruptQueue>>>;
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) => {