feat: add codex sse and usage helpers

Co-authored-by: Codex <noreply@openai.com>
This commit is contained in:
zyycn
2026-06-11 23:19:01 +08:00
co-authored by Codex
parent 1b1e447697
commit 225fbffb75
15 changed files with 305 additions and 12 deletions
+1 -1
View File
@@ -17,6 +17,6 @@ Update this file before each feature commit.
| Translation | Completed | `eff182e` | `cargo test chat_completion_translates_to_codex_response_request`; full `fmt/test/clippy` before commit | Adds OpenAI Chat request types, Codex Responses request type, translation, and OpenAI-compatible error body helper. |
| HTTP routes | Completed | `ab0ad8f` + `3830b21` | `cargo test v1_requires_client_api_key_not_admin_cookie`; `cargo test models_route_returns_openai_compatible_codex_model_list`; full `fmt/test/clippy` before commit | Adds Axum router, health route, `/v1/models`, `/v1` unauthorized OpenAI error body, global request-id response header, and binary listener. |
| Admin/frontend response contract | Completed | `1c34ea7` + `b0c10f2` | `cargo test admin_envelope_serializes_lower_camel_case_request_id`; `cargo test admin_logs_reject_missing_admin_session_cookie`; `cargo test v1_response_has_request_id_header_without_admin_body_field`; full `fmt/test/clippy` before commit | Adds reusable admin envelopes with body codes, lower camelCase JSON, paginated list shape, requestId bodies, admin session cookie enforcement, and keeps `/v1/*` OpenAI-compatible. |
| Upstream lifecycle | Completed | `88cad87` | `cargo test responses_route_rejects_non_codex_provider_models`; `cargo test v1_requires_client_api_key_not_admin_cookie`; full `fmt/test/clippy` before commit | `/v1` accepts only `Bearer cpr_...`, rejects non-Codex provider models, and returns OpenAI-compatible errors. |
| Upstream lifecycle | Completed | `88cad87` + SSE/usage module commit | `cargo test responses_route_rejects_non_codex_provider_models`; `cargo test v1_requires_client_api_key_not_admin_cookie`; `cargo test --test codex_sse_usage_test`; full `fmt/test/clippy` before commit | `/v1` accepts only `Bearer cpr_...`, rejects non-Codex provider models, returns OpenAI-compatible errors, and includes reusable SSE frame parsing/encoding plus token usage extraction utilities. |
| Fingerprint updates | Completed | `dd26d31` + `e32220a` | `cargo test update_manifest_updates_app_version_and_build_number`; `cargo test fingerprint_updater_fetches_manifest_and_persists_history`; full `fmt/test/clippy` before commit | Parses Codex Desktop update manifests, fetches update source payloads, and persists app version/build number history to SQLite. |
| Runtime docs and packaging | Completed | `33b63f3` | `cargo fmt --check`; `cargo clippy --all-targets --all-features --locked -- -D warnings`; `cargo test`; `cargo run`; `curl -s -i http://127.0.0.1:8080/health` | README scope, `.env.example`, Dockerfile, compose file, and health smoke test are complete. |