2025-04-18 17:44:24 -07:00
|
|
|
/**
|
|
|
|
|
* @license
|
|
|
|
|
* Copyright 2025 Google LLC
|
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
|
*/
|
|
|
|
|
|
2025-07-18 17:30:28 -07:00
|
|
|
export const SHELL_COMMAND_NAME = 'Shell Command';
|
2025-08-21 22:29:15 +00:00
|
|
|
|
2025-09-18 13:35:55 -07:00
|
|
|
export const SHELL_NAME = 'Shell';
|
|
|
|
|
|
2025-11-11 07:50:11 -08:00
|
|
|
// Limit Gemini messages to a very high number of lines to mitigate performance
|
|
|
|
|
// issues in the worst case if we somehow get an enormous response from Gemini.
|
|
|
|
|
// This threshold is arbitrary but should be high enough to never impact normal
|
|
|
|
|
// usage.
|
|
|
|
|
export const MAX_GEMINI_MESSAGE_LINES = 65536;
|
|
|
|
|
|
2025-11-21 12:19:34 -05:00
|
|
|
export const SHELL_FOCUS_HINT_DELAY_MS = 5000;
|
|
|
|
|
|
2025-08-27 07:54:32 -07:00
|
|
|
// Tool status symbols used in ToolMessage component
|
|
|
|
|
export const TOOL_STATUS = {
|
|
|
|
|
SUCCESS: '✓',
|
|
|
|
|
PENDING: 'o',
|
|
|
|
|
EXECUTING: '⊷',
|
|
|
|
|
CONFIRMING: '?',
|
|
|
|
|
CANCELED: '-',
|
|
|
|
|
ERROR: 'x',
|
|
|
|
|
} as const;
|
2025-12-23 14:39:35 -05:00
|
|
|
|
|
|
|
|
// Maximum number of MCP resources to display per server before truncating
|
|
|
|
|
export const MAX_MCP_RESOURCES_TO_SHOW = 10;
|
2026-01-06 15:52:12 -05:00
|
|
|
|
2026-01-28 14:57:27 -08:00
|
|
|
export const WARNING_PROMPT_DURATION_MS = 3000;
|
2026-01-06 15:52:12 -05:00
|
|
|
export const QUEUE_ERROR_DISPLAY_DURATION_MS = 3000;
|
2026-01-12 17:18:14 -08:00
|
|
|
export const SHELL_ACTION_REQUIRED_TITLE_DELAY_MS = 30000;
|
2026-01-21 14:31:24 -08:00
|
|
|
export const SHELL_SILENT_WORKING_TITLE_DELAY_MS = 120000;
|
2026-02-20 16:26:11 -08:00
|
|
|
export const EXPAND_HINT_DURATION_MS = 5000;
|
2026-01-17 18:54:36 +05:00
|
|
|
|
2026-02-10 09:36:20 -08:00
|
|
|
export const DEFAULT_BACKGROUND_OPACITY = 0.16;
|
|
|
|
|
export const DEFAULT_INPUT_BACKGROUND_OPACITY = 0.24;
|
2026-03-03 16:10:09 -08:00
|
|
|
export const DEFAULT_SELECTION_OPACITY = 0.2;
|
2026-02-24 01:21:10 -08:00
|
|
|
export const DEFAULT_BORDER_OPACITY = 0.4;
|
2026-01-26 15:23:54 -08:00
|
|
|
|
2026-01-17 18:54:36 +05:00
|
|
|
export const KEYBOARD_SHORTCUTS_URL =
|
|
|
|
|
'https://geminicli.com/docs/cli/keyboard-shortcuts/';
|
2026-01-16 09:33:13 -08:00
|
|
|
export const LRU_BUFFER_PERF_CACHE_LIMIT = 20000;
|
2026-02-08 00:09:48 -08:00
|
|
|
|
|
|
|
|
// Max lines to show for active shell output when not focused
|
|
|
|
|
export const ACTIVE_SHELL_MAX_LINES = 15;
|
|
|
|
|
|
|
|
|
|
// Max lines to preserve in history for completed shell commands
|
|
|
|
|
export const COMPLETED_SHELL_MAX_LINES = 15;
|
2026-03-03 01:22:29 -08:00
|
|
|
|
2026-03-09 12:20:15 -07:00
|
|
|
// Max lines to show for subagent results before collapsing
|
|
|
|
|
export const SUBAGENT_MAX_LINES = 15;
|
|
|
|
|
|
2026-03-03 01:22:29 -08:00
|
|
|
/** Minimum terminal width required to show the full context used label */
|
|
|
|
|
export const MIN_TERMINAL_WIDTH_FOR_FULL_LABEL = 100;
|
|
|
|
|
|
|
|
|
|
/** Default context usage fraction at which to trigger compression */
|
|
|
|
|
export const DEFAULT_COMPRESSION_THRESHOLD = 0.5;
|
2026-03-26 03:36:44 +05:30
|
|
|
|
|
|
|
|
/** Documentation URL for skills setup and configuration */
|
|
|
|
|
export const SKILLS_DOCS_URL =
|
|
|
|
|
'https://github.com/google-gemini/gemini-cli/blob/main/docs/cli/skills.md';
|
feat(ui): implement compact tool output and structured tool results
This commit introduces the compactToolOutput feature to optimize terminal vertical space usage for common, high-volume tools.
1. Compact Tool Output UI:
- Added DenseToolMessage component for rendering compact, single-line tool summaries.
- Updated ToolGroupMessage to detect contiguous compact tools and render them with stitched borders for a streamlined look.
- Added Ctrl+O shortcut in AppContainer to toggle full expansion of tool results from the last turn.
- Implemented useGeminiStream border logic to correctly render borders around dense sections.
2. Core Tool Structured Results:
- grep: Updated to return GrepResult with matches, file paths, and line numbers instead of a raw formatted string.
- ls (list_directory): Updated to return ListDirectoryResult with an array of files.
- read_many_files: Updated to return ReadManyFilesResult with read files, skipped files, and reasons.
- Modified ToolResultDisplay and isStructuredToolResult type guards to support these new structured interfaces.
3. User Settings & Documentation:
- Added compactToolOutput to the UI settings schema (default: true).
- Updated configuration docs and schema to reflect the new setting.
- Adjusted compact subview line limits (COMPACT_TOOL_SUBVIEW_MAX_LINES).
test(cli): refine settings and tool action mocks to resolve test rig regressions
This update addresses incomplete settings store contracts and default state mismatches that caused snapshot runtime errors and verification failures in compact tool output tests.
1. Settings Mock Completeness:
- Updated `createMockSettings` in `mockConfig.ts` to include required functional methods (`subscribe`, `getSnapshot`, `setValue`) to satisfy React's `useSyncExternalStore` contract. This resolves "store.getSnapshot is not a function" errors in snapshot tests.
2. Tool Actions Provider Configuration:
- Modified `renderWithProviders` to accept a `toolActions` options object, allowing individual tests to inject specific tool expansion states.
- Changed the default mock for `isExpanded` from `true` to `false` to align with the application's default behavior (collapsed outputs) in alternate buffer mode.
3. Test Refactoring:
- Refactored `ToolGroupMessage.compact.test.tsx` to use the standardized `createMockSettings` utility rather than a manual generic object, ensuring proper context evaluation during rendering.
refactor(cli): address nuanced snapshot rendering scenarios through layout and padding refinements
- Refined height calculation logic in ToolGroupMessage to ensure consistent spacing between compact and standard tools.
- Adjusted padding and margins in StickyHeader, ToolConfirmationQueue, ShellToolMessage, and ToolMessage for visual alignment.
- Updated TOOL_RESULT_STANDARD_RESERVED_LINE_COUNT to account for internal layout changes.
- Improved ToolResultDisplay height handling in alternate buffer mode.
- Updated test snapshots to reflect layout and spacing corrections.
refactor(cli): cleanup and simplify UI components
- Reduced UI refresh delay in AppContainer.tsx for a more responsive user experience.
- Reorder imports and hook definitions within AppContainer.tsx to reduce diff 'noise'.
refactor(cli): enhance compact output robustness and visual regression testing
Addressing automated review feedback to improve code maintainability and layout stability.
1. Robust File Extension Parsing:
- Introduced getFileExtension utility in packages/cli/src/ui/utils/fileUtils.ts using node:path for reliable extension extraction.
- Updated DenseToolMessage and DiffRenderer to use the new utility, replacing fragile string splitting.
2. Visual Regression Coverage:
- Added SVG snapshot tests to DenseToolMessage.test.tsx to verify semantic color rendering and layout integrity in compact mode.
fix(cli): resolve dense tool output code quality issues
- Replaced manual string truncation with Ink's `wrap="truncate-end"` to adhere to UI guidelines.
- Added `isReadManyFilesResult` type guard to `packages/core/src/tools/tools.ts` to improve typing for structured tool results.
- Fixed an incomplete test case in `DenseToolMessage.test.tsx` to properly simulate expansion via context instead of missing mouse events.
2026-03-20 11:40:29 -07:00
|
|
|
|
|
|
|
|
/** Max lines to show for a compact tool subview (e.g. diff) */
|
|
|
|
|
export const COMPACT_TOOL_SUBVIEW_MAX_LINES = 15;
|