From cc6da802a57fa2f8ffef16b5197658faa123366f Mon Sep 17 00:00:00 2001 From: Kelvin Amoaba <97001695+AmoabaKelvin@users.noreply.github.com> Date: Thu, 29 Oct 2026 20:48:45 +0000 Subject: [PATCH] feat(browser): paste images into annotation comments and send them to the agent (#36004) * feat(browser): paste images into annotation comments and send their paths to the agent * fix(paste): hand an image-only clipboard to native paste so Cmd+V reaches the annotation field * fix(browser): let an open image preview keep Escape instead of exiting Design Mode * test(paste): drop the ownership-event test the menu-claim test already covers * refactor(browser): reuse chat preview lifetimes and the terminal's paste host for annotation images * fix(browser): release pasted edit images when the edited note disappears --- .../browser-annotation-image-strip.tsx | 21 +++++ .../browser-annotation-output.test.ts | 11 +++ .../annotate/browser-annotation-output.ts | 6 ++ .../browser-guest-annotate-overlays.tsx | 1 + .../browser-page-annotation-tray.test.tsx | 6 +- .../annotate/browser-page-annotation-tray.tsx | 57 +++++++++--- .../pending-browser-annotation-card.tsx | 19 ++-- .../annotate/use-browser-annotation-images.ts | 89 +++++++++++++++++++ .../use-browser-page-annotation-send.ts | 12 ++- .../use-browser-page-grab-annotations.ts | 11 ++- .../browser-pane/annotate/useGrabMode.ts | 2 +- src/renderer/src/lib/app-menu-paste.test.ts | 32 +++---- src/renderer/src/lib/app-menu-paste.ts | 45 ++++++---- .../slices/browser/browser-slice-contract.ts | 7 +- src/shared/browser-grab-types.ts | 2 + 15 files changed, 260 insertions(+), 61 deletions(-) create mode 100644 src/renderer/src/components/browser-pane/annotate/browser-annotation-image-strip.tsx create mode 100644 src/renderer/src/components/browser-pane/annotate/use-browser-annotation-images.ts diff --git a/src/renderer/src/components/browser-pane/annotate/browser-annotation-image-strip.tsx b/src/renderer/src/components/browser-pane/annotate/browser-annotation-image-strip.tsx new file mode 100644 index 00000000000..457fe1fa8bd --- /dev/null +++ b/src/renderer/src/components/browser-pane/annotate/browser-annotation-image-strip.tsx @@ -0,0 +1,21 @@ +import { NativeChatImageAttachmentPreview } from '@/components/native-chat/NativeChatImageAttachmentPreview' +import type { NativeChatComposerImageAttachment } from '@/components/native-chat/NativeChatComposerField' + +export function BrowserAnnotationImageStrip({ + images, + onRemove +}: { + images: NativeChatComposerImageAttachment[] + onRemove: (id: string) => void +}): React.JSX.Element | null { + if (images.length === 0) { + return null + } + return ( +