@@ -3,6 +3,7 @@ import { parseReplayInput } from '../compat/replay-input.ts';
33import { parseMaestroProgram } from '../compat/maestro/program-ir-parser.ts' ;
44import type { ResolveTargetDeviceOptions } from '../core/dispatch-resolve.ts' ;
55import type { MaestroProgram } from '../compat/maestro/program-ir.ts' ;
6+ import { appleSimulatorAppTargetForOpenTarget } from './open-device-selection.ts' ;
67import { SessionStore } from './session-store.ts' ;
78import type { DaemonRequest , SessionAction } from './types.ts' ;
89
@@ -23,7 +24,7 @@ export function buildReplayTargetDeviceResolutionOptions(
2324 const appTarget = isMaestroReplay ( req , resolved )
2425 ? readMaestroReplayAppTarget ( parseMaestroProgram ( source , { sourcePath : resolved } ) )
2526 : readScriptReplayAppTarget ( parseReplayInput ( source , req . flags ) . actions ) ;
26- return appTarget ? { appleSimulatorAppTarget : appTarget } : undefined ;
27+ return appTargetResolutionOptions ( appTarget ) ;
2728 } catch {
2829 // Parsing and validation stay in the replay handler. Lock binding is only
2930 // advisory, so an unreadable/invalid plan must not mask its real error.
@@ -35,7 +36,7 @@ export function buildMaestroReplayTargetDeviceResolutionOptions(
3536 program : MaestroProgram ,
3637) : ResolveTargetDeviceOptions {
3738 const appTarget = readMaestroReplayAppTarget ( program ) ;
38- return appTarget ? { appleSimulatorAppTarget : appTarget } : { } ;
39+ return appTargetResolutionOptions ( appTarget ) ?? { } ;
3940}
4041
4142function isMaestroReplay ( req : DaemonRequest , filePath : string ) : boolean {
@@ -62,3 +63,10 @@ function readMaestroReplayAppTarget(program: MaestroProgram): string | undefined
6263function isStaticAppTarget ( value : string | undefined ) : value is string {
6364 return Boolean ( value && value . trim ( ) && ! value . includes ( '$' ) ) ;
6465}
66+
67+ function appTargetResolutionOptions (
68+ openTarget : string | undefined ,
69+ ) : ResolveTargetDeviceOptions | undefined {
70+ const appTarget = appleSimulatorAppTargetForOpenTarget ( openTarget ) ;
71+ return appTarget ? { appleSimulatorAppTarget : appTarget } : undefined ;
72+ }
0 commit comments