refactor: use CoreToolCallStatus in the the history data model (#19033)

This commit is contained in:
Jerop Kipruto
2026-02-13 17:20:14 -05:00
committed by GitHub
parent e7e4c68c5c
commit f87468c644
40 changed files with 322 additions and 268 deletions
@@ -8,13 +8,16 @@ import type React from 'react';
import { useMemo } from 'react';
import { Box, Text } from 'ink';
import type { IndividualToolCallDisplay } from '../../types.js';
import { ToolCallStatus } from '../../types.js';
import { ToolCallStatus, mapCoreStatusToDisplayStatus } from '../../types.js';
import { ToolMessage } from './ToolMessage.js';
import { ShellToolMessage } from './ShellToolMessage.js';
import { theme } from '../../semantic-colors.js';
import { useConfig } from '../../contexts/ConfigContext.js';
import { isShellTool, isThisShellFocused } from './ToolShared.js';
import { shouldHideAskUserTool } from '@google/gemini-cli-core';
import {
shouldHideAskUserTool,
CoreToolCallStatus,
} from '@google/gemini-cli-core';
import { ShowMoreLines } from '../ShowMoreLines.js';
import { useUIState } from '../../contexts/UIStateContext.js';
@@ -45,9 +48,10 @@ export const ToolGroupMessage: React.FC<ToolGroupMessageProps> = ({
// Filter out Ask User tools that should be hidden (e.g. in-progress or errors without result)
const toolCalls = useMemo(
() =>
allToolCalls.filter(
(t) => !shouldHideAskUserTool(t.name, t.status, !!t.resultDisplay),
),
allToolCalls.filter((t) => {
const displayStatus = mapCoreStatusToDisplayStatus(t.status);
return !shouldHideAskUserTool(t.name, displayStatus, !!t.resultDisplay);
}),
[allToolCalls],
);
@@ -61,11 +65,13 @@ export const ToolGroupMessage: React.FC<ToolGroupMessageProps> = ({
// appear in the Global Queue until they are approved and start executing.
const visibleToolCalls = useMemo(
() =>
toolCalls.filter(
(t) =>
t.status !== ToolCallStatus.Pending &&
t.status !== ToolCallStatus.Confirming,
),
toolCalls.filter((t) => {
const displayStatus = mapCoreStatusToDisplayStatus(t.status);
return (
displayStatus !== ToolCallStatus.Pending &&
displayStatus !== ToolCallStatus.Confirming
);
}),
[toolCalls],
);
@@ -80,7 +86,7 @@ export const ToolGroupMessage: React.FC<ToolGroupMessageProps> = ({
);
const hasPending = !visibleToolCalls.every(
(t) => t.status === ToolCallStatus.Success,
(t) => t.status === CoreToolCallStatus.Success,
);
const isShellCommand = toolCalls.some((t) => isShellTool(t.name));