Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 1 addition & 25 deletions packages/cli/src/ui/components/messages/ToolGroupMessage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ import {
WEB_FETCH_DISPLAY_NAME,
WRITE_FILE_DISPLAY_NAME,
READ_MANY_FILES_DISPLAY_NAME,
isFileDiff,
} from '@google/gemini-cli-core';
import { buildToolVisibilityContextFromDisplay } from '../../utils/historyUtils.js';
import { useUIState } from '../../contexts/UIStateContext.js';
Expand Down Expand Up @@ -70,29 +69,6 @@ export const isCompactTool = (
);
};

// Helper to identify if a compact tool has a payload (diff, list, etc.)
export const hasDensePayload = (tool: IndividualToolCallDisplay): boolean => {
if (tool.outputFile) return true;
const res = tool.resultDisplay;
if (!res) return false;

// TODO(24053): Usage of type guards makes this class too aware of internals
if (isFileDiff(res)) return true;
if (tool.confirmationDetails?.type === 'edit') return true;

// Generic summary/payload pattern
if (
typeof res === 'object' &&
res !== null &&
'summary' in res &&
'payload' in res
) {
return true;
}

return false;
};

interface ToolGroupMessageProps {
item: HistoryItem | HistoryItemWithoutId;
toolCalls: IndividualToolCallDisplay[];
Expand Down Expand Up @@ -279,7 +255,7 @@ export const ToolGroupMessage: React.FC<ToolGroupMessageProps> = ({
for (const tool of visibleToolCalls) {
if (tool.kind !== Kind.Agent) {
if (isCompactTool(tool, isCompactModeEnabled)) {
if (hasDensePayload(tool)) {
if (tool.hasDensePayload) {
countToolCallsWithResults++;
}
} else if (
Expand Down
12 changes: 12 additions & 0 deletions packages/cli/src/ui/hooks/toolMapping.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
debugLogger,
CoreToolCallStatus,
type SubagentActivityItem,
isFileDiff,
} from '@google/gemini-cli-core';
import {
type HistoryItemToolGroup,
Expand Down Expand Up @@ -107,6 +108,16 @@ export function mapToDisplay(
}
}

const hasDensePayload = !!(
outputFile ||
(resultDisplay && isFileDiff(resultDisplay)) ||
confirmationDetails?.type === 'edit' ||
(typeof resultDisplay === 'object' &&
resultDisplay !== null &&
'summary' in resultDisplay &&
'payload' in resultDisplay)
);

return {
...baseDisplayProperties,
status: call.status,
Expand All @@ -125,6 +136,7 @@ export function mapToDisplay(
subagentHistory: hasSubagentHistory(call)
? call.subagentHistory
: undefined,
hasDensePayload,
};
});

Expand Down
1 change: 1 addition & 0 deletions packages/cli/src/ui/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ export interface IndividualToolCallDisplay {
progress?: number;
progressTotal?: number;
subagentHistory?: SubagentActivityItem[];
hasDensePayload?: boolean;
}

export interface CompressionProps {
Expand Down