1- import type { PreresolvedInteractionTarget } from '@agent-device/contracts/interaction';
1+ import type {
2+ PreresolvedInteractionTarget,
3+ SurfaceScopedNodes,
4+ } from '@agent-device/contracts/interaction';
5+ import { surfaceScopedNodes } from '@agent-device/capture-kit/snapshot-baseline';
26import {
37 isReadOnlyFindAction,
48 checkFindArgs,
@@ -10,7 +14,6 @@ import { SELECTOR_PIPELINE_POLICIES } from '@agent-device/selectors/selector-pip
1014import { coveredInteractionDetails } from '@agent-device/selectors/interaction-error';
1115import {
1216 centerOfRect,
13- type PresentedSurface,
1417 type SnapshotKeyboardBandFact,
1518 type SnapshotState,
1619} from '@agent-device/kernel/snapshot';
@@ -65,13 +68,10 @@ type ResolvedMatch = {
6568 node: SnapshotState['nodes'][number];
6669 resolvedNode: SnapshotState['nodes'][number];
6770 ref: string;
68- nodes: SnapshotState['nodes'];
69- /** The in-place iOS system surface the target capture described (#2438), if any. */
70- iosSystemSurfaceBundleId?: string;
71+ /** The target capture's baseline: its nodes with the surface and presentation they describe. */
72+ tree: SurfaceScopedNodes;
7173 /** The keyboard band that capture's producer measured, when it measured one (#2660). */
7274 keyboard?: SnapshotKeyboardBandFact;
73- /** Whether that capture read a modal presentation over the app (#3565). */
74- presentedSurface?: PresentedSurface;
7575 actionFlags: Record<string, unknown>;
7676 /**
7777 * Set when find's row refuses this match as covered. Only the focus/type
@@ -211,14 +211,8 @@ export async function handleFindCommands(params: FindRouteInput): Promise<Daemon
211211 node,
212212 resolvedNode,
213213 ref,
214- nodes,
215- ...(snapshotResult.iosSystemSurfaceBundleId
216- ? { iosSystemSurfaceBundleId: snapshotResult.iosSystemSurfaceBundleId }
217- : {}),
214+ tree: surfaceScopedNodes(snapshotResult),
218215 ...(snapshotResult.keyboard ? { keyboard: snapshotResult.keyboard } : {}),
219- ...(snapshotResult.presentedSurface
220- ? { presentedSurface: snapshotResult.presentedSurface }
221- : {}),
222216 actionFlags,
223217 ...(target.kind === 'occluded' ? { occludedNode: target.node } : {}),
224218 };
@@ -273,17 +267,9 @@ function preresolvedTarget(match: ResolvedMatch): PreresolvedInteractionTarget {
273267 return {
274268 ref: match.ref,
275269 node: match.resolvedNode,
276- nodes: match.nodes,
277- // #2438: the leaf's post-action verify/settle compares against this tree, so it must know
278- // whether the tree describes the app or an in-place system surface served over it.
279- ...(match.iosSystemSurfaceBundleId
280- ? { iosSystemSurfaceBundleId: match.iosSystemSurfaceBundleId }
281- : {}),
270+ tree: match.tree,
282271 // #2660: the leaf's keyboard guard measures the band this capture measured, not one it re-derives.
283272 ...(match.keyboard ? { keyboard: match.keyboard } : {}),
284- // #3565: the leaf's settle baseline is armed on the presentation this capture read, not a shape
285- // the leaf reconstructs from nodes it cannot see the projection of.
286- ...(match.presentedSurface ? { presentedSurface: match.presentedSurface } : {}),
287273 };
288274}
289275
0 commit comments