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
+1 -1
View File
@@ -48,7 +48,7 @@ export function getToolCallDataSchema(historyItemSchema?: z.ZodTypeAny) {
export function generateCheckpointFileName(
toolCall: ToolCallRequestInfo,
): string | null {
const toolArgs = toolCall.args as Record<string, unknown>;
const toolArgs = toolCall.args;
const toolFilePath = toolArgs['file_path'] as string;
if (!toolFilePath) {
@@ -40,7 +40,7 @@ export const read = (key: string): string[] | undefined => crawlCache.get(key);
export const write = (key: string, results: string[], ttlMs: number): void => {
// Clear any existing timer for this key to prevent premature deletion
if (cacheTimers.has(key)) {
clearTimeout(cacheTimers.get(key)!);
clearTimeout(cacheTimers.get(key));
}
// Store the new data
@@ -129,7 +129,7 @@ class RecursiveFileSearch implements FileSearch {
let filteredCandidates;
const { files: candidates, isExactMatch } =
await this.resultCache!.get(pattern);
await this.resultCache.get(pattern);
if (isExactMatch) {
// Use the cached result.
@@ -151,7 +151,7 @@ class RecursiveFileSearch implements FileSearch {
}
if (shouldCache) {
this.resultCache!.set(pattern, filteredCandidates);
this.resultCache.set(pattern, filteredCandidates);
}
}
+1 -1
View File
@@ -29,7 +29,7 @@ export function doesToolInvocationMatch(
if (isTool(toolOrToolName)) {
toolNames = [toolOrToolName.name, toolOrToolName.constructor.name];
} else {
toolNames = [toolOrToolName as string];
toolNames = [toolOrToolName];
}
if (toolNames.some((name) => SHELL_TOOL_NAMES.includes(name))) {