Preserve image transparency metadata in app-server items (#37178)

## What changed

- Add `transparentBackground` to image-generation items and legacy completion events.
- Map Images API backgrounds to `true` for transparent, `false` for opaque, and `null` for automatic or unavailable values.
- Preserve the metadata in live notifications and persisted or resumed thread history while continuing to deserialize older items that omit it.

## Testing

- Cover transparent, opaque, and automatic backgrounds, including image edits and thread read/resume flows.
- Verify the stable JSON shape and optional TypeScript field.

GitOrigin-RevId: 08527f37f23431df45fab1ed34eb82b2139b49d7
This commit is contained in:
jimxie-oai authored and copyberry committed 2026-08-05 23:42:29 +00:00
1 parent a3ebd19fa4
commit 928bda82cf
35 files changed
+407 -9

No files matched your search

@@ -472,6 +472,7 @@ mod tests {
status: "in_progress".to_string(),
revised_prompt: None,
result: String::new(),
transparent_background: None,
saved_path: None,
});
let expected_completed_item = ExtensionItem::ImageGeneration(ImageGenerationItem {
@@ -479,6 +480,7 @@ mod tests {
status: "completed".to_string(),
revised_prompt: Some("A tiny blue square".to_string()),
result: "cG5n".to_string(),
transparent_background: Some(true),
saved_path: Some(expected_path.clone()),
});
codex_tools::TurnItemEmitter::emit_started(
@@ -500,6 +502,7 @@ mod tests {
status: "completed".to_string(),
revised_prompt: Some("A tiny blue square".to_string()),
result: "cG5n".to_string(),
transparent_background: Some(true),
saved_path: Some(expected_path.clone()),
})],
},