diff --git a/docs/cli/settings.md b/docs/cli/settings.md index 2a4b5963ce..3d6f17efb7 100644 --- a/docs/cli/settings.md +++ b/docs/cli/settings.md @@ -60,7 +60,9 @@ they appear in the UI. | Escape Pasted @ Symbols | `ui.escapePastedAtSymbols` | When enabled, @ symbols in pasted text are escaped to prevent unintended @path expansion. | `false` | | Show Shortcuts Hint | `ui.showShortcutsHint` | Show the "? for shortcuts" hint above the input. | `true` | | Hide Banner | `ui.hideBanner` | Hide the application banner | `false` | -| Hide Context Summary | `ui.hideContextSummary` | Hide the context summary (GEMINI.md, MCP servers) above the input. | `false` | +| Hide Context Summary | `ui.hideContextSummary` | Hide the context summary (GEMINI.md, MCP servers) above the input. | `true` | +| Show Context Window Warning | `ui.showContextWindowWarning` | Show a warning message when the context window limit is nearly reached. If disabled, the CLI will attempt to automatically compress the history. | `false` | +| Show Context Compression Messages | `ui.showContextCompression` | Show a message in the chat history when it is compressed. | `false` | | Hide CWD | `ui.footer.hideCWD` | Hide the current working directory in the footer. | `false` | | Hide Sandbox Status | `ui.footer.hideSandboxStatus` | Hide the sandbox status indicator in the footer. | `false` | | Hide Model Info | `ui.footer.hideModelInfo` | Hide the model name and context usage in the footer. | `false` | diff --git a/packages/cli/src/config/settingsSchema.ts b/packages/cli/src/config/settingsSchema.ts index 19ae25c200..b59de3a8c0 100644 --- a/packages/cli/src/config/settingsSchema.ts +++ b/packages/cli/src/config/settingsSchema.ts @@ -587,7 +587,7 @@ const SETTINGS_SCHEMA = { requiresRestart: false, default: false, description: - 'Show a warning message when the context window limit is nearly reached.', + 'Show a warning message when the context window limit is nearly reached. If disabled, the CLI will attempt to automatically compress the history when the limit is reached.', showInDialog: true, }, showContextCompression: { diff --git a/packages/cli/src/ui/commands/compressCommand.test.ts b/packages/cli/src/ui/commands/compressCommand.test.ts index a0c9418817..41d0ff5b09 100644 --- a/packages/cli/src/ui/commands/compressCommand.test.ts +++ b/packages/cli/src/ui/commands/compressCommand.test.ts @@ -22,6 +22,10 @@ describe('compressCommand', () => { let context: ReturnType; let mockTryCompressChat: ReturnType; + afterEach(() => { + vi.restoreAllMocks(); + }); + beforeEach(() => { mockTryCompressChat = vi.fn(); vi.mocked(Core.tokenLimit).mockReturnValue(1000); diff --git a/packages/cli/src/ui/components/messages/CompressionMessage.tsx b/packages/cli/src/ui/components/messages/CompressionMessage.tsx index 2d17c4b6e9..3cf3d33c2d 100644 --- a/packages/cli/src/ui/components/messages/CompressionMessage.tsx +++ b/packages/cli/src/ui/components/messages/CompressionMessage.tsx @@ -32,7 +32,7 @@ export function CompressionMessage({ switch (compressionStatus) { case CompressionStatus.COMPRESSED: - return `Context compressed (${beforePercentage}% ➔ ${afterPercentage}%).`; + return `Context compressed (${beforePercentage}% → ${afterPercentage}%).`; case CompressionStatus.COMPRESSION_FAILED_INFLATED_TOKEN_COUNT: return 'Compression was not beneficial for this history size.'; case CompressionStatus.COMPRESSION_FAILED_TOKEN_COUNT_ERROR: diff --git a/packages/cli/src/ui/hooks/useGeminiStream.test.tsx b/packages/cli/src/ui/hooks/useGeminiStream.test.tsx index 7f45bc13e8..1e3a6a2b89 100644 --- a/packages/cli/src/ui/hooks/useGeminiStream.test.tsx +++ b/packages/cli/src/ui/hooks/useGeminiStream.test.tsx @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -/* eslint-disable @typescript-eslint/no-explicit-any */ +/* eslint-disable @typescript-eslint/no-explicit-any -- TODO: Refactor to remove any usage */ import { describe, it, @@ -256,9 +256,12 @@ describe('useGeminiStream', () => { const mockOnAuthError = vi.fn(); const mockPerformMemoryRefresh = vi.fn(() => Promise.resolve()); const mockSetModelSwitchedFromQuotaError = vi.fn(); - const mockOnCancelSubmit = vi.fn(); const mockSetShellInputFocused = vi.fn(); + afterEach(() => { + vi.restoreAllMocks(); + }); + const mockGetGeminiClient = vi.fn().mockImplementation(() => { const clientInstance = new MockedGeminiClientClass(mockConfig); return clientInstance; @@ -336,6 +339,10 @@ describe('useGeminiStream', () => { getContextWindowCompressionThreshold: vi.fn(() => 0.2), } as unknown as Config; + afterEach(() => { + vi.restoreAllMocks(); + }); + beforeEach(() => { vi.clearAllMocks(); // Clear mocks before each test mockAddItem = vi.fn();