@@ -17,7 +17,6 @@ import {
1717} from '../../../core/interaction-response-data-transform.ts' ;
1818import { issueSettleRefs } from '../../session-snapshot.ts' ;
1919import type { RecordedTargetCapture } from '@agent-device/selectors/target-evidence' ;
20- import type { SessionState } from '../../session-state.ts' ;
2120import type { CaptureSnapshotForSession , InteractionRouteInput } from './types.ts' ;
2221import { resolveDirectTouchReferenceFrameSafely } from './interaction-touch-reference-frame.ts' ;
2322import { readSnapshotNodesReferenceFrame } from '@agent-device/capture-kit/touch-reference-frame' ;
@@ -288,14 +287,13 @@ export async function buildTargetedTouchResponsePayloads(params: {
288287 params : InteractionRouteInput & {
289288 captureSnapshotForSession : CaptureSnapshotForSession ;
290289 } ;
291- session : SessionState ;
292290 result : TargetedTouchResult ;
293291 staleRefsWarning : string | undefined ;
294292 publicData ?: Record < string , unknown > ;
295293 extra : Record < string , unknown > ;
296294} ) : Promise < InteractionResponsePayloads > {
297295 const { params : handlerParams , result, publicData, extra } = params ;
298- const referenceFrame =
296+ const probedFrame =
299297 result . kind === 'point'
300298 ? await resolveDirectTouchReferenceFrameSafely ( {
301299 ref : handlerParams . sessionRef ! ,
@@ -305,13 +303,14 @@ export async function buildTargetedTouchResponsePayloads(params: {
305303 captureSnapshotForSession : handlerParams . captureSnapshotForSession ,
306304 observation : handlerParams . androidObservation ,
307305 } )
308- : readSnapshotNodesReferenceFrame (
309- handlerParams . sessionStore . requireCurrent ( handlerParams . sessionRef ! ) . snapshot ?. nodes ??
310- [ ] ,
311- ) ;
312- const currentResult = handlerParams . sessionStore . resolveCurrent ( handlerParams . sessionRef ! )
313- ? result
314- : { ...result , settle : undefined } ;
306+ : undefined ;
307+ const current = handlerParams . sessionStore . resolveCurrent ( handlerParams . sessionRef ! ) ;
308+ const referenceFrame = current
309+ ? result . kind === 'point'
310+ ? probedFrame
311+ : readSnapshotNodesReferenceFrame ( current . snapshot ?. nodes ?? [ ] )
312+ : undefined ;
313+ const currentResult = current ? result : { ...result , settle : undefined } ;
315314 return buildInteractionResponseData ( {
316315 source : { kind : 'runtime' , result : currentResult , publicData } ,
317316 referenceFrame,
0 commit comments