don't confirm invalid params in terminal tool, or in general (added comments to base class) (#187)
This commit is contained in:
parent
7828e813a8
commit
9de2e82b8f
|
@ -244,6 +244,9 @@ Use this tool for running build steps (\`npm install\`, \`make\`), linters (\`es
|
|||
async shouldConfirmExecute(
|
||||
params: TerminalToolParams,
|
||||
): Promise<ToolCallConfirmationDetails | false> {
|
||||
if (this.validateToolParams(params)) {
|
||||
return false; // skip confirmation, execute call will fail immediately
|
||||
}
|
||||
const rootCommand =
|
||||
params.command
|
||||
.trim()
|
||||
|
|
|
@ -36,6 +36,8 @@ export interface Tool<
|
|||
|
||||
/**
|
||||
* Validates the parameters for the tool
|
||||
* Should be called from both `shouldConfirmExecute` and `execute`
|
||||
* `shouldConfirmExecute` should return false immediately if invalid
|
||||
* @param params Parameters to validate
|
||||
* @returns An error message string if invalid, null otherwise
|
||||
*/
|
||||
|
@ -102,6 +104,8 @@ export abstract class BaseTool<
|
|||
/**
|
||||
* Validates the parameters for the tool
|
||||
* This is a placeholder implementation and should be overridden
|
||||
* Should be called from both `shouldConfirmExecute` and `execute`
|
||||
* `shouldConfirmExecute` should return false immediately if invalid
|
||||
* @param params Parameters to validate
|
||||
* @returns An error message string if invalid, null otherwise
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue