Conversation Markdown images and Browser Use / node_repl result images use one
shared thumbnail layout and full-screen preview dialog. Chat attachment previews also use the shared dialog while retaining their own
loading/error metadata. The persistent Preview Pane keeps its separate pane lifecycle.
max-h-90.h-44 thumbnails on desktop.rounded-xl, a semantic border/background, and
object-cover.The preview supports selection/moving annotations, pen, text, rectangle, ellipse, arrow, color, undo and redo. The image editor has no eraser tool (2026-11-02 toolbar revision); selection plus Delete removes one annotation and never changes source pixels. Tools are collapsed behind a small image-side “Draw” action on all screen sizes. Expanding it reveals a vertical floating toolbar next to the image. Save creates a PNG at the source image's natural resolution and adds it to the focused Composer as a new attachment. It preserves existing text/attachments and never sends a prompt or overwrites the source. Closing or navigating with edits requests Add / Discard / Keep editing confirmation.
lostpointercapture with
buttons=0 arrives before pointerup (observed after the native color picker).
pointercancel and capture loss while a button is still pressed discard the
unfinished draft. Late end events never append a second copy.Download continues to save original bytes. Video items keep their playback controls and do not expose annotation tools. Cross-origin canvas failures are explicit.
image + preview-local annotations → Save → capture focused Composer receiver
↓
async natural-size PNG export
↓
preview still open + receiver still valid → addAttachmentFiles
↓
existing upload/draft attachment owner
Impact: presentation, draft-default and commit-effect; planning mode. The shared
ImagePreviewDialog is used by Markdown, tool result images, user-message media
and Composer attachments. Each entry keeps its own gallery/loading state; the
preview owns only transform and annotation history. useComposerAttachments
remains the attachment owner and enforces existing limits. Desktop and mobile
use the same renderer path and existing local/remote upload adapter. No changes
to accepted input, runtime, snapshots, replay or original file persistence.
Must inspect: shared dialog, annotation surface and focused Composer admission. Should inspect: mixed video/image gallery and keyboard focus. Invariants: no automatic send, no cross-scope late append, original media unchanged. Evidence: codegraph is unavailable for this checkout; direct callers and attachment sink were traced with source search to depth two. The feature graph now includes this shared preview edit contract; there are no unresolved product decisions.
| Case | Setup/action | Expected | Decision |
|---|---|---|---|
| IPE01 | Fit image, click blank/image/control | Blank closes; image/control stays; cursor is normal | accepted |
| IPE02 | Wheel, button, pinch, pan, resize | Anchored bounded zoom/pan; grab only on overflow | accepted |
| IPE03 | Pen/text/shapes, select/move, delete selected mark, undo/redo | Original preserved; edits and history render consistently | accepted |
| IPE04 | Save with text and attachment already in Composer | One natural-size PNG appended; draft preserved; zero sends | accepted |
| IPE05 | Close/switch scope during export, full/disabled Composer, export failure | No late or duplicate append; failure retains editable history | accepted |
| IPE06 | 390/1100px, light/dark, Chinese/English | No eraser; tools collapsed by default; Add to chat appears below the active drawing only after an edit; controls accessible without overlap or horizontal page overflow | accepted |
Dimensions: image vs video, fit vs overflow, mouse vs touch, edit vs export, available vs invalid Composer, width/theme/locale. Sending/queue/fork/replay cross-products are pruned because saving only uses existing draft admission. E2E handoff: browser candidate covers IPE01–03/05–06; desktop pending candidate covers IPE04 with the real Composer. Promotion remains subject to human review.
ArrowLeft and ArrowRight controls centered
vertically against the viewport. Keyboard arrows perform the same navigation.titleBarOverlay caption area.
Linux keeps the dialog content below its self-drawn titlebar and preserves a
trailing inset for the action row. macOS places the action row below the hidden native titlebar; Web and mobile keep
the normal top-right inset.data: images continue through the bounded
byte payload path. Web uses a size-bounded response reader when JavaScript can
read the source, and falls back to browser-native navigation for cross-origin
HTTP(S) sources that reject CORS so renderer memory is not used as an
unbounded download buffer.data:image/... sources never enter the network path; their content is
bounded in renderer memory and saved through the byte-payload IPC variant.node_repl provides the retained images emitted by the same tool
result as one group and suggests result-image-{index}.{ext} filenames. Core
currently retains at most MAX_NODE_REPL_DISPLAY_IMAGES = 2 display images
per result.| Case | Setup | Action | Expected |
|---|---|---|---|
| SIG-001 | One Markdown or Browser Use image | Render message | At most half message width and max-h-90 |
| SIG-002 | Multiple images on narrow mobile | Render message | One column, wrapped without horizontal scrolling |
| SIG-003 | Multiple images on small screen | Render message | Two columns, equal-height cropped thumbnails |
| SIG-004 | Multiple images on desktop | Render message | Horizontal h-44 thumbnails wrapping to new rows |
| SIP-001 | One image | Open preview | Centered image, no navigation arrows |
| SIP-002 | Multiple images | Open the second thumbnail | Second image active; arrows and keyboard navigate the group |
| SIP-003 | Zoomed image | Drag or pinch | Translation/zoom stay within configured bounds |
| SIP-004 | Any image | Download | Active image is saved through the current platform path |
| SIP-005 | Navigated/zoomed image | Change image | Zoom and translation reset to 100%/center |
| SIP-006 | Windows or Linux desktop preview | Open preview | Download/close stay outside native or self-drawn controls |
grab, and wheel input left
zoom at 100%. The transparent Dialog content intercepted blank clicks, the
viewport cursor was unconditional, and there was no wheel listener.desktop-e2e-20261022124558480-p56523-2adaaa12b3911c95); existing gallery 5/5
passed (desktop-e2e-20261022125109960-p80041-c18b5ef3f853e9e2). The new case
verifies a 320×240 PNG, existing draft/attachment retention and zero sends.
Its first fixture had zero image dimensions; the repaired fixture explicitly
waits for successful decoding before drawing.packages/desktop/.e2e-artifacts/image-preview-edit-browser/20261102-results.log
and the screenshots in the same directory.packages/desktop/.e2e-artifacts/desktop-e2e-20261102092929053-p92626-eefc98a26d487a2b.A real macOS Electron 44.7.0 session reproduced the reported first-stroke loss
following the native color picker. The completed blue stroke had 16 points;
lostpointercapture(buttons=0) arrived about 0.3ms before pointerup. The former
cleared the draft and pointer membership, so the latter could not commit it.
The 3.17.1 packaged handler uses the same ending logic as the source baseline.
Completion now accepts either pointerup or capture loss with no buttons held.
The existing pointer membership guard still commits once. Genuine cancellation
and capture loss while pressed still discard the unfinished draft. No timers,
new history owner or color-specific workaround are introduced.
Evidence: packages/desktop/.e2e-artifacts/image-preview-stroke-diagnosis/ contains
manual-trace.json, fixed-electron-trace.json and browser-results.log.
CDP replay reproduced the same native event order and failed before the fix;
after it, browser regressions passed 23/23, including consecutive colored strokes,
undo/redo and both cancellation paths. macOS Composer save passed 1/1 in
packages/desktop/.e2e-artifacts/desktop-e2e-20261102095521629-p29703-d2ab6d64b0eca68e.
Typechecks, lint (existing warnings), scoped formatting and architecture passed;
no affected engineering tests were selected. Native Windows/Linux and physical
phones were not verified. Browser and Desktop candidates remain pending.
The team vote chose the new preview layout: no persistent side toolbar, annotation tools expanded on demand, Open With reused in the top action row, and an image context menu with Add to chat, Copy image and Download; after saving a local copy, Reveal opens the file manager. The right-aligned Save placement from the toolbar revision above is replaced by the sections below. The eraser removal and the stroke completion fix remain in force unchanged.
Review follow-up: successful ordinary downloads also populate the same local-copy path used by Open With and Reveal. Collapsed annotation mode keeps marks visible but ignores mark hit testing and editing shortcuts. Cross-origin copy uses a bounded CORS read and temporary same-origin image; denied CORS surfaces failure.
User message file mentions such as [小桥流水人家.jpg](./images/小桥流水人家.jpg)
retain their destination separately from the display label. Image file mentions
in a workspace conversation are keyboard-accessible buttons that open this same
image dialog, including its context menu and top actions. Ordinary files,
directories, plugin links and unresolved/unsupported destinations retain their
existing display-only behavior.
Resolve only the stored destination: parse and preserve raw absolute/file-URL paths before applying the shared relative/home path resolver. Raw mentions never use the rehype root-relative heuristic. Use the conversation workspace/home context for relative paths; never infer a filesystem path from the visible filename. Reads go through the workspace-scoped file service supplied by its ServiceProvider. The preview request identity includes workspaceIdentity (with workspacePath fallback) and remote session identity. Closing, unmounting, changing the destination or switching workspace/host invalidates pending reads. Loading and missing-file failures are shown inside the dialog. Public/share rendering without a workspace context does not gain local file access.
This changes only user-message presentation and an explicit read-only media request. It does not change original prompt text, attachments, queues, session ownership, desktop continuous or mobile replayable delivery.
Browser saveFile success without a local path means the download has started. Only a returned local path can be passed to native Open With / Reveal; a successful browser download must not display a save-failed error.
After a local copy is saved, query its registered applications and show the real default application name and supplied icon in the top action. Before saving, retain the neutral Save and open action: application lookup requires a real local file. Reveal is available before saving and first requests a saved copy; cancellation does not reveal, failure is reported, and subsequent reveals reuse the same copy. Web without native file capability does not offer these actions.
Replace the bottom Annotate entry with a small image-side Draw button. Tools start collapsed. Clicking opens a vertical floating rail beside the image; clicking again collapses it. Existing shapes stay visible but read-only while collapsed. Reserve side space on narrow screens and bound the rail height with scrolling, keeping top actions separate and Add to chat below the active drawing. No new drawing tools.
When visible edits exist, show Add to chat centered just below the selected drawing (or the latest drawing when none is selected), not below the full image or inside the side rail. Export the edited copy into the captured current Composer, close only after admission succeeds, and report that it can be removed before sending. Never send or overwrite the source. Failure preserves editing. All preview close requests and gallery navigation pass through the editor guard. Unsaved changes offer Add to chat / Discard changes / Keep editing. Original-image Add to chat uses the edited result while dirty, rather than bypassing the guard. An in-flight export prevents close/navigation until it succeeds or fails.
While the confirmation is open, background editing and gallery shortcuts are blocked. Original-image asynchronous Add locks editing and navigation until admission resolves.
If closing interrupts an active drawing gesture, commit the currently visible partial stroke once, then clear pointer tracking and release capture before showing confirmation. Subsequent move/up events cannot change that frozen edit.
Gallery previous/next controls occupy the bottom corners, outside the vertical drawing rail, on desktop and narrow screens. Expanding drawing tools or showing the Add action must not intercept navigation clicks.
Use a quiet semantic-background canvas, popover chrome with a fine border and soft shadow, and a single theme-matched action beneath the active drawing. The 36px-high Add to chat button is centered 12px below the selected/latest drawing bounds, never wraps, and only appears while dirty. Reserve bottom space and clamp positioning when zoomed so it stays inside the viewport when the drawing approaches its edges. The side drawing rail is one continuous surface: collapse control, drawing controls, circular color swatch, and undo/redo groups separated by fine rules. Use popover background and foreground tokens: light surface/dark text in light theme, dark surface/light text in dark theme. Do not invert with primary-button colors. Position follows drawing selection, movement, undo and zoom; empty drawing state hides it.