From ff4ca9959c0cb2237b339309fbf7084ef106debd Mon Sep 17 00:00:00 2001 From: Celia Chen Date: Mon, 1 Dec 2025 15:56:05 -0800 Subject: [PATCH] [app-server] Add ImageView item (#7468) Add view_image tool call as image_view item. Before: ``` < { < "method": "codex/event/view_image_tool_call", < "params": { < "conversationId": "019adc2f-2922-7e43-ace9-64f394019616", < "id": "0", < "msg": { < "call_id": "call_nBQDxnTfZQtgjGpVoGuDnRjz", < "path": "/Users/celia/code/codex/codex-rs/app-server-protocol/codex-cli-login.png", < "type": "view_image_tool_call" < } < } < } ``` After: ``` < { < "method": "item/started", < "params": { < "item": { < "id": "call_nBQDxnTfZQtgjGpVoGuDnRjz", < "path": "/Users/celia/code/codex/codex-rs/app-server-protocol/codex-cli-login.png", < "type": "imageView" < }, < "threadId": "019adc2f-2922-7e43-ace9-64f394019616", < "turnId": "0" < } < } < { < "method": "item/completed", < "params": { < "item": { < "id": "call_nBQDxnTfZQtgjGpVoGuDnRjz", < "path": "/Users/celia/code/codex/codex-rs/app-server-protocol/codex-cli-login.png", < "type": "imageView" < }, < "threadId": "019adc2f-2922-7e43-ace9-64f394019616", < "turnId": "0" < } < } ``` --- .../app-server/src/bespoke_event_handling.rs | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/codex-rs/app-server/src/bespoke_event_handling.rs b/codex-rs/app-server/src/bespoke_event_handling.rs index efdce3162..10fd1df03 100644 --- a/codex-rs/app-server/src/bespoke_event_handling.rs +++ b/codex-rs/app-server/src/bespoke_event_handling.rs @@ -351,6 +351,28 @@ pub(crate) async fn apply_bespoke_event_handling( })) .await; } + EventMsg::ViewImageToolCall(view_image_event) => { + let item = ThreadItem::ImageView { + id: view_image_event.call_id.clone(), + path: view_image_event.path.to_string_lossy().into_owned(), + }; + let started = ItemStartedNotification { + thread_id: conversation_id.to_string(), + turn_id: event_turn_id.clone(), + item: item.clone(), + }; + outgoing + .send_server_notification(ServerNotification::ItemStarted(started)) + .await; + let completed = ItemCompletedNotification { + thread_id: conversation_id.to_string(), + turn_id: event_turn_id.clone(), + item, + }; + outgoing + .send_server_notification(ServerNotification::ItemCompleted(completed)) + .await; + } EventMsg::EnteredReviewMode(review_request) => { let review = review_request.user_facing_hint; let item = ThreadItem::EnteredReviewMode {