|
6 | 6 |
|
7 | 7 | import { renderWithProviders } from '../../test-utils/render.js'; |
8 | 8 | import { createMockSettings } from '../../test-utils/settings.js'; |
9 | | -import { |
10 | | - makeFakeConfig, |
11 | | - CoreToolCallStatus, |
12 | | - UPDATE_TOPIC_TOOL_NAME, |
13 | | -} from '@google/gemini-cli-core'; |
| 9 | +import { makeFakeConfig, CoreToolCallStatus } from '@google/gemini-cli-core'; |
14 | 10 | import { waitFor } from '../../test-utils/async.js'; |
15 | 11 | import { MainContent } from './MainContent.js'; |
16 | 12 | import { getToolGroupBorderAppearance } from '../utils/borderStyles.js'; |
@@ -732,158 +728,6 @@ describe('MainContent', () => { |
732 | 728 | unmount(); |
733 | 729 | }); |
734 | 730 |
|
735 | | - describe('Narration Suppression', () => { |
736 | | - const settingsWithNarration = createMockSettings({ |
737 | | - merged: { |
738 | | - ui: { inlineThinkingMode: 'expanded' }, |
739 | | - experimental: { topicUpdateNarration: true }, |
740 | | - }, |
741 | | - }); |
742 | | - |
743 | | - it('suppresses thinking ALWAYS when narration is enabled', async () => { |
744 | | - mockUseSettings.mockReturnValue(settingsWithNarration); |
745 | | - const uiState = { |
746 | | - ...defaultMockUiState, |
747 | | - history: [ |
748 | | - { id: 1, type: 'user' as const, text: 'Hello' }, |
749 | | - { |
750 | | - id: 2, |
751 | | - type: 'thinking' as const, |
752 | | - thought: { |
753 | | - subject: 'Thinking...', |
754 | | - description: 'Thinking about hello', |
755 | | - }, |
756 | | - }, |
757 | | - { id: 3, type: 'gemini' as const, text: 'I am helping.' }, |
758 | | - ], |
759 | | - }; |
760 | | - |
761 | | - const { lastFrame, unmount } = await renderWithProviders( |
762 | | - <MainContent />, |
763 | | - { |
764 | | - uiState: uiState as Partial<UIState>, |
765 | | - settings: settingsWithNarration, |
766 | | - }, |
767 | | - ); |
768 | | - |
769 | | - const output = lastFrame(); |
770 | | - expect(output).not.toContain('Thinking...'); |
771 | | - expect(output).toContain('I am helping.'); |
772 | | - unmount(); |
773 | | - }); |
774 | | - |
775 | | - it('suppresses text in intermediate turns (contains non-topic tools)', async () => { |
776 | | - mockUseSettings.mockReturnValue(settingsWithNarration); |
777 | | - const uiState = { |
778 | | - ...defaultMockUiState, |
779 | | - history: [ |
780 | | - { id: 100, type: 'user' as const, text: 'Search' }, |
781 | | - { |
782 | | - id: 101, |
783 | | - type: 'gemini' as const, |
784 | | - text: 'I will now search the files.', |
785 | | - }, |
786 | | - { |
787 | | - id: 102, |
788 | | - type: 'tool_group' as const, |
789 | | - tools: [ |
790 | | - { |
791 | | - callId: '1', |
792 | | - name: 'ls', |
793 | | - args: { path: '.' }, |
794 | | - status: CoreToolCallStatus.Success, |
795 | | - }, |
796 | | - ], |
797 | | - }, |
798 | | - ], |
799 | | - }; |
800 | | - |
801 | | - const { lastFrame, unmount } = await renderWithProviders( |
802 | | - <MainContent />, |
803 | | - { |
804 | | - uiState: uiState as Partial<UIState>, |
805 | | - settings: settingsWithNarration, |
806 | | - }, |
807 | | - ); |
808 | | - |
809 | | - const output = lastFrame(); |
810 | | - expect(output).not.toContain('I will now search the files.'); |
811 | | - unmount(); |
812 | | - }); |
813 | | - |
814 | | - it('suppresses text that precedes a topic tool in the same turn', async () => { |
815 | | - mockUseSettings.mockReturnValue(settingsWithNarration); |
816 | | - const uiState = { |
817 | | - ...defaultMockUiState, |
818 | | - history: [ |
819 | | - { id: 200, type: 'user' as const, text: 'Hello' }, |
820 | | - { id: 201, type: 'gemini' as const, text: 'I will now help you.' }, |
821 | | - { |
822 | | - id: 202, |
823 | | - type: 'tool_group' as const, |
824 | | - tools: [ |
825 | | - { |
826 | | - callId: '1', |
827 | | - name: UPDATE_TOPIC_TOOL_NAME, |
828 | | - args: { title: 'Helping', summary: 'Helping the user' }, |
829 | | - status: CoreToolCallStatus.Success, |
830 | | - }, |
831 | | - ], |
832 | | - }, |
833 | | - ], |
834 | | - }; |
835 | | - |
836 | | - const { lastFrame, unmount } = await renderWithProviders( |
837 | | - <MainContent />, |
838 | | - { |
839 | | - uiState: uiState as Partial<UIState>, |
840 | | - settings: settingsWithNarration, |
841 | | - }, |
842 | | - ); |
843 | | - |
844 | | - const output = lastFrame(); |
845 | | - expect(output).not.toContain('I will now help you.'); |
846 | | - expect(output).toContain('Helping'); |
847 | | - expect(output).toContain('Helping the user'); |
848 | | - unmount(); |
849 | | - }); |
850 | | - |
851 | | - it('shows text in the final turn if it comes AFTER the topic tool', async () => { |
852 | | - mockUseSettings.mockReturnValue(settingsWithNarration); |
853 | | - const uiState = { |
854 | | - ...defaultMockUiState, |
855 | | - history: [ |
856 | | - { id: 300, type: 'user' as const, text: 'Hello' }, |
857 | | - { |
858 | | - id: 301, |
859 | | - type: 'tool_group' as const, |
860 | | - tools: [ |
861 | | - { |
862 | | - callId: '1', |
863 | | - name: UPDATE_TOPIC_TOOL_NAME, |
864 | | - args: { title: 'Final Answer', summary: 'I have finished' }, |
865 | | - status: CoreToolCallStatus.Success, |
866 | | - }, |
867 | | - ], |
868 | | - }, |
869 | | - { id: 302, type: 'gemini' as const, text: 'Here is your answer.' }, |
870 | | - ], |
871 | | - }; |
872 | | - |
873 | | - const { lastFrame, unmount } = await renderWithProviders( |
874 | | - <MainContent />, |
875 | | - { |
876 | | - uiState: uiState as Partial<UIState>, |
877 | | - settings: settingsWithNarration, |
878 | | - }, |
879 | | - ); |
880 | | - |
881 | | - const output = lastFrame(); |
882 | | - expect(output).toContain('Here is your answer.'); |
883 | | - unmount(); |
884 | | - }); |
885 | | - }); |
886 | | - |
887 | 731 | it('renders multiple thinking messages sequentially correctly', async () => { |
888 | 732 | mockUseSettings.mockReturnValue({ |
889 | 733 | merged: { |
|
0 commit comments