Remove the image generation extension's dependency on codex-core (#63727)

## Why

The extension depended on the full core configuration to resolve a small
set of per-thread settings. Accepting those settings from the host lets
the extension work with other host configuration types.

## What changed

Make the extension generic over any host configuration that can provide
`ImageGenerationSettings`. Resolve the settings and artifact save root
at thread startup and refresh them when the thread configuration changes.

Share the `image_gen` namespace through `codex-config` and the
`x-codex-turn-metadata` header through `codex-api`.

GitOrigin-RevId: 3f10fd0a45c910e87bb6beea7f7c2e6c3f7eb707
This commit is contained in:
jif
2026-11-24 19:54:23 +00:00
committed by copyberry
parent ae21235afb
commit 35ca204afa
11 changed files with 75 additions and 77 deletions
+1
View File
@@ -18,6 +18,7 @@ pub(crate) mod telemetry;
/// Path of the Responses endpoint, relative to a provider's base URL.
pub const RESPONSES_PATH: &str = "/responses";
pub use crate::requests::headers::X_CODEX_TURN_METADATA_HEADER;
pub use crate::requests::headers::build_realtime_thread_headers;
pub use crate::requests::headers::build_session_headers;
pub use codex_client::RequestTelemetry;
+3 -1
View File
@@ -4,6 +4,8 @@ use codex_utils_string::to_ascii_json_string;
use http::HeaderMap;
use http::HeaderValue;
pub const X_CODEX_TURN_METADATA_HEADER: &str = "x-codex-turn-metadata";
/// Correlate both the media call and its observer with the same thread and session tree.
pub fn build_realtime_thread_headers(
session_id: String,
@@ -17,7 +19,7 @@ pub fn build_realtime_thread_headers(
&& let Ok(metadata) = to_ascii_json_string(&serde_json::json!({ "thread_source": source }))
&& let Ok(value) = HeaderValue::from_str(&metadata)
{
headers.insert("x-codex-turn-metadata", value);
headers.insert(X_CODEX_TURN_METADATA_HEADER, value);
}
headers
}