Fix linting errors in a number of core and tool files (partial)

- As part of this work I also started building out errors.ts which will be a cumulation of error helpers to better handle the challenging `catch (error: unknown)` requirement.
- More changes are to come, this is truly a partial change in order to not disrupt as many people as possible.

Part of https://b.corp.google.com/issues/411384603
This commit is contained in:
Taylor Mullen
2025-04-18 13:37:51 -04:00
committed by N. Taylor Mullen
parent 93fd6a9160
commit 7cd3b95317
9 changed files with 62 additions and 62 deletions

View File

@@ -24,17 +24,12 @@ export interface ReadFileToolParams {
limit?: number;
}
/**
* Standardized result from the ReadFile tool
*/
export interface ReadFileToolResult extends ToolResult {}
/**
* Implementation of the ReadFile tool that reads files from the filesystem
*/
export class ReadFileTool extends BaseTool<
ReadFileToolParams,
ReadFileToolResult
ToolResult
> {
static readonly Name: string = 'read_file';
@@ -166,7 +161,7 @@ export class ReadFileTool extends BaseTool<
// If more than 30% are non-printable, likely binary
return nonPrintableCount / bytesRead > 0.3;
} catch (error) {
} catch {
return false;
}
}
@@ -214,7 +209,7 @@ export class ReadFileTool extends BaseTool<
* @param params Parameters for the file reading
* @returns Result with file contents
*/
async execute(params: ReadFileToolParams): Promise<ReadFileToolResult> {
async execute(params: ReadFileToolParams): Promise<ToolResult> {
const validationError = this.invalidParams(params);
const filePath = params.file_path;
if (validationError) {