Send local TUI images as portable attachments to remote app servers (#45499)

## Why

Remote app servers cannot read image paths on the TUI host. Image attachments need to carry their contents when submitting to a remote workspace.

## What changed

- Prepare local images as data URLs off the event loop for new turns and steers, preserving source pixels for model-specific resizing and enforcing a 32 MiB image transport budget.
- Show preparation progress, preserve queued message order, and recover drafts on preparation failures, cancellation, disconnects, or thread switches. Ignore stale preparation completions.
- Avoid duplicate user messages from server receipts and duplicate image labels in history.

## Testing

Add regression tests for portable image contents, receipt deduplication, draft restoration, responsive input during preparation, and cancellation across thread and connection changes.

GitOrigin-RevId: 6404615eae0b06c141af96b4229501c61f7fcfee
This commit is contained in:
Eric Traut
2026-09-14 19:21:08 +00:00
committed by copyberry
parent afaad7cdc0
commit d38b5260a1
21 changed files with 731 additions and 40 deletions
@@ -134,6 +134,8 @@ impl ChatWidget {
initial_user_message,
status_account_display,
remote_connection: None,
snapshot_local_images: false,
pending_image_submission: None,
local_worktree_operations: true,
windows_sandbox_host: crate::app::WindowsSandboxHost::Local,
#[cfg(any(target_os = "windows", test))]
@@ -274,6 +276,7 @@ impl ChatWidget {
current_goal_status: None,
external_editor_state: ExternalEditorState::Closed,
last_rendered_user_message_display: None,
last_rendered_user_message_client_id: None,
last_non_retry_error: None,
};