The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
fix(test): update test imports to match renamed component
Steven Enamakel1b24cb98f1b3
diff --git a/app/src/components/flows/WorkflowCopilotPanel.thread.test.tsx b/app/src/components/flows/WorkflowCopilotPanel.thread.test.tsxnew file mode 100644index 0000000000..7ff9ccedd8--- /dev/null+++ b/app/src/components/flows/WorkflowCopilotPanel.thread.test.tsx@@ -0,0 +1,112 @@+/**+ * The Workflow Copilot against the REAL assistant-ui `Thread`.+ *+ * `WorkflowCopilotPanel.test.tsx` stubs `Thread` to focus on the authoring+ * footer, and `WorkflowCopilotPanel.assistantUiRuntime.test.tsx` stubs it with+ * a runtime probe. This file mounts the real thing to pin down what those two+ * cannot: the copilot's transcript is the assistant-ui transcript of its OWN+ * builder thread, and the authoring footer lands in the Thread's `Composer`+ * slot in place of the chat composer (no model pill, no home-chat starters).+ */+import { combineReducers, configureStore } from '@reduxjs/toolkit';+import { render, screen } from '@testing-library/react';+import { Provider } from 'react-redux';+import { describe, expect, it, vi } from 'vitest';++import type { WorkflowGraph } from '../../lib/flows/types';+import chatRuntimeReducer from '../../store/chatRuntimeSlice';+import threadReducer from '../../store/threadSlice';+import type { ThreadMessage } from '../../types/thread';+import WorkflowCopilotPanel from './WorkflowCopilotPanel';++vi.mock('../../lib/i18n/I18nContext', () => ({ useT: () => ({ t: (key: string) => key }) }));+vi.mock('../../services/coreRpcClient', () => ({ callCoreRpc: vi.fn() }));++const hookState = vi.hoisted(() => ({+ threadId: 'builder-1' as string | null,+ sending: false,+ proposal: null,+ pendingApproval: null,+ capped: false,+ error: null as string | null,+ send: vi.fn(),+ stop: vi.fn(),+ clearProposal: vi.fn(),+}));+vi.mock('../../hooks/useWorkflowBuilderChat', () => ({ useWorkflowBuilderChat: () => hookState }));++function msg(id: string, sender: 'user' | 'agent', content: string): ThreadMessage {+ return {+ id,+ sender,+ type: 'text',+ content,+ extraMetadata: {},+ createdAt: '2026-01-01T00:00:00.000Z',+ };+}++const graph: WorkflowGraph = { schema_version: 1, name: 'g', nodes: [], edges: [] };++function renderPanel(builderMessages: ThreadMessage[]) {+ const store = configureStore({+ reducer: combineReducers({ thread: threadReducer, chatRuntime: chatRuntimeReducer }),+ preloadedState: {+ thread: {+ threads: [],+ selectedThreadId: 't-home',+ activeThreadIds: {},+ welcomeThreadId: null,+ messagesByThreadId: {+ 't-home': [msg('h1', 'user', 'home chat message')],+ 'builder-1': builderMessages,+ },+ messages: [],+ isLoadingThreads: false,+ isLoadingMessages: false,+ messagesError: null,+ },+ } as never,+ });+ return render(+ <Provider store={store}>+ <WorkflowCopilotPanel+ graph={graph}+ onProposal={vi.fn()}+ onAccept={vi.fn()}+ onReject={vi.fn()}+ />+ </Provider>+ );+}++describe('WorkflowCopilotPanel on the real assistant-ui Thread', () => {+ it('renders the builder thread through assistant-ui, not the home thread', () => {+ renderPanel([+ msg('b1', 'user', 'add a slack step'),+ msg('b2', 'agent', 'Proposed a Slack notification step.'),+ ]);++ const viewport = document.querySelector('[data-slot="aui_thread-viewport"]');+ expect(viewport).not.toBeNull();+ expect(viewport).toHaveTextContent('add a slack step');+ expect(viewport).toHaveTextContent('Proposed a Slack notification step.');+ expect(viewport).not.toHaveTextContent('home chat message');+ // The settled reply is an assistant-ui message, not a legacy bubble.+ expect(screen.getByTestId('agent-message')).toBeInTheDocument();+ });++ it('puts the builder composer in the Composer slot instead of the chat composer', () => {+ renderPanel([]);++ // The copilot's empty hint is the Thread's welcome.+ expect(screen.getByTestId('workflow-copilot-empty')).toBeInTheDocument();+ // The builder composer is present...+ expect(screen.getByPlaceholderText('flows.copilot.placeholder')).toBeInTheDocument();+ // ...and the chat composer shell (with its model pill) is not.+ expect(document.querySelector('[data-slot="aui_composer-shell"]')).toBeNull();+ // No home-chat starter prompts: clicking one would send it to the builder.+ expect(document.querySelector('.aui-thread-welcome-suggestions')).toBeNull();+ expect(document.querySelector('.aui-thread-followup-suggestions')).toBeNull();+ });+});diff --git a/app/src/features/conversations/components/AssistantUiChat.slots.test.tsx b/app/src/features/conversations/components/AssistantUiChat.slots.test.tsxindex 0a43fe3f7f..1711eab19c 100644--- a/app/src/features/conversations/components/AssistantUiChat.slots.test.tsx+++ b/app/src/features/conversations/components/AssistantUiChat.slots.test.tsx@@ -60,7 +60,11 @@ function buildStore() {function chat(onOpenHumanMode?: () => void,- overrides: { attachmentsEnabled?: boolean; attachmentInteractionBlocked?: boolean } = {}+ overrides: {+ attachmentsEnabled?: boolean;+ attachmentInteractionBlocked?: boolean;+ composerReplacement?: React.ReactNode;+ } = {}) {return (<AssistantUiChat@@ -76,6 +80,7 @@ function chat(attachmentInteractionBlocked={overrides.attachmentInteractionBlocked ?? false}onAttachmentOnlySend={vi.fn()}onOpenHumanMode={onOpenHumanMode}+ composerReplacement={overrides.composerReplacement}/>);}@@ -130,4 +135,35 @@ describe('assistant-ui composer slots', () => {// the primitive's own (capability-gated) handling is what remains.expect(composerShell().getAttribute('data-dragging')).toBeNull();});++ 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();+ });});