mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-28 14:04:41 -07:00
refactor(cli): decouple UI from live tool execution via ToolActionsContext (#17183)
This commit is contained in:
@@ -8,6 +8,7 @@ import {
|
||||
type ToolCall,
|
||||
type Status as CoreStatus,
|
||||
type ToolCallConfirmationDetails,
|
||||
type SerializableConfirmationDetails,
|
||||
type ToolResultDisplay,
|
||||
debugLogger,
|
||||
} from '@google/gemini-cli-core';
|
||||
@@ -72,10 +73,13 @@ export function mapToDisplay(
|
||||
};
|
||||
|
||||
let resultDisplay: ToolResultDisplay | undefined = undefined;
|
||||
let confirmationDetails: ToolCallConfirmationDetails | undefined =
|
||||
undefined;
|
||||
let confirmationDetails:
|
||||
| ToolCallConfirmationDetails
|
||||
| SerializableConfirmationDetails
|
||||
| undefined = undefined;
|
||||
let outputFile: string | undefined = undefined;
|
||||
let ptyId: number | undefined = undefined;
|
||||
let correlationId: string | undefined = undefined;
|
||||
|
||||
switch (call.status) {
|
||||
case 'success':
|
||||
@@ -87,16 +91,9 @@ export function mapToDisplay(
|
||||
resultDisplay = call.response.resultDisplay;
|
||||
break;
|
||||
case 'awaiting_approval':
|
||||
// Only map if it's the legacy callback-based details.
|
||||
// Serializable details will be handled in a later milestone.
|
||||
if (
|
||||
call.confirmationDetails &&
|
||||
'onConfirm' in call.confirmationDetails &&
|
||||
typeof call.confirmationDetails.onConfirm === 'function'
|
||||
) {
|
||||
confirmationDetails =
|
||||
call.confirmationDetails as ToolCallConfirmationDetails;
|
||||
}
|
||||
correlationId = call.correlationId;
|
||||
// Pass through details. Context handles dispatch (callback vs bus).
|
||||
confirmationDetails = call.confirmationDetails;
|
||||
break;
|
||||
case 'executing':
|
||||
resultDisplay = call.liveOutput;
|
||||
@@ -123,6 +120,7 @@ export function mapToDisplay(
|
||||
confirmationDetails,
|
||||
outputFile,
|
||||
ptyId,
|
||||
correlationId,
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user