File tree Expand file tree Collapse file tree 2 files changed +27
-0
lines changed
src/vs/workbench/contrib/terminalContrib/chatAgentTools Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -450,7 +450,14 @@ export class RunInTerminalTool extends Disposable implements IToolImpl {
450450 } else if ( outputAndIdle ) {
451451 resultText += `\n\ The command is still running, with output:\n${ outputAndIdle . output } ` ;
452452 }
453+
454+ let toolResultMessage : string | undefined ;
455+ if ( toolSpecificData . autoApproveInfo ) {
456+ toolResultMessage = toolSpecificData . autoApproveInfo . value ;
457+ }
458+
453459 return {
460+ toolResultMessage : toolResultMessage ? new MarkdownString ( toolResultMessage ) : undefined ,
454461 content : [ {
455462 kind : 'text' ,
456463 value : resultText ,
Original file line number Diff line number Diff line change @@ -197,6 +197,26 @@ suite('RunInTerminalTool', () => {
197197 assertAutoApproved ( result ) ;
198198 } ) ;
199199
200+ test ( 'should include auto-approve info for background commands' , async ( ) => {
201+ setAutoApprove ( {
202+ npm : true
203+ } ) ;
204+
205+ const result = await executeToolTest ( {
206+ command : 'npm run watch' ,
207+ explanation : 'Start watching for file changes' ,
208+ isBackground : true
209+ } ) ;
210+ assertAutoApproved ( result ) ;
211+
212+ // Verify that auto-approve information is included
213+ ok ( result ?. toolSpecificData , 'Expected toolSpecificData to be defined' ) ;
214+ const terminalData = result ! . toolSpecificData as any ;
215+ ok ( terminalData . autoApproveInfo , 'Expected autoApproveInfo to be defined for auto-approved background command' ) ;
216+ ok ( terminalData . autoApproveInfo . value , 'Expected autoApproveInfo to have a value' ) ;
217+ ok ( terminalData . autoApproveInfo . value . includes ( 'npm' ) , 'Expected autoApproveInfo to mention the approved rule' ) ;
218+ } ) ;
219+
200220 test ( 'should handle regex patterns in allow list' , async ( ) => {
201221 setAutoApprove ( {
202222 '/^git (status|log)/' : true
You can’t perform that action at this time.
0 commit comments