mirror of
https://github.com/openai/codex.git
synced 2026-10-30 19:18:49 +00:00
Preserve raw response usage metadata (#41980)
## What changed - Include the complete upstream `response.usage` object in `ResponseUsageMetadata.metadata` while retaining the existing `amount` field. - Expose the metadata through `rawResponse/completed` notifications and update the generated JSON and TypeScript schemas. ## Testing - Cover SSE, WebSocket, turn, and compaction completion paths. GitOrigin-RevId: 6d79b1b4c92ac11abf43ec98f380b4868288a701
This commit is contained in:
@@ -1856,12 +1856,14 @@ pub struct RawResponseCompletedNotification {
|
||||
#[ts(export_to = "v2/")]
|
||||
pub struct ResponseUsageMetadata {
|
||||
pub amount: Option<String>,
|
||||
pub metadata: Option<JsonValue>,
|
||||
}
|
||||
|
||||
impl From<codex_protocol::ResponseUsageMetadata> for ResponseUsageMetadata {
|
||||
fn from(value: codex_protocol::ResponseUsageMetadata) -> Self {
|
||||
Self {
|
||||
amount: value.amount,
|
||||
metadata: value.metadata,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user