@google/gemini-cli 0.12.0-preview.4 → 0.13.0-nightly.20251031.c89bc30d
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/google-gemini-cli-0.13.0-nightly.20251029.cca41edc.tgz +0 -0
- package/dist/package.json +2 -2
- package/dist/src/commands/extensions/install.js +2 -2
- package/dist/src/commands/extensions/install.js.map +1 -1
- package/dist/src/commands/extensions/install.test.js +27 -16
- package/dist/src/commands/extensions/install.test.js.map +1 -1
- package/dist/src/commands/extensions/link.js +2 -2
- package/dist/src/commands/extensions/link.js.map +1 -1
- package/dist/src/commands/extensions/update.js +3 -2
- package/dist/src/commands/extensions/update.js.map +1 -1
- package/dist/src/commands/extensions/validate.d.ts +12 -0
- package/dist/src/commands/extensions/validate.js +83 -0
- package/dist/src/commands/extensions/validate.js.map +1 -0
- package/dist/src/commands/extensions/validate.test.d.ts +6 -0
- package/dist/src/commands/extensions/validate.test.js +93 -0
- package/dist/src/commands/extensions/validate.test.js.map +1 -0
- package/dist/src/commands/extensions.js +2 -0
- package/dist/src/commands/extensions.js.map +1 -1
- package/dist/src/config/auth.js +0 -5
- package/dist/src/config/auth.js.map +1 -1
- package/dist/src/config/auth.test.js +1 -3
- package/dist/src/config/auth.test.js.map +1 -1
- package/dist/src/config/config.js +2 -1
- package/dist/src/config/config.js.map +1 -1
- package/dist/src/config/config.test.js +6 -10
- package/dist/src/config/config.test.js.map +1 -1
- package/dist/src/config/extensions/update.d.ts +2 -2
- package/dist/src/config/extensions/update.js +28 -22
- package/dist/src/config/extensions/update.js.map +1 -1
- package/dist/src/config/sandboxConfig.d.ts +1 -1
- package/dist/src/config/sandboxConfig.js +6 -3
- package/dist/src/config/sandboxConfig.js.map +1 -1
- package/dist/src/config/settings.js +2 -2
- package/dist/src/config/settings.js.map +1 -1
- package/dist/src/config/settings.test.js +13 -53
- package/dist/src/config/settings.test.js.map +1 -1
- package/dist/src/config/settingsSchema.d.ts +25 -7
- package/dist/src/config/settingsSchema.js +24 -6
- package/dist/src/config/settingsSchema.js.map +1 -1
- package/dist/src/config/settingsSchema.test.js +2 -0
- package/dist/src/config/settingsSchema.test.js.map +1 -1
- package/dist/src/gemini.js +8 -1
- package/dist/src/gemini.js.map +1 -1
- package/dist/src/gemini.test.js +1 -0
- package/dist/src/gemini.test.js.map +1 -1
- package/dist/src/generated/git-commit.d.ts +2 -2
- package/dist/src/generated/git-commit.js +2 -2
- package/dist/src/generated/git-commit.js.map +1 -1
- package/dist/src/nonInteractiveCli.d.ts +9 -1
- package/dist/src/nonInteractiveCli.js +16 -1
- package/dist/src/nonInteractiveCli.js.map +1 -1
- package/dist/src/nonInteractiveCli.test.js +209 -103
- package/dist/src/nonInteractiveCli.test.js.map +1 -1
- package/dist/src/test-utils/async.d.ts +9 -0
- package/dist/src/test-utils/async.js +29 -0
- package/dist/src/test-utils/async.js.map +1 -0
- package/dist/src/test-utils/render.d.ts +2 -1
- package/dist/src/test-utils/render.js +23 -1
- package/dist/src/test-utils/render.js.map +1 -1
- package/dist/src/test-utils/render.test.js +29 -4
- package/dist/src/test-utils/render.test.js.map +1 -1
- package/dist/src/ui/App.test.js +1 -1
- package/dist/src/ui/App.test.js.map +1 -1
- package/dist/src/ui/AppContainer.js +33 -4
- package/dist/src/ui/AppContainer.js.map +1 -1
- package/dist/src/ui/AppContainer.test.js +205 -99
- package/dist/src/ui/AppContainer.test.js.map +1 -1
- package/dist/src/ui/auth/ApiAuthDialog.d.ts +14 -0
- package/dist/src/ui/auth/ApiAuthDialog.js +26 -0
- package/dist/src/ui/auth/ApiAuthDialog.js.map +1 -0
- package/dist/src/ui/auth/ApiAuthDialog.test.d.ts +6 -0
- package/dist/src/ui/auth/ApiAuthDialog.test.js +91 -0
- package/dist/src/ui/auth/ApiAuthDialog.test.js.map +1 -0
- package/dist/src/ui/auth/AuthDialog.js +7 -3
- package/dist/src/ui/auth/AuthDialog.js.map +1 -1
- package/dist/src/ui/auth/AuthDialog.test.js +1 -1
- package/dist/src/ui/auth/AuthDialog.test.js.map +1 -1
- package/dist/src/ui/auth/useAuth.d.ts +2 -0
- package/dist/src/ui/auth/useAuth.js +31 -2
- package/dist/src/ui/auth/useAuth.js.map +1 -1
- package/dist/src/ui/components/AnsiOutput.test.js +1 -1
- package/dist/src/ui/components/AnsiOutput.test.js.map +1 -1
- package/dist/src/ui/components/Composer.test.js +1 -1
- package/dist/src/ui/components/Composer.test.js.map +1 -1
- package/dist/src/ui/components/ConsentPrompt.test.js +18 -8
- package/dist/src/ui/components/ConsentPrompt.test.js.map +1 -1
- package/dist/src/ui/components/ContextSummaryDisplay.test.js +11 -6
- package/dist/src/ui/components/ContextSummaryDisplay.test.js.map +1 -1
- package/dist/src/ui/components/DialogManager.js +4 -0
- package/dist/src/ui/components/DialogManager.js.map +1 -1
- package/dist/src/ui/components/FolderTrustDialog.test.js +4 -3
- package/dist/src/ui/components/FolderTrustDialog.test.js.map +1 -1
- package/dist/src/ui/components/Footer.js +3 -2
- package/dist/src/ui/components/Footer.js.map +1 -1
- package/dist/src/ui/components/Footer.test.js +59 -0
- package/dist/src/ui/components/Footer.test.js.map +1 -1
- package/dist/src/ui/components/Header.test.js +9 -5
- package/dist/src/ui/components/Header.test.js.map +1 -1
- package/dist/src/ui/components/Help.test.js +5 -3
- package/dist/src/ui/components/Help.test.js.map +1 -1
- package/dist/src/ui/components/InputPrompt.test.js +139 -111
- package/dist/src/ui/components/InputPrompt.test.js.map +1 -1
- package/dist/src/ui/components/LoadingIndicator.test.js +27 -14
- package/dist/src/ui/components/LoadingIndicator.test.js.map +1 -1
- package/dist/src/ui/components/ModelDialog.test.js +20 -10
- package/dist/src/ui/components/ModelDialog.test.js.map +1 -1
- package/dist/src/ui/components/ModelStatsDisplay.test.js +1 -1
- package/dist/src/ui/components/ModelStatsDisplay.test.js.map +1 -1
- package/dist/src/ui/components/PermissionsModifyTrustDialog.test.js +11 -10
- package/dist/src/ui/components/PermissionsModifyTrustDialog.test.js.map +1 -1
- package/dist/src/ui/components/PrepareLabel.test.js +13 -7
- package/dist/src/ui/components/PrepareLabel.test.js.map +1 -1
- package/dist/src/ui/components/ProQuotaDialog.test.js +14 -6
- package/dist/src/ui/components/ProQuotaDialog.test.js.map +1 -1
- package/dist/src/ui/components/QueuedMessageDisplay.test.js +11 -6
- package/dist/src/ui/components/QueuedMessageDisplay.test.js.map +1 -1
- package/dist/src/ui/components/SessionSummaryDisplay.test.js +1 -1
- package/dist/src/ui/components/SessionSummaryDisplay.test.js.map +1 -1
- package/dist/src/ui/components/SettingsDialog.test.js +438 -512
- package/dist/src/ui/components/SettingsDialog.test.js.map +1 -1
- package/dist/src/ui/components/StatsDisplay.test.js +1 -1
- package/dist/src/ui/components/StatsDisplay.test.js.map +1 -1
- package/dist/src/ui/components/ThemeDialog.test.js +3 -2
- package/dist/src/ui/components/ThemeDialog.test.js.map +1 -1
- package/dist/src/ui/components/ToolStatsDisplay.test.js +1 -1
- package/dist/src/ui/components/ToolStatsDisplay.test.js.map +1 -1
- package/dist/src/ui/components/messages/CompressionMessage.test.js +25 -17
- package/dist/src/ui/components/messages/CompressionMessage.test.js.map +1 -1
- package/dist/src/ui/components/messages/DiffRenderer.test.js +1 -1
- package/dist/src/ui/components/messages/DiffRenderer.test.js.map +1 -1
- package/dist/src/ui/components/messages/Todo.js +27 -5
- package/dist/src/ui/components/messages/Todo.js.map +1 -1
- package/dist/src/ui/components/messages/Todo.test.js +20 -8
- package/dist/src/ui/components/messages/Todo.test.js.map +1 -1
- package/dist/src/ui/components/messages/ToolGroupMessage.test.js +29 -15
- package/dist/src/ui/components/messages/ToolGroupMessage.test.js.map +1 -1
- package/dist/src/ui/components/shared/BaseSelectionList.test.js +12 -11
- package/dist/src/ui/components/shared/BaseSelectionList.test.js.map +1 -1
- package/dist/src/ui/components/shared/MaxSizedBox.test.js +43 -22
- package/dist/src/ui/components/shared/MaxSizedBox.test.js.map +1 -1
- package/dist/src/ui/components/shared/TextInput.d.ts +15 -0
- package/dist/src/ui/components/shared/TextInput.js +38 -0
- package/dist/src/ui/components/shared/TextInput.js.map +1 -0
- package/dist/src/ui/components/shared/TextInput.test.d.ts +6 -0
- package/dist/src/ui/components/shared/TextInput.test.js +242 -0
- package/dist/src/ui/components/shared/TextInput.test.js.map +1 -0
- package/dist/src/ui/components/shared/text-buffer.d.ts +8 -2
- package/dist/src/ui/components/shared/text-buffer.js +28 -13
- package/dist/src/ui/components/shared/text-buffer.js.map +1 -1
- package/dist/src/ui/components/shared/text-buffer.test.js +137 -0
- package/dist/src/ui/components/shared/text-buffer.test.js.map +1 -1
- package/dist/src/ui/components/views/ChatList.test.js +7 -4
- package/dist/src/ui/components/views/ChatList.test.js.map +1 -1
- package/dist/src/ui/components/views/ExtensionsList.js +1 -0
- package/dist/src/ui/components/views/ExtensionsList.js.map +1 -1
- package/dist/src/ui/components/views/ExtensionsList.test.js +13 -5
- package/dist/src/ui/components/views/ExtensionsList.test.js.map +1 -1
- package/dist/src/ui/components/views/McpStatus.test.js +23 -12
- package/dist/src/ui/components/views/McpStatus.test.js.map +1 -1
- package/dist/src/ui/contexts/KeypressContext.test.js +132 -252
- package/dist/src/ui/contexts/KeypressContext.test.js.map +1 -1
- package/dist/src/ui/contexts/SessionContext.test.js +9 -5
- package/dist/src/ui/contexts/SessionContext.test.js.map +1 -1
- package/dist/src/ui/contexts/UIActionsContext.d.ts +2 -0
- package/dist/src/ui/contexts/UIActionsContext.js.map +1 -1
- package/dist/src/ui/contexts/UIStateContext.d.ts +2 -0
- package/dist/src/ui/contexts/UIStateContext.js.map +1 -1
- package/dist/src/ui/hooks/atCommandProcessor.js +29 -7
- package/dist/src/ui/hooks/atCommandProcessor.js.map +1 -1
- package/dist/src/ui/hooks/atCommandProcessor.test.js +163 -64
- package/dist/src/ui/hooks/atCommandProcessor.test.js.map +1 -1
- package/dist/src/ui/hooks/shellCommandProcessor.test.js +47 -34
- package/dist/src/ui/hooks/shellCommandProcessor.test.js.map +1 -1
- package/dist/src/ui/hooks/slashCommandProcessor.test.js +141 -104
- package/dist/src/ui/hooks/slashCommandProcessor.test.js.map +1 -1
- package/dist/src/ui/hooks/useAtCompletion.test.js +23 -21
- package/dist/src/ui/hooks/useAtCompletion.test.js.map +1 -1
- package/dist/src/ui/hooks/useCommandCompletion.test.js +16 -15
- package/dist/src/ui/hooks/useCommandCompletion.test.js.map +1 -1
- package/dist/src/ui/hooks/useConsoleMessages.test.js +1 -1
- package/dist/src/ui/hooks/useConsoleMessages.test.js.map +1 -1
- package/dist/src/ui/hooks/useEditorSettings.test.js +1 -1
- package/dist/src/ui/hooks/useEditorSettings.test.js.map +1 -1
- package/dist/src/ui/hooks/useExtensionUpdates.d.ts +1 -1
- package/dist/src/ui/hooks/useExtensionUpdates.js +9 -3
- package/dist/src/ui/hooks/useExtensionUpdates.js.map +1 -1
- package/dist/src/ui/hooks/useExtensionUpdates.test.js +10 -9
- package/dist/src/ui/hooks/useExtensionUpdates.test.js.map +1 -1
- package/dist/src/ui/hooks/useFocus.test.js +1 -1
- package/dist/src/ui/hooks/useFocus.test.js.map +1 -1
- package/dist/src/ui/hooks/useFolderTrust.test.js +7 -6
- package/dist/src/ui/hooks/useFolderTrust.test.js.map +1 -1
- package/dist/src/ui/hooks/useGeminiStream.test.js +39 -38
- package/dist/src/ui/hooks/useGeminiStream.test.js.map +1 -1
- package/dist/src/ui/hooks/useGitBranchName.test.js +5 -4
- package/dist/src/ui/hooks/useGitBranchName.test.js.map +1 -1
- package/dist/src/ui/hooks/useIdeTrustListener.test.js +25 -11
- package/dist/src/ui/hooks/useIdeTrustListener.test.js.map +1 -1
- package/dist/src/ui/hooks/useKeypress.test.js +1 -1
- package/dist/src/ui/hooks/useKeypress.test.js.map +1 -1
- package/dist/src/ui/hooks/useLoadingIndicator.test.js +1 -1
- package/dist/src/ui/hooks/useLoadingIndicator.test.js.map +1 -1
- package/dist/src/ui/hooks/useMemoryMonitor.test.js +1 -1
- package/dist/src/ui/hooks/useMemoryMonitor.test.js.map +1 -1
- package/dist/src/ui/hooks/useMessageQueue.test.js +5 -4
- package/dist/src/ui/hooks/useMessageQueue.test.js.map +1 -1
- package/dist/src/ui/hooks/useModelCommand.test.js +7 -4
- package/dist/src/ui/hooks/useModelCommand.test.js.map +1 -1
- package/dist/src/ui/hooks/usePhraseCycler.test.js +46 -16
- package/dist/src/ui/hooks/usePhraseCycler.test.js.map +1 -1
- package/dist/src/ui/hooks/usePrivacySettings.test.js +11 -7
- package/dist/src/ui/hooks/usePrivacySettings.test.js.map +1 -1
- package/dist/src/ui/hooks/useQuotaAndFallback.test.js +28 -14
- package/dist/src/ui/hooks/useQuotaAndFallback.test.js.map +1 -1
- package/dist/src/ui/hooks/useSelectionList.test.js +116 -109
- package/dist/src/ui/hooks/useSelectionList.test.js.map +1 -1
- package/dist/src/ui/hooks/useShellHistory.test.js +25 -17
- package/dist/src/ui/hooks/useShellHistory.test.js.map +1 -1
- package/dist/src/ui/hooks/useSlashCompletion.js +18 -7
- package/dist/src/ui/hooks/useSlashCompletion.js.map +1 -1
- package/dist/src/ui/hooks/useSlashCompletion.test.js +244 -111
- package/dist/src/ui/hooks/useSlashCompletion.test.js.map +1 -1
- package/dist/src/ui/hooks/useTimer.test.js +1 -1
- package/dist/src/ui/hooks/useTimer.test.js.map +1 -1
- package/dist/src/ui/hooks/useToolScheduler.test.js +6 -2
- package/dist/src/ui/hooks/useToolScheduler.test.js.map +1 -1
- package/dist/src/ui/hooks/vim.test.js +6 -21
- package/dist/src/ui/hooks/vim.test.js.map +1 -1
- package/dist/src/ui/state/extensions.d.ts +1 -0
- package/dist/src/ui/state/extensions.js +1 -0
- package/dist/src/ui/state/extensions.js.map +1 -1
- package/dist/src/ui/types.d.ts +1 -0
- package/dist/src/ui/types.js +2 -0
- package/dist/src/ui/types.js.map +1 -1
- package/dist/src/ui/utils/clipboardUtils.js +2 -2
- package/dist/src/ui/utils/clipboardUtils.js.map +1 -1
- package/dist/src/ui/utils/updateCheck.js +6 -3
- package/dist/src/ui/utils/updateCheck.js.map +1 -1
- package/dist/src/ui/utils/updateCheck.test.js +5 -1
- package/dist/src/ui/utils/updateCheck.test.js.map +1 -1
- package/dist/src/utils/commentJson.js +2 -2
- package/dist/src/utils/commentJson.js.map +1 -1
- package/dist/src/utils/commentJson.test.js +7 -6
- package/dist/src/utils/commentJson.test.js.map +1 -1
- package/dist/src/utils/version.js +6 -2
- package/dist/src/utils/version.js.map +1 -1
- package/dist/src/zed-integration/acp.js +2 -1
- package/dist/src/zed-integration/acp.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/dist/google-gemini-cli-0.12.0-preview.3.tgz +0 -0
- package/dist/src/utils/package.d.ts +0 -12
- package/dist/src/utils/package.js +0 -24
- package/dist/src/utils/package.js.map +0 -1
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
import { describe, it, expect, vi, beforeEach } from 'vitest';
|
|
7
7
|
import { act } from 'react';
|
|
8
8
|
import { renderHook } from '../../test-utils/render.js';
|
|
9
|
+
import { waitFor } from '../../test-utils/async.js';
|
|
9
10
|
import { useGeminiStream } from './useGeminiStream.js';
|
|
10
11
|
import { useKeypress } from './useKeypress.js';
|
|
11
12
|
import * as atCommandProcessor from './atCommandProcessor.js';
|
|
@@ -379,7 +380,7 @@ describe('useGeminiStream', () => {
|
|
|
379
380
|
await capturedOnComplete(completedToolCalls);
|
|
380
381
|
}
|
|
381
382
|
});
|
|
382
|
-
await
|
|
383
|
+
await waitFor(() => {
|
|
383
384
|
expect(mockMarkToolsAsSubmitted).toHaveBeenCalledTimes(1);
|
|
384
385
|
expect(mockSendMessageStream).toHaveBeenCalledTimes(1);
|
|
385
386
|
});
|
|
@@ -428,7 +429,7 @@ describe('useGeminiStream', () => {
|
|
|
428
429
|
await capturedOnComplete(cancelledToolCalls);
|
|
429
430
|
}
|
|
430
431
|
});
|
|
431
|
-
await
|
|
432
|
+
await waitFor(() => {
|
|
432
433
|
expect(mockMarkToolsAsSubmitted).toHaveBeenCalledWith(['1']);
|
|
433
434
|
expect(client.addHistory).toHaveBeenCalledWith({
|
|
434
435
|
role: 'user',
|
|
@@ -511,7 +512,7 @@ describe('useGeminiStream', () => {
|
|
|
511
512
|
await capturedOnComplete(allCancelledTools);
|
|
512
513
|
}
|
|
513
514
|
});
|
|
514
|
-
await
|
|
515
|
+
await waitFor(() => {
|
|
515
516
|
// The tools should be marked as submitted locally
|
|
516
517
|
expect(mockMarkToolsAsSubmitted).toHaveBeenCalledWith([
|
|
517
518
|
'cancel-1',
|
|
@@ -611,7 +612,7 @@ describe('useGeminiStream', () => {
|
|
|
611
612
|
}
|
|
612
613
|
});
|
|
613
614
|
// 5. Wait for submitQuery to be called
|
|
614
|
-
await
|
|
615
|
+
await waitFor(() => {
|
|
615
616
|
expect(mockSendMessageStream).toHaveBeenCalledWith(toolCallResponseParts, expect.any(AbortSignal), 'prompt-id-4');
|
|
616
617
|
});
|
|
617
618
|
// 6. After submission, the state should remain Responding until the stream completes.
|
|
@@ -649,13 +650,13 @@ describe('useGeminiStream', () => {
|
|
|
649
650
|
result.current.submitQuery('test query');
|
|
650
651
|
});
|
|
651
652
|
// Wait for the first part of the response
|
|
652
|
-
await
|
|
653
|
+
await waitFor(() => {
|
|
653
654
|
expect(result.current.streamingState).toBe(StreamingState.Responding);
|
|
654
655
|
});
|
|
655
656
|
// Simulate escape key press
|
|
656
657
|
simulateEscapeKeyPress();
|
|
657
658
|
// Verify cancellation message is added
|
|
658
|
-
await
|
|
659
|
+
await waitFor(() => {
|
|
659
660
|
expect(mockAddItem).toHaveBeenCalledWith({
|
|
660
661
|
type: MessageType.INFO,
|
|
661
662
|
text: 'Request cancelled.',
|
|
@@ -721,17 +722,17 @@ describe('useGeminiStream', () => {
|
|
|
721
722
|
await act(async () => {
|
|
722
723
|
result.current.submitQuery('long running query');
|
|
723
724
|
});
|
|
724
|
-
await
|
|
725
|
+
await waitFor(() => {
|
|
725
726
|
expect(result.current.streamingState).toBe(StreamingState.Responding);
|
|
726
727
|
});
|
|
727
728
|
// Cancel the request
|
|
728
729
|
simulateEscapeKeyPress();
|
|
729
730
|
// Allow the stream to continue
|
|
730
|
-
act(() => {
|
|
731
|
+
await act(async () => {
|
|
731
732
|
continueStream();
|
|
733
|
+
// Wait a bit to see if the second part is processed
|
|
734
|
+
await new Promise((resolve) => setTimeout(resolve, 50));
|
|
732
735
|
});
|
|
733
|
-
// Wait a bit to see if the second part is processed
|
|
734
|
-
await new Promise((resolve) => setTimeout(resolve, 50));
|
|
735
736
|
// The text should not have been updated with " Canceled"
|
|
736
737
|
const lastCall = mockAddItem.mock.calls.find((call) => call[0].type === 'gemini');
|
|
737
738
|
expect(lastCall?.[0].text).toBe('Initial');
|
|
@@ -809,7 +810,7 @@ describe('useGeminiStream', () => {
|
|
|
809
810
|
// The imperative cancel function should be called on the scheduler
|
|
810
811
|
expect(mockCancelAllToolCalls).toHaveBeenCalled();
|
|
811
812
|
// A cancellation message should be added to history
|
|
812
|
-
await
|
|
813
|
+
await waitFor(() => {
|
|
813
814
|
expect(mockAddItem).toHaveBeenCalledWith(expect.objectContaining({
|
|
814
815
|
text: 'Request cancelled.',
|
|
815
816
|
}), expect.any(Number));
|
|
@@ -830,7 +831,7 @@ describe('useGeminiStream', () => {
|
|
|
830
831
|
await act(async () => {
|
|
831
832
|
await result.current.submitQuery('/memory add "test fact"');
|
|
832
833
|
});
|
|
833
|
-
await
|
|
834
|
+
await waitFor(() => {
|
|
834
835
|
expect(mockScheduleToolCalls).toHaveBeenCalledWith([
|
|
835
836
|
expect.objectContaining({
|
|
836
837
|
name: 'save_memory',
|
|
@@ -850,7 +851,7 @@ describe('useGeminiStream', () => {
|
|
|
850
851
|
await act(async () => {
|
|
851
852
|
await result.current.submitQuery('/help');
|
|
852
853
|
});
|
|
853
|
-
await
|
|
854
|
+
await waitFor(() => {
|
|
854
855
|
expect(mockHandleSlashCommand).toHaveBeenCalledWith('/help');
|
|
855
856
|
expect(mockScheduleToolCalls).not.toHaveBeenCalled();
|
|
856
857
|
expect(mockSendMessageStream).not.toHaveBeenCalled(); // No LLM call made
|
|
@@ -866,7 +867,7 @@ describe('useGeminiStream', () => {
|
|
|
866
867
|
await act(async () => {
|
|
867
868
|
await result.current.submitQuery('/my-custom-command');
|
|
868
869
|
});
|
|
869
|
-
await
|
|
870
|
+
await waitFor(() => {
|
|
870
871
|
expect(mockHandleSlashCommand).toHaveBeenCalledWith('/my-custom-command');
|
|
871
872
|
expect(localMockSendMessageStream).not.toHaveBeenCalledWith('/my-custom-command', expect.anything(), expect.anything());
|
|
872
873
|
expect(localMockSendMessageStream).toHaveBeenCalledWith('This is the actual prompt from the command file.', expect.any(AbortSignal), expect.any(String));
|
|
@@ -883,7 +884,7 @@ describe('useGeminiStream', () => {
|
|
|
883
884
|
await act(async () => {
|
|
884
885
|
await result.current.submitQuery('/emptycmd');
|
|
885
886
|
});
|
|
886
|
-
await
|
|
887
|
+
await waitFor(() => {
|
|
887
888
|
expect(mockHandleSlashCommand).toHaveBeenCalledWith('/emptycmd');
|
|
888
889
|
expect(localMockSendMessageStream).toHaveBeenCalledWith('', expect.any(AbortSignal), expect.any(String));
|
|
889
890
|
});
|
|
@@ -893,7 +894,7 @@ describe('useGeminiStream', () => {
|
|
|
893
894
|
await act(async () => {
|
|
894
895
|
await result.current.submitQuery('// This is a line comment');
|
|
895
896
|
});
|
|
896
|
-
await
|
|
897
|
+
await waitFor(() => {
|
|
897
898
|
expect(mockHandleSlashCommand).not.toHaveBeenCalled();
|
|
898
899
|
expect(localMockSendMessageStream).toHaveBeenCalledWith('// This is a line comment', expect.any(AbortSignal), expect.any(String));
|
|
899
900
|
});
|
|
@@ -903,7 +904,7 @@ describe('useGeminiStream', () => {
|
|
|
903
904
|
await act(async () => {
|
|
904
905
|
await result.current.submitQuery('/* This is a block comment */');
|
|
905
906
|
});
|
|
906
|
-
await
|
|
907
|
+
await waitFor(() => {
|
|
907
908
|
expect(mockHandleSlashCommand).not.toHaveBeenCalled();
|
|
908
909
|
expect(localMockSendMessageStream).toHaveBeenCalledWith('/* This is a block comment */', expect.any(AbortSignal), expect.any(String));
|
|
909
910
|
});
|
|
@@ -913,7 +914,7 @@ describe('useGeminiStream', () => {
|
|
|
913
914
|
await act(async () => {
|
|
914
915
|
await result.current.submitQuery('/about');
|
|
915
916
|
});
|
|
916
|
-
await
|
|
917
|
+
await waitFor(() => {
|
|
917
918
|
expect(mockHandleSlashCommand).not.toHaveBeenCalled();
|
|
918
919
|
});
|
|
919
920
|
});
|
|
@@ -961,7 +962,7 @@ describe('useGeminiStream', () => {
|
|
|
961
962
|
await capturedOnComplete([completedToolCall]);
|
|
962
963
|
}
|
|
963
964
|
});
|
|
964
|
-
await
|
|
965
|
+
await waitFor(() => {
|
|
965
966
|
expect(mockPerformMemoryRefresh).toHaveBeenCalledTimes(1);
|
|
966
967
|
});
|
|
967
968
|
});
|
|
@@ -989,7 +990,7 @@ describe('useGeminiStream', () => {
|
|
|
989
990
|
await result.current.submitQuery('test query');
|
|
990
991
|
});
|
|
991
992
|
// 3. Assertion
|
|
992
|
-
await
|
|
993
|
+
await waitFor(() => {
|
|
993
994
|
expect(mockParseAndFormatApiError).toHaveBeenCalledWith('Rate limit exceeded', mockAuthType, undefined, 'gemini-2.5-pro', 'gemini-2.5-flash');
|
|
994
995
|
});
|
|
995
996
|
});
|
|
@@ -1444,7 +1445,7 @@ describe('useGeminiStream', () => {
|
|
|
1444
1445
|
await result.current.submitQuery('Generate long text');
|
|
1445
1446
|
});
|
|
1446
1447
|
// Check that the info message was added
|
|
1447
|
-
await
|
|
1448
|
+
await waitFor(() => {
|
|
1448
1449
|
expect(mockAddItem).toHaveBeenCalledWith({
|
|
1449
1450
|
type: 'info',
|
|
1450
1451
|
text: '⚠️ Response truncated due to token limits.',
|
|
@@ -1473,7 +1474,7 @@ describe('useGeminiStream', () => {
|
|
|
1473
1474
|
await result.current.submitQuery('Test overflow');
|
|
1474
1475
|
});
|
|
1475
1476
|
// Check that the message was added without suggestion
|
|
1476
|
-
await
|
|
1477
|
+
await waitFor(() => {
|
|
1477
1478
|
expect(mockAddItem).toHaveBeenCalledWith({
|
|
1478
1479
|
type: 'info',
|
|
1479
1480
|
text: `Sending this message (20 tokens) might exceed the remaining context window limit (80 tokens).`,
|
|
@@ -1498,7 +1499,7 @@ describe('useGeminiStream', () => {
|
|
|
1498
1499
|
await result.current.submitQuery('Test overflow');
|
|
1499
1500
|
});
|
|
1500
1501
|
// Check that the message was added with suggestion
|
|
1501
|
-
await
|
|
1502
|
+
await waitFor(() => {
|
|
1502
1503
|
expect(mockAddItem).toHaveBeenCalledWith({
|
|
1503
1504
|
type: 'info',
|
|
1504
1505
|
text: `Sending this message (30 tokens) might exceed the remaining context window limit (70 tokens). Please try reducing the size of your message or use the \`/compress\` command to compress the chat history.`,
|
|
@@ -1524,7 +1525,7 @@ describe('useGeminiStream', () => {
|
|
|
1524
1525
|
await result.current.submitQuery('Test overflow');
|
|
1525
1526
|
});
|
|
1526
1527
|
// Check that onCancelSubmit was called
|
|
1527
|
-
await
|
|
1528
|
+
await waitFor(() => {
|
|
1528
1529
|
expect(onCancelSubmitSpy).toHaveBeenCalled();
|
|
1529
1530
|
});
|
|
1530
1531
|
});
|
|
@@ -1634,7 +1635,7 @@ describe('useGeminiStream', () => {
|
|
|
1634
1635
|
await act(async () => {
|
|
1635
1636
|
await result.current.submitQuery(`Test ${reason}`);
|
|
1636
1637
|
});
|
|
1637
|
-
await
|
|
1638
|
+
await waitFor(() => {
|
|
1638
1639
|
expect(mockAddItem).toHaveBeenCalledWith({
|
|
1639
1640
|
type: 'info',
|
|
1640
1641
|
text: message,
|
|
@@ -1707,7 +1708,7 @@ describe('useGeminiStream', () => {
|
|
|
1707
1708
|
await result.current.submitQuery('First query');
|
|
1708
1709
|
});
|
|
1709
1710
|
// Wait for the first response to complete
|
|
1710
|
-
await
|
|
1711
|
+
await waitFor(() => {
|
|
1711
1712
|
expect(mockAddItem).toHaveBeenCalledWith(expect.objectContaining({
|
|
1712
1713
|
type: 'gemini',
|
|
1713
1714
|
text: 'Some response content',
|
|
@@ -1732,7 +1733,7 @@ describe('useGeminiStream', () => {
|
|
|
1732
1733
|
// We can verify this by checking that the LoadingIndicator would not show the previous thought
|
|
1733
1734
|
// The actual thought state is internal to the hook, but we can verify the behavior
|
|
1734
1735
|
// by ensuring the second response doesn't show the previous thought
|
|
1735
|
-
await
|
|
1736
|
+
await waitFor(() => {
|
|
1736
1737
|
expect(mockAddItem).toHaveBeenCalledWith(expect.objectContaining({
|
|
1737
1738
|
type: 'gemini',
|
|
1738
1739
|
text: 'New response content',
|
|
@@ -1791,7 +1792,7 @@ describe('useGeminiStream', () => {
|
|
|
1791
1792
|
await result.current.submitQuery('Test query');
|
|
1792
1793
|
});
|
|
1793
1794
|
// Verify cancellation message was added
|
|
1794
|
-
await
|
|
1795
|
+
await waitFor(() => {
|
|
1795
1796
|
expect(mockAddItem).toHaveBeenCalledWith(expect.objectContaining({
|
|
1796
1797
|
type: 'info',
|
|
1797
1798
|
text: 'User cancelled the request.',
|
|
@@ -1818,7 +1819,7 @@ describe('useGeminiStream', () => {
|
|
|
1818
1819
|
await result.current.submitQuery('Test query');
|
|
1819
1820
|
});
|
|
1820
1821
|
// Verify error message was added
|
|
1821
|
-
await
|
|
1822
|
+
await waitFor(() => {
|
|
1822
1823
|
expect(mockAddItem).toHaveBeenCalledWith(expect.objectContaining({
|
|
1823
1824
|
type: 'error',
|
|
1824
1825
|
}), expect.any(Number));
|
|
@@ -1852,7 +1853,7 @@ describe('useGeminiStream', () => {
|
|
|
1852
1853
|
await act(async () => {
|
|
1853
1854
|
await result.current.submitQuery('test query');
|
|
1854
1855
|
});
|
|
1855
|
-
await
|
|
1856
|
+
await waitFor(() => {
|
|
1856
1857
|
expect(result.current.loopDetectionConfirmationRequest).not.toBeNull();
|
|
1857
1858
|
expect(typeof result.current.loopDetectionConfirmationRequest?.onComplete).toBe('function');
|
|
1858
1859
|
});
|
|
@@ -1888,7 +1889,7 @@ describe('useGeminiStream', () => {
|
|
|
1888
1889
|
await result.current.submitQuery('test query');
|
|
1889
1890
|
});
|
|
1890
1891
|
// Wait for confirmation request to be set
|
|
1891
|
-
await
|
|
1892
|
+
await waitFor(() => {
|
|
1892
1893
|
expect(result.current.loopDetectionConfirmationRequest).not.toBeNull();
|
|
1893
1894
|
});
|
|
1894
1895
|
// Simulate user selecting "disable"
|
|
@@ -1907,7 +1908,7 @@ describe('useGeminiStream', () => {
|
|
|
1907
1908
|
text: 'Loop detection has been disabled for this session. Retrying request...',
|
|
1908
1909
|
}, expect.any(Number));
|
|
1909
1910
|
// Verify that the request was retried
|
|
1910
|
-
await
|
|
1911
|
+
await waitFor(() => {
|
|
1911
1912
|
expect(mockSendMessageStream).toHaveBeenCalledTimes(2);
|
|
1912
1913
|
expect(mockSendMessageStream).toHaveBeenNthCalledWith(2, 'test query', expect.any(AbortSignal), expect.any(String));
|
|
1913
1914
|
});
|
|
@@ -1931,7 +1932,7 @@ describe('useGeminiStream', () => {
|
|
|
1931
1932
|
await result.current.submitQuery('test query');
|
|
1932
1933
|
});
|
|
1933
1934
|
// Wait for confirmation request to be set
|
|
1934
|
-
await
|
|
1935
|
+
await waitFor(() => {
|
|
1935
1936
|
expect(result.current.loopDetectionConfirmationRequest).not.toBeNull();
|
|
1936
1937
|
});
|
|
1937
1938
|
// Simulate user selecting "keep"
|
|
@@ -1964,7 +1965,7 @@ describe('useGeminiStream', () => {
|
|
|
1964
1965
|
await act(async () => {
|
|
1965
1966
|
await result.current.submitQuery('first query');
|
|
1966
1967
|
});
|
|
1967
|
-
await
|
|
1968
|
+
await waitFor(() => {
|
|
1968
1969
|
expect(result.current.loopDetectionConfirmationRequest).not.toBeNull();
|
|
1969
1970
|
});
|
|
1970
1971
|
// Simulate user selecting "keep" for first request
|
|
@@ -2000,7 +2001,7 @@ describe('useGeminiStream', () => {
|
|
|
2000
2001
|
await act(async () => {
|
|
2001
2002
|
await result.current.submitQuery('second query');
|
|
2002
2003
|
});
|
|
2003
|
-
await
|
|
2004
|
+
await waitFor(() => {
|
|
2004
2005
|
expect(result.current.loopDetectionConfirmationRequest).not.toBeNull();
|
|
2005
2006
|
});
|
|
2006
2007
|
// Simulate user selecting "disable" for second request
|
|
@@ -2016,7 +2017,7 @@ describe('useGeminiStream', () => {
|
|
|
2016
2017
|
text: 'Loop detection has been disabled for this session. Retrying request...',
|
|
2017
2018
|
}, expect.any(Number));
|
|
2018
2019
|
// Verify that the request was retried
|
|
2019
|
-
await
|
|
2020
|
+
await waitFor(() => {
|
|
2020
2021
|
expect(mockSendMessageStream).toHaveBeenCalledTimes(3); // 1st query, 2nd query, retry of 2nd query
|
|
2021
2022
|
expect(mockSendMessageStream).toHaveBeenNthCalledWith(3, 'second query', expect.any(AbortSignal), expect.any(String));
|
|
2022
2023
|
});
|
|
@@ -2036,14 +2037,14 @@ describe('useGeminiStream', () => {
|
|
|
2036
2037
|
await result.current.submitQuery('test query');
|
|
2037
2038
|
});
|
|
2038
2039
|
// Verify that the content was added to history before the loop detection dialog
|
|
2039
|
-
await
|
|
2040
|
+
await waitFor(() => {
|
|
2040
2041
|
expect(mockAddItem).toHaveBeenCalledWith(expect.objectContaining({
|
|
2041
2042
|
type: 'gemini',
|
|
2042
2043
|
text: 'Some response content',
|
|
2043
2044
|
}), expect.any(Number));
|
|
2044
2045
|
});
|
|
2045
2046
|
// Then verify loop detection confirmation request was set
|
|
2046
|
-
await
|
|
2047
|
+
await waitFor(() => {
|
|
2047
2048
|
expect(result.current.loopDetectionConfirmationRequest).not.toBeNull();
|
|
2048
2049
|
});
|
|
2049
2050
|
});
|