chore(build/compiler): Enable a bunch of strict TS compiler options. (#6138)

This commit is contained in:
Richie Foreman
2025-08-13 16:17:38 -04:00
committed by GitHub
parent 8fae227e8d
commit a90aeb3d8f
28 changed files with 141 additions and 84 deletions

View File

@@ -471,7 +471,7 @@ Expectation for required parameters:
* @param params Parameters to validate
* @returns Error message string or null if valid
*/
validateToolParams(params: EditToolParams): string | null {
override validateToolParams(params: EditToolParams): string | null {
const errors = SchemaValidator.validate(
this.schema.parametersJsonSchema,
params,

View File

@@ -281,7 +281,7 @@ export class GlobTool extends BaseDeclarativeTool<GlobToolParams, ToolResult> {
/**
* Validates the parameters for the tool.
*/
validateToolParams(params: GlobToolParams): string | null {
override validateToolParams(params: GlobToolParams): string | null {
const errors = SchemaValidator.validate(
this.schema.parametersJsonSchema,
params,

View File

@@ -614,7 +614,7 @@ export class GrepTool extends BaseDeclarativeTool<GrepToolParams, ToolResult> {
* @param params Parameters to validate
* @returns An error message string if invalid, null otherwise
*/
validateToolParams(params: GrepToolParams): string | null {
override validateToolParams(params: GrepToolParams): string | null {
const errors = SchemaValidator.validate(
this.schema.parametersJsonSchema,
params,

View File

@@ -314,7 +314,7 @@ export class LSTool extends BaseDeclarativeTool<LSToolParams, ToolResult> {
* @param params Parameters to validate
* @returns An error message string if invalid, null otherwise
*/
validateToolParams(params: LSToolParams): string | null {
override validateToolParams(params: LSToolParams): string | null {
const errors = SchemaValidator.validate(
this.schema.parametersJsonSchema,
params,

View File

@@ -70,7 +70,7 @@ class DiscoveredMCPToolInvocation extends BaseToolInvocation<
super(params);
}
async shouldConfirmExecute(
override async shouldConfirmExecute(
_abortSignal: AbortSignal,
): Promise<ToolCallConfirmationDetails | false> {
const serverAllowListKey = this.serverName;
@@ -135,7 +135,7 @@ export class DiscoveredMCPTool extends BaseDeclarativeTool<
readonly serverName: string,
readonly serverToolName: string,
description: string,
readonly parameterSchema: unknown,
override readonly parameterSchema: unknown,
readonly timeout?: number,
readonly trust?: boolean,
nameOverride?: string,

View File

@@ -180,7 +180,7 @@ class MemoryToolInvocation extends BaseToolInvocation<
return `in ${tildeifyPath(memoryFilePath)}`;
}
async shouldConfirmExecute(
override async shouldConfirmExecute(
_abortSignal: AbortSignal,
): Promise<ToolEditConfirmationDetails | false> {
const memoryFilePath = getGlobalMemoryFilePath();
@@ -294,7 +294,7 @@ export class MemoryTool
);
}
validateToolParams(params: SaveMemoryParams): string | null {
override validateToolParams(params: SaveMemoryParams): string | null {
const errors = SchemaValidator.validate(
this.schema.parametersJsonSchema,
params,

View File

@@ -198,7 +198,9 @@ export class ReadFileTool extends BaseDeclarativeTool<
);
}
protected validateToolParams(params: ReadFileToolParams): string | null {
protected override validateToolParams(
params: ReadFileToolParams,
): string | null {
const errors = SchemaValidator.validate(
this.schema.parametersJsonSchema,
params,

View File

@@ -626,7 +626,9 @@ Use this tool when the user's query implies needing the content of several files
);
}
protected validateToolParams(params: ReadManyFilesParams): string | null {
protected override validateToolParams(
params: ReadManyFilesParams,
): string | null {
const errors = SchemaValidator.validate(
this.schema.parametersJsonSchema,
params,

View File

@@ -67,7 +67,7 @@ class ShellToolInvocation extends BaseToolInvocation<
return description;
}
async shouldConfirmExecute(
override async shouldConfirmExecute(
_abortSignal: AbortSignal,
): Promise<ToolCallConfirmationDetails | false> {
const command = stripShellWrapper(this.params.command);
@@ -343,7 +343,9 @@ export class ShellTool extends BaseDeclarativeTool<
);
}
protected validateToolParams(params: ShellToolParams): string | null {
protected override validateToolParams(
params: ShellToolParams,
): string | null {
const commandCheck = isCommandAllowed(params.command, this.config);
if (!commandCheck.allowed) {
if (!commandCheck.reason) {

View File

@@ -19,8 +19,8 @@ export class DiscoveredTool extends BaseTool<ToolParams, ToolResult> {
constructor(
private readonly config: Config,
name: string,
readonly description: string,
readonly parameterSchema: Record<string, unknown>,
override readonly description: string,
override readonly parameterSchema: Record<string, unknown>,
) {
const discoveryCmd = config.getToolDiscoveryCommand()!;
const callCommand = config.getToolCallCommand()!;

View File

@@ -284,13 +284,13 @@ export abstract class BaseTool<
* @param parameterSchema JSON Schema defining the parameters
*/
constructor(
readonly name: string,
readonly displayName: string,
readonly description: string,
readonly kind: Kind,
readonly parameterSchema: unknown,
readonly isOutputMarkdown: boolean = true,
readonly canUpdateOutput: boolean = false,
override readonly name: string,
override readonly displayName: string,
override readonly description: string,
override readonly kind: Kind,
override readonly parameterSchema: unknown,
override readonly isOutputMarkdown: boolean = true,
override readonly canUpdateOutput: boolean = false,
) {
super(
name,
@@ -320,7 +320,7 @@ export abstract class BaseTool<
* @returns An error message string if invalid, null otherwise
*/
// eslint-disable-next-line @typescript-eslint/no-unused-vars
validateToolParams(params: TParams): string | null {
override validateToolParams(params: TParams): string | null {
// Implementation would typically use a JSON Schema validator
// This is a placeholder that should be implemented by derived classes
return null;

View File

@@ -143,7 +143,9 @@ ${textContent}
return `Processing URLs and instructions from prompt: "${displayPrompt}"`;
}
async shouldConfirmExecute(): Promise<ToolCallConfirmationDetails | false> {
override async shouldConfirmExecute(): Promise<
ToolCallConfirmationDetails | false
> {
if (this.config.getApprovalMode() === ApprovalMode.AUTO_EDIT) {
return false;
}
@@ -337,7 +339,9 @@ export class WebFetchTool extends BaseDeclarativeTool<
}
}
protected validateToolParams(params: WebFetchToolParams): string | null {
protected override validateToolParams(
params: WebFetchToolParams,
): string | null {
const errors = SchemaValidator.validate(
this.schema.parametersJsonSchema,
params,

View File

@@ -103,7 +103,7 @@ export class WebSearchTool extends BaseTool<
return null;
}
getDescription(params: WebSearchToolParams): string {
override getDescription(params: WebSearchToolParams): string {
return `Searching the web for: "${params.query}"`;
}

View File

@@ -102,11 +102,11 @@ export class WriteFileTool
);
}
toolLocations(params: WriteFileToolParams): ToolLocation[] {
override toolLocations(params: WriteFileToolParams): ToolLocation[] {
return [{ path: params.file_path }];
}
validateToolParams(params: WriteFileToolParams): string | null {
override validateToolParams(params: WriteFileToolParams): string | null {
const errors = SchemaValidator.validate(
this.schema.parametersJsonSchema,
params,
@@ -144,7 +144,7 @@ export class WriteFileTool
return null;
}
getDescription(params: WriteFileToolParams): string {
override getDescription(params: WriteFileToolParams): string {
if (!params.file_path) {
return `Model did not provide valid parameters for write file tool, missing or empty "file_path"`;
}
@@ -158,7 +158,7 @@ export class WriteFileTool
/**
* Handles the confirmation prompt for the WriteFile tool.
*/
async shouldConfirmExecute(
override async shouldConfirmExecute(
params: WriteFileToolParams,
abortSignal: AbortSignal,
): Promise<ToolCallConfirmationDetails | false> {