Disallow redundant typecasts. (#15030)

This commit is contained in:
Christian Gunderman
2025-12-12 17:43:43 -08:00
committed by GitHub
parent fcc3b2b5ec
commit 942bcfc61e
86 changed files with 235 additions and 371 deletions
+4 -10
View File
@@ -12,11 +12,7 @@ import type {
RequestContext,
ExecutionEventBus,
} from '@a2a-js/sdk/server';
import type {
ToolCallRequestInfo,
ServerGeminiToolCallRequestEvent,
Config,
} from '@google/gemini-cli-core';
import type { ToolCallRequestInfo, Config } from '@google/gemini-cli-core';
import {
GeminiEventType,
SimpleExtensionLoader,
@@ -287,8 +283,8 @@ export class CoderAgentExecutor implements AgentExecutor {
requestContext: RequestContext,
eventBus: ExecutionEventBus,
): Promise<void> {
const userMessage = requestContext.userMessage as Message;
const sdkTask = requestContext.task as SDKTask | undefined;
const userMessage = requestContext.userMessage;
const sdkTask = requestContext.task;
const taskId = sdkTask?.id || userMessage.taskId || uuidv4();
const contextId: string =
@@ -485,9 +481,7 @@ export class CoderAgentExecutor implements AgentExecutor {
throw new Error('Execution aborted');
}
if (event.type === GeminiEventType.ToolCallRequest) {
toolCallRequests.push(
(event as ServerGeminiToolCallRequestEvent).value,
);
toolCallRequests.push(event.value);
continue;
}
await currentTask.acceptAgentMessage(event);
+1 -6
View File
@@ -370,12 +370,7 @@ describe('Task', () => {
};
// @ts-expect-error - Calling private constructor
task = new Task(
'task-id',
'context-id',
mockConfig as Config,
mockEventBus,
);
task = new Task('task-id', 'context-id', mockConfig, mockEventBus);
// Spy on the method we want to check calls for
setTaskStateAndPublishUpdateSpy = vi.spyOn(
+2 -2
View File
@@ -747,8 +747,8 @@ export class Task {
return false;
}
const callId = part.data['callId'] as string;
const outcomeString = part.data['outcome'] as string;
const callId = part.data['callId'];
const outcomeString = part.data['outcome'];
let confirmationOutcome: ToolConfirmationOutcome | undefined;
if (outcomeString === 'proceed_once') {
+1 -1
View File
@@ -123,7 +123,7 @@ function resolveEnvVarsInString(value: string): string {
return value.replace(envVarRegex, (match, varName1, varName2) => {
const varName = varName1 || varName2;
if (process && process.env && typeof process.env[varName] === 'string') {
return process.env[varName]!;
return process.env[varName];
}
return match;
});