Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

fix: route media paste through composer shell

Steven Enamakel8560642145cb
diff --git a/app/src/components/assistant-ui/thread.tsx b/app/src/components/assistant-ui/thread.tsx
index 8fc0722240..96bf6cd936 100644
--- a/app/src/components/assistant-ui/thread.tsx
+++ b/app/src/components/assistant-ui/thread.tsx
@@ -1011,6 +1011,7 @@ const Composer: FC<{
<div
data-slot="aui_composer-shell"
data-dragging={onComposerFiles && isDraggingFiles ? 'true' : undefined}
+ onPasteCapture={handlePasteCapture}
// Keyed to `content-faint` rather than `line`/`line-strong`, which
// sat too close to the composer's own surface to read as an edge at
// all; `content-faint` is a real step along the grey ramp in both
@@ -1088,7 +1089,6 @@ const Composer: FC<{
<LexicalComposerInput
ref={inputWrapperRef}
placeholder="Send a message..."
- onPasteCapture={handlePasteCapture}
onCompositionStartCapture={() => {
isComposingTextRef.current = true;
}}
diff --git a/app/test/playwright/specs/chat-composer-attachment-gate.spec.ts b/app/test/playwright/specs/chat-composer-attachment-gate.spec.ts
index 5058d45ae5..51ba2a7bf0 100644
--- a/app/test/playwright/specs/chat-composer-attachment-gate.spec.ts
+++ b/app/test/playwright/specs/chat-composer-attachment-gate.spec.ts
@@ -268,9 +268,12 @@ test.describe('Chat composer attachment gate', () => {
const file = new File([bytes], fileName, { type: 'image/png' });
const data = new DataTransfer();
data.items.add(file);
- target.dispatchEvent(
- new ClipboardEvent('paste', { clipboardData: data, bubbles: true, cancelable: true })
- );
+ // Chromium ignores the readonly `clipboardData` init member on a
+ // synthetic ClipboardEvent. Define it explicitly so the event seen by
+ // React has the same DataTransfer the browser would provide.
+ const event = new Event('paste', { bubbles: true, cancelable: true });
+ Object.defineProperty(event, 'clipboardData', { value: data });
+ target.dispatchEvent(event);
},
{ selector: '[data-testid="chat-message-input"]', fileName: name }
);