@@ -16,6 +16,9 @@ import {
1616} from '../../../utils/responses/index.ts' ;
1717import type { CommandExecutor } from '../../../utils/execution/index.ts' ;
1818import { getDefaultCommandExecutor } from '../../../utils/execution/index.ts' ;
19+ import { getDefaultDebuggerManager } from '../../../utils/debugger/index.ts' ;
20+ import type { DebuggerManager } from '../../../utils/debugger/debugger-manager.ts' ;
21+ import { guardUiAutomationAgainstStoppedDebugger } from '../../../utils/debugger/ui-automation-guard.ts' ;
1922import {
2023 createAxeNotAvailableResponse ,
2124 getAxePath ,
@@ -54,9 +57,18 @@ export async function key_sequenceLogic(
5457 getBundledAxeEnvironment,
5558 createAxeNotAvailableResponse,
5659 } ,
60+ debuggerManager : DebuggerManager = getDefaultDebuggerManager ( ) ,
5761) : Promise < ToolResponse > {
5862 const toolName = 'key_sequence' ;
5963 const { simulatorId, keyCodes, delay } = params ;
64+
65+ const guard = await guardUiAutomationAgainstStoppedDebugger ( {
66+ debugger : debuggerManager ,
67+ simulatorId,
68+ toolName,
69+ } ) ;
70+ if ( guard . blockedResponse ) return guard . blockedResponse ;
71+
6072 const commandArgs = [ 'key-sequence' , '--keycodes' , keyCodes . join ( ',' ) ] ;
6173 if ( delay !== undefined ) {
6274 commandArgs . push ( '--delay' , String ( delay ) ) ;
@@ -70,7 +82,11 @@ export async function key_sequenceLogic(
7082 try {
7183 await executeAxeCommand ( commandArgs , simulatorId , 'key-sequence' , executor , axeHelpers ) ;
7284 log ( 'info' , `${ LOG_PREFIX } /${ toolName } : Success for ${ simulatorId } ` ) ;
73- return createTextResponse ( `Key sequence [${ keyCodes . join ( ',' ) } ] executed successfully.` ) ;
85+ const message = `Key sequence [${ keyCodes . join ( ',' ) } ] executed successfully.` ;
86+ if ( guard . warningText ) {
87+ return createTextResponse ( `${ message } \n\n${ guard . warningText } ` ) ;
88+ }
89+ return createTextResponse ( message ) ;
7490 } catch ( error ) {
7591 log ( 'error' , `${ LOG_PREFIX } /${ toolName } : Failed - ${ error } ` ) ;
7692 if ( error instanceof DependencyError ) {
0 commit comments