(
_abortSignal: AbortSignal,
)
| 69 | } |
| 70 | |
| 71 | override async shouldConfirmExecute( |
| 72 | _abortSignal: AbortSignal, |
| 73 | ): Promise<ToolCallConfirmationDetails | false> { |
| 74 | const command = stripShellWrapper(this.params.command); |
| 75 | const rootCommands = [...new Set(getCommandRoots(command))]; |
| 76 | const commandsToConfirm = rootCommands.filter( |
| 77 | (command) => !this.allowlist.has(command), |
| 78 | ); |
| 79 | |
| 80 | if (commandsToConfirm.length === 0) { |
| 81 | return false; // already approved and whitelisted |
| 82 | } |
| 83 | |
| 84 | const confirmationDetails: ToolExecuteConfirmationDetails = { |
| 85 | type: 'exec', |
| 86 | title: 'Confirm Shell Command', |
| 87 | command: this.params.command, |
| 88 | rootCommand: commandsToConfirm.join(', '), |
| 89 | onConfirm: async (outcome: ToolConfirmationOutcome) => { |
| 90 | if (outcome === ToolConfirmationOutcome.ProceedAlways) { |
| 91 | commandsToConfirm.forEach((command) => this.allowlist.add(command)); |
| 92 | } |
| 93 | }, |
| 94 | }; |
| 95 | return confirmationDetails; |
| 96 | } |
| 97 | |
| 98 | async execute( |
| 99 | signal: AbortSignal, |
nothing calls this directly
no test coverage detected