core: resolve view_image paths in selected environment (#29526)

## Why

view_image needs to support foreign OS remote executors.

## What

- resolve image paths against the selected environment as `PathUri` and
read them through that environment's filesystem
- keep app-server's public path field wire-compatible as
`LegacyAppPathString`, with purpose-specific UI rendering
- cover relative and absolute target-native paths in the core
integration test and run the full `view_image` suite under wine-exec
without skips
This commit is contained in:
Adam Perry @ OpenAI authored and GitHub committed 2026-06-23 19:52:37 +00:00
1 parent c660e2b644
commit 510bce9927
35 files changed
+155 -101

No files matched your search

@@ -836,7 +836,7 @@ impl ThreadHistoryBuilder {
fn handle_view_image_tool_call(&mut self, payload: &ViewImageToolCallEvent) {
let item = ThreadItem::ImageView {
id: payload.call_id.clone(),
path: payload.path.clone(),
path: payload.path.clone().into(),
};
self.upsert_item_in_current_turn(item);
}
@@ -356,7 +356,10 @@ pub enum ThreadItem {
},
#[serde(rename_all = "camelCase")]
#[ts(rename_all = "camelCase")]
ImageView { id: String, path: AbsolutePathBuf },
ImageView {
id: String,
path: LegacyAppPathString,
},
#[serde(rename_all = "camelCase")]
#[ts(rename_all = "camelCase")]
Sleep {
@@ -855,7 +858,7 @@ impl From<CoreTurnItem> for ThreadItem {
},
CoreTurnItem::ImageView(image) => ThreadItem::ImageView {
id: image.id,
path: image.path,
path: image.path.into(),
},
CoreTurnItem::Sleep(sleep) => ThreadItem::Sleep {
id: sleep.id,
@@ -2574,14 +2574,14 @@ fn core_turn_item_into_thread_item_converts_supported_variants() {
let image_view_item = TurnItem::ImageView(ImageViewItem {
id: "view-image-1".to_string(),
path: test_path_buf("/tmp/view-image.png").abs(),
path: PathUri::from_abs_path(&test_path_buf("/tmp/view-image.png").abs()),
});
assert_eq!(
ThreadItem::from(image_view_item),
ThreadItem::ImageView {
id: "view-image-1".to_string(),
path: test_path_buf("/tmp/view-image.png").abs(),
path: LegacyAppPathString::from_abs_path(&test_path_buf("/tmp/view-image.png").abs()),
}
);