mirror of
https://github.com/openai/codex.git
synced 2026-11-13 06:45:07 +00:00
## What changed - Read `x-codex-imagegen-request-id` from image generation and edit responses. - Propagate the ID to `codex_image_generation_event` analytics. - Keep the ID in process only, excluding it from extension item serialization, generated types, app-server wire data, and rollout history. ## Testing - Cover response-header extraction and missing-header behavior in the images client. - Verify end-to-end analytics emission and the unchanged image-generation item wire shape. GitOrigin-RevId: 9b8e09b7d655c0c2faa84f0eee99aabae583668d
50 lines
1.7 KiB
Rust
50 lines
1.7 KiB
Rust
use codex_utils_absolute_path::AbsolutePathBuf;
|
|
use schemars::JsonSchema;
|
|
use serde::Deserialize;
|
|
use serde::Serialize;
|
|
use ts_rs::TS;
|
|
|
|
#[derive(Debug, Clone, Deserialize, Serialize, TS, JsonSchema, PartialEq)]
|
|
#[serde(tag = "type", rename_all = "camelCase")]
|
|
#[ts(tag = "type", rename_all = "camelCase")]
|
|
pub enum ImageGenerationFailure {
|
|
UsageLimitExceeded {
|
|
#[serde(rename = "limitId")]
|
|
#[ts(rename = "limitId")]
|
|
limit_id: String,
|
|
#[serde(rename = "resetsAt")]
|
|
#[ts(rename = "resetsAt")]
|
|
#[ts(type = "number | null")]
|
|
resets_at: Option<i64>,
|
|
},
|
|
}
|
|
|
|
// Standalone image-generation item owned by the image extension. This is also
|
|
// the field-level representation exposed by app-server; core and rollout
|
|
// persistence only carry it inside an ExtensionItem envelope.
|
|
#[derive(Debug, Clone, Deserialize, Serialize, TS, JsonSchema, PartialEq)]
|
|
#[serde(rename_all = "camelCase")]
|
|
#[ts(rename_all = "camelCase")]
|
|
pub struct ImageGenerationItem {
|
|
pub id: String,
|
|
pub status: String,
|
|
pub revised_prompt: Option<String>,
|
|
pub result: String,
|
|
#[serde(default)]
|
|
#[ts(optional)]
|
|
pub transparent_background: Option<bool>,
|
|
#[serde(default)]
|
|
pub failure: Option<ImageGenerationFailure>,
|
|
#[serde(default, skip_serializing_if = "Option::is_none")]
|
|
#[ts(optional)]
|
|
pub saved_path: Option<AbsolutePathBuf>,
|
|
/// Exact nested ImageGen request ID retained only for in-process analytics.
|
|
///
|
|
/// This is deliberately excluded from the extension/app-server wire shape
|
|
/// and rollout persistence because it is not a client-facing item field.
|
|
#[serde(skip)]
|
|
#[schemars(skip)]
|
|
#[ts(skip)]
|
|
pub imagegen_request_id: Option<String>,
|
|
}
|