mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-22 11:04:42 -07:00
Disallow unsafe type assertions (#18688)
This commit is contained in:
committed by
GitHub
parent
bce1caefd0
commit
fd65416a2f
@@ -195,6 +195,7 @@ export abstract class BaseToolInvocation<
|
||||
correlationId,
|
||||
toolCall: {
|
||||
name: this._toolName,
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
|
||||
args: this.params as Record<string, unknown>,
|
||||
},
|
||||
serverName: this._serverName,
|
||||
@@ -536,6 +537,7 @@ export function isTool(obj: unknown): obj is AnyDeclarativeTool {
|
||||
obj !== null &&
|
||||
'name' in obj &&
|
||||
'build' in obj &&
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
|
||||
typeof (obj as AnyDeclarativeTool).build === 'function'
|
||||
);
|
||||
}
|
||||
@@ -590,8 +592,10 @@ export function hasCycleInSchema(schema: object): boolean {
|
||||
) {
|
||||
return null;
|
||||
}
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
|
||||
current = (current as Record<string, unknown>)[segment];
|
||||
}
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
|
||||
return current as object;
|
||||
}
|
||||
|
||||
@@ -639,6 +643,7 @@ export function hasCycleInSchema(schema: object): boolean {
|
||||
if (Object.prototype.hasOwnProperty.call(node, key)) {
|
||||
if (
|
||||
traverse(
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
|
||||
(node as Record<string, unknown>)[key],
|
||||
visitedRefs,
|
||||
pathRefs,
|
||||
|
||||
Reference in New Issue
Block a user