Skip to content

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

feat(conversations): open tiny voice from conversation list

Steven Enamakel8a86e07f2e6b
diff --git a/app/src/features/conversations/Conversations.tsx b/app/src/features/conversations/Conversations.tsx
index b4f4309901..cf4cfe52d2 100644
--- a/app/src/features/conversations/Conversations.tsx
+++ b/app/src/features/conversations/Conversations.tsx
@@ -43,6 +43,7 @@ import {
useChatMascotSendBinding,
} from '../../features/human/chatMascot';
import MicComposer from '../../features/human/MicComposer';
+import { openTinyVoice } from './utils/openTinyVoice';
import { useFlowApprovalRequests } from '../../hooks/useFlowApprovalRequests';
import { useUnroutedApprovals } from '../../hooks/useUnroutedApprovals';
import { useUsageState } from '../../hooks/useUsageState';
@@ -2022,7 +2023,7 @@ const Conversations = ({
// the stage's live voice control connects. Outside the chat page (no
// mascot provider) it falls back to the full-bleed Human page. Chat and
// Human share one mascot (mascotSlice), so either is the same partner.
- onOpenHumanMode={() => (chatMascot ? chatMascot.expandWithVoice() : navigate('/human'))}
+ onOpenHumanMode={() => openTinyVoice(chatMascot, navigate)}
onSwitchToMicCloud={() => setComposerOverride('mic-cloud')}
onModelChange={applyComposerModel}
/>
diff --git a/app/src/features/conversations/utils/openTinyVoice.test.ts b/app/src/features/conversations/utils/openTinyVoice.test.ts
new file mode 100644
index 0000000000..7a049beb65
--- /dev/null
+++ b/app/src/features/conversations/utils/openTinyVoice.test.ts
@@ -0,0 +1,21 @@
+import { describe, expect, it, vi } from 'vitest';
+
+import { openTinyVoice } from './openTinyVoice';
+
+describe('openTinyVoice', () => {
+ it('starts live voice on the mascot stage when one is mounted', () => {
+ const expandWithVoice = vi.fn();
+ const navigate = vi.fn();
+ openTinyVoice({ expandWithVoice }, navigate);
+ expect(expandWithVoice).toHaveBeenCalledTimes(1);
+ expect(navigate).not.toHaveBeenCalled();
+ });
+
+ it('falls back to the Human page without a mascot stage', () => {
+ const navigate = vi.fn();
+ openTinyVoice(undefined, navigate);
+ openTinyVoice(null, navigate);
+ expect(navigate).toHaveBeenCalledTimes(2);
+ expect(navigate).toHaveBeenCalledWith('/human');
+ });
+});
diff --git a/app/src/features/conversations/utils/openTinyVoice.ts b/app/src/features/conversations/utils/openTinyVoice.ts
new file mode 100644
index 0000000000..26fb74ad27
--- /dev/null
+++ b/app/src/features/conversations/utils/openTinyVoice.ts
@@ -0,0 +1,15 @@
+/**
+ * What clicking Tiny (the mascot in the idle composer) does: start a live
+ * voice session with the agent on the mascot stage beside the chat, or — where
+ * no mascot stage is mounted — open the full-bleed Human page.
+ */
+export function openTinyVoice(
+ chatMascot: { expandWithVoice: () => void } | null | undefined,
+ navigate: (to: string) => void
+): void {
+ if (chatMascot) {
+ chatMascot.expandWithVoice();
+ } else {
+ navigate('/human');
+ }
+}
diff --git a/app/src/pages/__tests__/Conversations.render.test.tsx b/app/src/pages/__tests__/Conversations.render.test.tsx
index 8132ad4b08..4cc1c842d5 100644
--- a/app/src/pages/__tests__/Conversations.render.test.tsx
+++ b/app/src/pages/__tests__/Conversations.render.test.tsx
@@ -1416,35 +1416,16 @@ describe('Conversations — smoke render (#1123 welcome-lock removal)', () => {
const expandWithVoice = vi.fn();
mascotContext.current = { expandWithVoice };
try {
+ await renderSelectedConversation();
await act(async () => {
- await renderConversationsRoute('/chat', { thread: emptyThreadState });
- });
- await act(async () => {
- fireEvent.click(await screen.findByTestId('composer-human-mode'));
+ fireEvent.click(screen.getByTestId('composer-human-mode'));
});
expect(expandWithVoice).toHaveBeenCalledTimes(1);
- // It stays on the chat route: the stage opens beside the conversation.
- expect(screen.getByTestId('route-path').textContent).toMatch(/^\/chat/);
} finally {
mascotContext.current = undefined;
}
});
- it('clicking Tiny without a mascot stage falls back to the Human page', async () => {
- mascotContext.current = undefined;
- await act(async () => {
- await renderConversationsRoute('/chat', { thread: emptyThreadState });
- });
- expect(screen.getByTestId('route-path')).toHaveTextContent('/chat');
- await act(async () => {
- fireEvent.click(await screen.findByTestId('composer-human-mode'));
- });
- // `/human` is not routed in this harness, so the chat route's probe unmounts.
- await waitFor(() => {
- expect(screen.queryByTestId('route-path')).not.toBeInTheDocument();
- });
- });
-
it('releases the pending-send lock when appendMessage rejects with a generic error', async () => {
vi.mocked(threadApi.appendMessage).mockRejectedValueOnce(new Error('disk full'));
const { textarea } = await renderSelectedConversation();