Adds a `GET account/rateLimits/read` API to app-server. This calls the codex backend to fetch the user's current rate limits. This would be helpful in checking rate limits without having to send a message. For calling the codex backend usage API, I generated the types and manually copied the relevant ones into `codex-backend-openapi-types`. It'll be nice to extend our internal openapi generator to support Rust so we don't have to run these manual steps. # External (non-OpenAI) Pull Request Requirements Before opening this Pull Request, please read the dedicated "Contributing" markdown file or your PR may be closed: https://github.com/openai/codex/blob/main/docs/contributing.md If your PR conforms to our contribution guidelines, replace this text with a detailed and high quality description of your changes.
23 lines
815 B
Rust
23 lines
815 B
Rust
mod auth_fixtures;
|
|
mod mcp_process;
|
|
mod mock_model_server;
|
|
mod responses;
|
|
|
|
pub use auth_fixtures::ChatGptAuthFixture;
|
|
pub use auth_fixtures::ChatGptIdTokenClaims;
|
|
pub use auth_fixtures::encode_id_token;
|
|
pub use auth_fixtures::write_chatgpt_auth;
|
|
use codex_app_server_protocol::JSONRPCResponse;
|
|
pub use mcp_process::McpProcess;
|
|
pub use mock_model_server::create_mock_chat_completions_server;
|
|
pub use responses::create_apply_patch_sse_response;
|
|
pub use responses::create_final_assistant_message_sse_response;
|
|
pub use responses::create_shell_sse_response;
|
|
use serde::de::DeserializeOwned;
|
|
|
|
pub fn to_response<T: DeserializeOwned>(response: JSONRPCResponse) -> anyhow::Result<T> {
|
|
let value = serde_json::to_value(response.result)?;
|
|
let codex_response = serde_json::from_value(value)?;
|
|
Ok(codex_response)
|
|
}
|