mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-05-13 05:12:55 -07:00
simplify background tool info extraction
This commit is contained in:
@@ -114,25 +114,6 @@ const SUPPRESSED_TOOL_ERRORS_NOTE =
|
|||||||
const LOW_VERBOSITY_FAILURE_NOTE =
|
const LOW_VERBOSITY_FAILURE_NOTE =
|
||||||
'This request failed. Press F12 for diagnostics, or run /settings and change "Error Verbosity" to full for full details.';
|
'This request failed. Press F12 for diagnostics, or run /settings and change "Error Verbosity" to full for full details.';
|
||||||
|
|
||||||
function normalizeBackgroundExecutionId(
|
|
||||||
data: BackgroundExecutionData,
|
|
||||||
): number | undefined {
|
|
||||||
const executionId: unknown = getBackgroundExecutionId(data);
|
|
||||||
return typeof executionId === 'number' ? executionId : undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
function normalizeBackgroundCommand(data: BackgroundExecutionData): string | undefined {
|
|
||||||
const command: unknown = data.command;
|
|
||||||
return typeof command === 'string' ? command : undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
function normalizeBackgroundInitialOutput(
|
|
||||||
data: BackgroundExecutionData,
|
|
||||||
): string | undefined {
|
|
||||||
const initialOutput: unknown = data.initialOutput;
|
|
||||||
return typeof initialOutput === 'string' ? initialOutput : undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
function getBackgroundedToolInfo(
|
function getBackgroundedToolInfo(
|
||||||
toolCall: TrackedCompletedToolCall | TrackedCancelledToolCall,
|
toolCall: TrackedCompletedToolCall | TrackedCancelledToolCall,
|
||||||
): BackgroundedToolInfo | undefined {
|
): BackgroundedToolInfo | undefined {
|
||||||
@@ -143,15 +124,15 @@ function getBackgroundedToolInfo(
|
|||||||
}
|
}
|
||||||
|
|
||||||
const data: BackgroundExecutionData = rawData;
|
const data: BackgroundExecutionData = rawData;
|
||||||
const executionId = normalizeBackgroundExecutionId(data);
|
const executionId = getBackgroundExecutionId(data);
|
||||||
if (executionId === undefined) {
|
if (executionId === undefined) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
executionId,
|
executionId,
|
||||||
command: normalizeBackgroundCommand(data) ?? toolCall.request.name,
|
command: data.command ?? toolCall.request.name,
|
||||||
initialOutput: normalizeBackgroundInitialOutput(data) ?? '',
|
initialOutput: data.initialOutput ?? '',
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user