Skip to content

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

Merge conversations-ui-cleanup into legacy-chat-thread-removal

Steven Enamakel8fe200945cd8
diff --cc app/src/components/assistant-ui/thread.tsx
index 1ca5bb46fa,018b9247c0..5f5e57ac73
--- a/app/src/components/assistant-ui/thread.tsx
+++ b/app/src/components/assistant-ui/thread.tsx
@@@ -385,16 -438,15 +446,21 @@@ const ThreadRoot: FC<
)}>
<ThreadScrollToBottom />
<ThreadFollowupSuggestions />
- <Composer
- model={model}
- onModelChange={onModelChange}
- onEscape={onEscape}
- isDraggingFiles={isDraggingFiles}
- />
- <AuiIf condition={s => isNewChatView(s) && s.composer.isEmpty}>
- <ThreadSuggestions />
- </AuiIf>
+ {HostComposer ? (
+ <HostComposer />
+ ) : (
+ <>
- <Composer model={model} onModelChange={onModelChange} onEscape={onEscape} />
++ <Composer
++ model={model}
++ onModelChange={onModelChange}
++ onEscape={onEscape}
++ isDraggingFiles={isDraggingFiles}
++ />
+ <AuiIf condition={s => isNewChatView(s) && s.composer.isEmpty}>
+ <ThreadSuggestions />
+ </AuiIf>
+ </>
+ )}
</ThreadPrimitive.ViewportFooter>
</div>
</ThreadPrimitive.Viewport>
diff --cc app/src/features/conversations/components/AssistantUiChat.slots.test.tsx
index 1711eab19c,01073e81f8..3344d0d5fe
--- a/app/src/features/conversations/components/AssistantUiChat.slots.test.tsx
+++ b/app/src/features/conversations/components/AssistantUiChat.slots.test.tsx
@@@ -63,7 -63,7 +63,8 @@@ function chat
overrides: {
attachmentsEnabled?: boolean;
attachmentInteractionBlocked?: boolean;
+ composerReplacement?: React.ReactNode;
+ onAttachFiles?: (files: FileList | File[] | null) => Promise<void>;
} = {}
) {
return (
@@@ -134,36 -150,62 +152,93 @@@ describe('assistant-ui composer slots'
// `attachmentsEnabled` is false here, so no host file sink is published and
// the primitive's own (capability-gated) handling is what remains.
expect(composerShell().getAttribute('data-dragging')).toBeNull();
+ expect(dataTransfer.dropEffect).toBe('none');
+ });
+
+ it('takes a file dropped anywhere over the open thread, not just the composer', async () => {
+ const store = buildStore();
+ const onAttachFiles = vi.fn(() => Promise.resolve());
+ render(
+ <Provider store={store}>
+ {chat(undefined, { attachmentsEnabled: true, onAttachFiles })}
+ </Provider>
+ );
+
+ const file = new File(['png'], 'shot.png', { type: 'image/png' });
+ const dragOver = { types: ['Files'], dropEffect: 'none' };
+ fireEvent.dragOver(threadViewport(), { dataTransfer: dragOver });
+
+ // The drag is claimed over the transcript and the composer lights up as
+ // the place the file will land.
+ expect(dragOver.dropEffect).toBe('copy');
+ expect(composerShell().getAttribute('data-dragging')).toBe('true');
+
+ const drop = fireEvent.drop(threadViewport(), {
+ dataTransfer: { types: ['Files'], files: [file], items: [] },
+ });
+
+ expect(drop).toBe(false); // default (navigate to the file) cancelled
+ await vi.waitFor(() => expect(onAttachFiles).toHaveBeenCalledWith([file]));
+ expect(composerShell().getAttribute('data-dragging')).toBeNull();
+ });
+
+ it('serializes rapid thread drops while attachment ingestion is pending', async () => {
+ const store = buildStore();
+ let finishFirst!: () => void;
+ const firstFinished = new Promise<void>(resolve => {
+ finishFirst = resolve;
+ });
+ const onAttachFiles = vi.fn(() => firstFinished);
+ render(
+ <Provider store={store}>
+ {chat(undefined, { attachmentsEnabled: true, onAttachFiles })}
+ </Provider>
+ );
+
+ const drop = (name: string) =>
+ fireEvent.drop(threadViewport(), {
+ dataTransfer: { types: ['Files'], files: [new File(['file'], name)], items: [] },
+ });
+
+ drop('first.txt');
+ await vi.waitFor(() => expect(onAttachFiles).toHaveBeenCalledTimes(1));
+ drop('second.txt');
+ await Promise.resolve();
+ expect(onAttachFiles).toHaveBeenCalledTimes(1);
+
+ finishFirst();
+ await firstFinished;
+ await vi.waitFor(() => expect(onAttachFiles).toHaveBeenCalledTimes(2));
});
+
+ it('swaps only the composer when the host supplies a replacement (mic-cloud)', () => {
+ const store = buildStore();
+ const { rerender } = render(
+ <Provider store={store}>
+ {chat(undefined, { composerReplacement: <div data-testid="voice-probe">one</div> })}
+ </Provider>
+ );
+
+ // The assistant-ui transcript is still the one mounted...
+ expect(document.querySelector('[data-slot="aui_thread-viewport"]')).not.toBeNull();
+ // ...but the text composer is gone, replaced by the host's.
+ expect(composerShell()).toBeNull();
+ const probe = screen.getByTestId('voice-probe');
+
+ // Stable slot identity: a host re-render updates the replacement in place
+ // rather than remounting it (MicComposer holds recording state).
+ rerender(
+ <Provider store={store}>
+ {chat(undefined, { composerReplacement: <div data-testid="voice-probe">two</div> })}
+ </Provider>
+ );
+ expect(screen.getByTestId('voice-probe')).toBe(probe);
+ expect(probe).toHaveTextContent('two');
+ });
+
+ it('keeps the built-in composer when no replacement is supplied', () => {
+ const store = buildStore();
+ render(<Provider store={store}>{chat()}</Provider>);
+ expect(composerShell()).not.toBeNull();
+ });
});
diff --cc app/src/providers/ChatRuntimeProvider.tsx
index ec26e8398f,dbde30ee9b..816b032c03
--- a/app/src/providers/ChatRuntimeProvider.tsx
+++ b/app/src/providers/ChatRuntimeProvider.tsx
@@@ -33,7 -33,9 +33,8 @@@ import { store } from '../store'
import {
appendSubagentStreamDelta,
bumpInferenceHeartbeatForThread,
+ cancelUnresolvedTurnTimeline,
clearInferenceStatusForThread,
- clearParallelRequest,
clearPendingApprovalForThread,
clearPendingPlanReviewForThread,
clearProcessingForThread,