@@ -1014,6 +1014,39 @@ test('replay parses open --relaunch flag and replays open with relaunch semantic
10141014 assert . equal ( invoked [ 0 ] ?. flags ?. relaunch , true ) ;
10151015} ) ;
10161016
1017+ test ( 'replay resolves relative script path against request cwd' , async ( ) => {
1018+ const sessionStore = makeSessionStore ( ) ;
1019+ const replayRoot = fs . mkdtempSync ( path . join ( os . tmpdir ( ) , 'agent-device-replay-cwd-' ) ) ;
1020+ const replayDir = path . join ( replayRoot , 'workflows' ) ;
1021+ fs . mkdirSync ( replayDir , { recursive : true } ) ;
1022+ fs . writeFileSync ( path . join ( replayDir , 'flow.ad' ) , 'open "Settings"\n' ) ;
1023+
1024+ const invoked : DaemonRequest [ ] = [ ] ;
1025+ const response = await handleSessionCommands ( {
1026+ req : {
1027+ token : 't' ,
1028+ session : 'default' ,
1029+ command : 'replay' ,
1030+ positionals : [ 'workflows/flow.ad' ] ,
1031+ flags : { } ,
1032+ meta : { cwd : replayRoot } ,
1033+ } ,
1034+ sessionName : 'default' ,
1035+ logPath : path . join ( os . tmpdir ( ) , 'daemon.log' ) ,
1036+ sessionStore,
1037+ invoke : async ( req ) => {
1038+ invoked . push ( req ) ;
1039+ return { ok : true , data : { } } ;
1040+ } ,
1041+ } ) ;
1042+
1043+ assert . ok ( response ) ;
1044+ assert . equal ( response ?. ok , true ) ;
1045+ assert . equal ( invoked . length , 1 ) ;
1046+ assert . equal ( invoked [ 0 ] ?. command , 'open' ) ;
1047+ assert . deepEqual ( invoked [ 0 ] ?. positionals , [ 'Settings' ] ) ;
1048+ } ) ;
1049+
10171050test ( 'replay parses press series flags and passes them to invoke' , async ( ) => {
10181051 const sessionStore = makeSessionStore ( ) ;
10191052 const replayRoot = fs . mkdtempSync ( path . join ( os . tmpdir ( ) , 'agent-device-replay-press-series-' ) ) ;
0 commit comments