From ddc704d4c632cab9aa7517a7a40a6d8283a2ee75 Mon Sep 17 00:00:00 2001 From: gt-oai Date: Tue, 27 Jan 2026 16:59:53 +0000 Subject: [PATCH] backend-client: add get_config_requirements_file (#10001) Adds getting config requirement to backend-client. I made a slash command to test it (not included in this PR): Screenshot 2026-01-27 at 15 20 41 --- codex-rs/backend-client/src/client.rs | 15 +++++++ codex-rs/backend-client/src/lib.rs | 1 + codex-rs/backend-client/src/types.rs | 1 + .../src/models/config_file_response.rs | 40 +++++++++++++++++++ .../src/models/mod.rs | 4 ++ 5 files changed, 61 insertions(+) create mode 100644 codex-rs/codex-backend-openapi-models/src/models/config_file_response.rs diff --git a/codex-rs/backend-client/src/client.rs b/codex-rs/backend-client/src/client.rs index ea3585956b..ec5fd3f61b 100644 --- a/codex-rs/backend-client/src/client.rs +++ b/codex-rs/backend-client/src/client.rs @@ -1,4 +1,5 @@ use crate::types::CodeTaskDetailsResponse; +use crate::types::ConfigFileResponse; use crate::types::CreditStatusDetails; use crate::types::PaginatedListTaskListItem; use crate::types::RateLimitStatusPayload; @@ -244,6 +245,20 @@ impl Client { self.decode_json::(&url, &ct, &body) } + /// Fetch the managed requirements file from codex-backend. + /// + /// `GET /api/codex/config/requirements` (Codex API style) or + /// `GET /wham/config/requirements` (ChatGPT backend-api style). + pub async fn get_config_requirements_file(&self) -> Result { + let url = match self.path_style { + PathStyle::CodexApi => format!("{}/api/codex/config/requirements", self.base_url), + PathStyle::ChatGptApi => format!("{}/wham/config/requirements", self.base_url), + }; + let req = self.http.get(&url).headers(self.headers()); + let (body, ct) = self.exec_request(req, "GET", &url).await?; + self.decode_json::(&url, &ct, &body) + } + /// Create a new task (user turn) by POSTing to the appropriate backend path /// based on `path_style`. Returns the created task id. pub async fn create_task(&self, request_body: serde_json::Value) -> Result { diff --git a/codex-rs/backend-client/src/lib.rs b/codex-rs/backend-client/src/lib.rs index 29fe9f3c6b..de827e9a97 100644 --- a/codex-rs/backend-client/src/lib.rs +++ b/codex-rs/backend-client/src/lib.rs @@ -4,6 +4,7 @@ pub mod types; pub use client::Client; pub use types::CodeTaskDetailsResponse; pub use types::CodeTaskDetailsResponseExt; +pub use types::ConfigFileResponse; pub use types::PaginatedListTaskListItem; pub use types::TaskListItem; pub use types::TurnAttemptsSiblingTurnsResponse; diff --git a/codex-rs/backend-client/src/types.rs b/codex-rs/backend-client/src/types.rs index afeb231a18..9deeab7903 100644 --- a/codex-rs/backend-client/src/types.rs +++ b/codex-rs/backend-client/src/types.rs @@ -1,3 +1,4 @@ +pub use codex_backend_openapi_models::models::ConfigFileResponse; pub use codex_backend_openapi_models::models::CreditStatusDetails; pub use codex_backend_openapi_models::models::PaginatedListTaskListItem; pub use codex_backend_openapi_models::models::PlanType; diff --git a/codex-rs/codex-backend-openapi-models/src/models/config_file_response.rs b/codex-rs/codex-backend-openapi-models/src/models/config_file_response.rs new file mode 100644 index 0000000000..2e22cb58fe --- /dev/null +++ b/codex-rs/codex-backend-openapi-models/src/models/config_file_response.rs @@ -0,0 +1,40 @@ +/* + * codex-backend + * + * codex-backend + * + * The version of the OpenAPI document: 0.0.1 + * + * Generated by: https://openapi-generator.tech + */ + +use serde::Deserialize; +use serde::Serialize; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct ConfigFileResponse { + #[serde(rename = "contents", skip_serializing_if = "Option::is_none")] + pub contents: Option, + #[serde(rename = "sha256", skip_serializing_if = "Option::is_none")] + pub sha256: Option, + #[serde(rename = "updated_at", skip_serializing_if = "Option::is_none")] + pub updated_at: Option, + #[serde(rename = "updated_by_user_id", skip_serializing_if = "Option::is_none")] + pub updated_by_user_id: Option, +} + +impl ConfigFileResponse { + pub fn new( + contents: Option, + sha256: Option, + updated_at: Option, + updated_by_user_id: Option, + ) -> ConfigFileResponse { + ConfigFileResponse { + contents, + sha256, + updated_at, + updated_by_user_id, + } + } +} diff --git a/codex-rs/codex-backend-openapi-models/src/models/mod.rs b/codex-rs/codex-backend-openapi-models/src/models/mod.rs index d767154925..7072dede5e 100644 --- a/codex-rs/codex-backend-openapi-models/src/models/mod.rs +++ b/codex-rs/codex-backend-openapi-models/src/models/mod.rs @@ -3,6 +3,10 @@ // Currently export only the types referenced by the workspace // The process for this will change +// Config +pub mod config_file_response; +pub use self::config_file_response::ConfigFileResponse; + // Cloud Tasks pub mod code_task_details_response; pub use self::code_task_details_response::CodeTaskDetailsResponse;