@@ -52,9 +52,12 @@ import { IWorkspaceContextService } from '../../../../../../platform/workspace/c
5252import { IHistoryService } from '../../../../../services/history/common/history.js' ;
5353import { TerminalCommandArtifactCollector } from './terminalCommandArtifactCollector.js' ;
5454import { isNumber , isString } from '../../../../../../base/common/types.js' ;
55+ import { ChatConfiguration } from '../../../../chat/common/constants.js' ;
5556
5657// #region Tool data
5758
59+ const TOOL_REFERENCE_NAME = 'runInTerminal' ;
60+
5861function createPowerShellModelDescription ( shell : string ) : string {
5962 const isWinPwsh = isWindowsPowerShell ( shell ) ;
6063 return [
@@ -190,7 +193,7 @@ export async function createRunInTerminalToolData(
190193
191194 return {
192195 id : 'run_in_terminal' ,
193- toolReferenceName : 'runInTerminal' ,
196+ toolReferenceName : TOOL_REFERENCE_NAME ,
194197 displayName : localize ( 'runInTerminalTool.displayName' , 'Run in Terminal' ) ,
195198 modelDescription,
196199 userDescription : localize ( 'runInTerminalTool.userDescription' , 'Tool for running commands in the terminal' ) ,
@@ -401,9 +404,10 @@ export class RunInTerminalTool extends Disposable implements IToolImpl {
401404 // commands that would be auto approved if it were enabled.
402405 const commandLine = rewrittenCommand ?? args . command ;
403406
407+ const isEligibleForAutoApproval = this . _configurationService . getValue < Record < string , boolean > > ( ChatConfiguration . EligibleForAutoApproval ) ?. [ TOOL_REFERENCE_NAME ] ?? true ;
404408 const isAutoApproveEnabled = this . _configurationService . getValue ( TerminalChatAgentToolsSettingId . EnableAutoApprove ) === true ;
405409 const isAutoApproveWarningAccepted = this . _storageService . getBoolean ( TerminalToolConfirmationStorageKeys . TerminalAutoApproveWarningAccepted , StorageScope . APPLICATION , false ) ;
406- const isAutoApproveAllowed = isAutoApproveEnabled && isAutoApproveWarningAccepted ;
410+ const isAutoApproveAllowed = isEligibleForAutoApproval && isAutoApproveEnabled && isAutoApproveWarningAccepted ;
407411
408412 const commandLineAnalyzerOptions : ICommandLineAnalyzerOptions = {
409413 commandLine,
@@ -423,7 +427,7 @@ export class RunInTerminalTool extends Disposable implements IToolImpl {
423427 }
424428
425429 const analyzersIsAutoApproveAllowed = commandLineAnalyzerResults . every ( e => e . isAutoApproveAllowed ) ;
426- const customActions = analyzersIsAutoApproveAllowed ? commandLineAnalyzerResults . map ( e => e . customActions ?? [ ] ) . flat ( ) : undefined ;
430+ const customActions = isEligibleForAutoApproval && analyzersIsAutoApproveAllowed ? commandLineAnalyzerResults . map ( e => e . customActions ?? [ ] ) . flat ( ) : undefined ;
427431
428432 let shellType = basename ( shell , '.exe' ) ;
429433 if ( shellType === 'powershell' ) {
0 commit comments