@@ -26,6 +26,7 @@ export type DiffScreenshotCommandOptions = CommandContext & {
2626 currentOverlayOut ?: FileOutputRef ;
2727 threshold ?: number ;
2828 overlayRefs ?: boolean ;
29+ surface ?: BackendScreenshotOptions [ 'surface' ] ;
2930} ;
3031
3132export type DiffScreenshotCommandResult = ScreenshotDiffResult & {
@@ -119,14 +120,14 @@ function normalizeThreshold(threshold: unknown): number {
119120
120121async function captureLiveCurrentScreenshot (
121122 runtime : AgentDeviceRuntime ,
122- options : CommandContext ,
123+ options : DiffScreenshotCommandOptions ,
123124) : Promise < ResolvedInputFile > {
124125 const temp = await createCommandTempFile ( runtime , {
125126 prefix : 'agent-device-diff-current' ,
126127 ext : '.png' ,
127128 } ) ;
128129 try {
129- await captureScreenshot ( runtime , options , temp . path ) ;
130+ await captureScreenshot ( runtime , options , temp . path , screenshotSurfaceOptions ( options ) ) ;
130131 } catch ( error ) {
131132 await temp . cleanup ( ) ;
132133 throw error ;
@@ -156,6 +157,7 @@ async function maybeAttachCurrentOverlay(
156157 try {
157158 const overlayResult = await captureScreenshot ( runtime , options , overlayOutput . path , {
158159 overlayRefs : true ,
160+ ...screenshotSurfaceOptions ( options ) ,
159161 } ) ;
160162 const overlayArtifact = await overlayOutput . publish ( ) ;
161163 if ( overlayArtifact ) artifacts . push ( overlayArtifact ) ;
@@ -201,6 +203,12 @@ async function captureScreenshot(
201203 ) ;
202204}
203205
206+ function screenshotSurfaceOptions (
207+ options : Pick < DiffScreenshotCommandOptions , 'surface' > ,
208+ ) : BackendScreenshotOptions {
209+ return options . surface ? { surface : options . surface } : { } ;
210+ }
211+
204212function resolveCurrentOverlayOutputRef (
205213 options : DiffScreenshotCommandOptions ,
206214 diffOutputPath : string | undefined ,
0 commit comments