@@ -28,6 +28,7 @@ import { getTextResponseFromStream } from './utils.js';
2828import { IConfigurationService } from '../../../../../../../platform/configuration/common/configuration.js' ;
2929import { TerminalChatAgentToolsSettingId } from '../../../common/terminalChatAgentToolsConfiguration.js' ;
3030import { ILogService } from '../../../../../../../platform/log/common/log.js' ;
31+ import { ITerminalService } from '../../../../../terminal/browser/terminal.js' ;
3132
3233export interface IOutputMonitor extends Disposable {
3334 readonly pollingResult : IPollingResult & { pollDurationMs : number } | undefined ;
@@ -87,6 +88,7 @@ export class OutputMonitor extends Disposable implements IOutputMonitor {
8788 @IChatWidgetService private readonly _chatWidgetService : IChatWidgetService ,
8889 @IConfigurationService private readonly _configurationService : IConfigurationService ,
8990 @ILogService private readonly _logService : ILogService ,
91+ @ITerminalService private readonly _terminalService : ITerminalService ,
9092 ) {
9193 super ( ) ;
9294
@@ -526,7 +528,10 @@ export class OutputMonitor extends Disposable implements IOutputMonitor {
526528 '' ,
527529 localize ( 'poll.terminal.enterInput' , 'Focus terminal' ) ,
528530 undefined ,
529- async ( ) => { execution . instance . focus ( true ) ; return true ; } ,
531+ async ( ) => {
532+ this . _showInstance ( execution . instance . instanceId ) ;
533+ return true ;
534+ }
530535 ) ;
531536
532537 const inputPromise = new Promise < boolean > ( resolve => {
@@ -567,6 +572,7 @@ export class OutputMonitor extends Disposable implements IOutputMonitor {
567572 return option ;
568573 } ,
569574 async ( ) => {
575+ this . _showInstance ( execution . instance . instanceId ) ;
570576 this . _state = OutputMonitorState . Cancelled ;
571577 this . _outputMonitorTelemetryCounters . inputToolManualRejectCount ++ ;
572578 inputDataDisposable . dispose ( ) ;
@@ -590,6 +596,17 @@ export class OutputMonitor extends Disposable implements IOutputMonitor {
590596 return optionToRun ;
591597 }
592598
599+ private _showInstance ( instanceId ?: number ) : void {
600+ if ( ! instanceId ) {
601+ return ;
602+ }
603+ const instance = this . _terminalService . getInstanceFromId ( instanceId ) ;
604+ if ( ! instance ) {
605+ return ;
606+ }
607+ this . _terminalService . setActiveInstance ( instance ) ;
608+ this . _terminalService . revealActiveTerminal ( true ) ;
609+ }
593610 // Helper to create, register, and wire a ChatElicitationRequestPart. Returns the promise that
594611 // resolves when the part is accepted/rejected and the registered part itself so callers can
595612 // attach additional listeners (e.g., onDidRequestHide) or compose with other promises.
0 commit comments