/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */ import type { AnyDeclarativeTool, AnyToolInvocation } from '../index.js'; /** * Checks if a tool invocation matches any of a list of patterns. * * @param toolOrToolName The tool object or the name of the tool being invoked. * @param invocation The invocation object for the tool or the command invoked. * @param patterns A list of patterns to match against. * Patterns can be: * - A tool name (e.g., "ReadFileTool") to match any invocation of that tool. * - A tool name with a prefix (e.g., "ShellTool(git status)") to match * invocations where the arguments start with that prefix. * @returns True if the invocation matches any pattern, false otherwise. */ export declare function doesToolInvocationMatch(toolOrToolName: AnyDeclarativeTool | string, invocation: AnyToolInvocation | string, patterns: string[]): boolean; /** * Checks if a shell tool invocation is allowlisted based on shell-specific semantics. * This function handles chained commands (e.g., "echo foo && ls -l") by ensuring * ALL segments of the chained command are allowlisted. * * @param invocation The tool invocation containing the command to check. * @param allowedPatterns A list of patterns that represent allowed tools/commands. * @returns True if the invocation is allowlisted, false otherwise. */ export declare function isShellInvocationAllowlisted(invocation: AnyToolInvocation, allowedPatterns: string[]): boolean;