@@ -10,6 +10,7 @@ import type {
1010 IosSnapshotProducerCapabilities ,
1111 IosSnapshotRequest ,
1212 IosSnapshotRequestInput ,
13+ IosViewportEvidence ,
1314} from '@agent-device/contracts/ios-snapshot' ;
1415
1516const IOS_SNAPSHOT_PRODUCER_CAPABILITY_VALUES = {
@@ -24,6 +25,7 @@ const IOS_SNAPSHOT_PRODUCER_CAPABILITY_VALUES = {
2425 interactiveQueryCompleteness : 'complete' ,
2526 viewportEvidence : 'available' ,
2627 hittabilityEvidence : 'available' ,
28+ truncationEvidence : 'available' ,
2729 presentationOwner : 'ios-snapshot-engine' ,
2830 } ,
2931 'simulator-ax-bridge' : {
@@ -37,6 +39,7 @@ const IOS_SNAPSHOT_PRODUCER_CAPABILITY_VALUES = {
3739 interactiveQueryCompleteness : 'incomplete' ,
3840 viewportEvidence : 'available' ,
3941 hittabilityEvidence : 'available' ,
42+ truncationEvidence : 'available' ,
4043 presentationOwner : 'snapshot-state' ,
4144 } ,
4245 'appium-source' : {
@@ -50,6 +53,7 @@ const IOS_SNAPSHOT_PRODUCER_CAPABILITY_VALUES = {
5053 interactiveQueryCompleteness : 'incomplete' ,
5154 viewportEvidence : 'available' ,
5255 hittabilityEvidence : 'unavailable' ,
56+ truncationEvidence : 'unavailable' ,
5357 presentationOwner : 'ios-snapshot-engine' ,
5458 } ,
5559 'limrun-ios-tree' : {
@@ -63,6 +67,7 @@ const IOS_SNAPSHOT_PRODUCER_CAPABILITY_VALUES = {
6367 interactiveQueryCompleteness : 'incomplete' ,
6468 viewportEvidence : 'available' ,
6569 hittabilityEvidence : 'unavailable' ,
70+ truncationEvidence : 'unavailable' ,
6671 presentationOwner : 'ios-snapshot-engine' ,
6772 } ,
6873} as const satisfies Record < IosSnapshotProducer , IosSnapshotProducerCapabilities > ;
@@ -85,9 +90,24 @@ export function deriveIosSnapshotCapabilityResidue(
8590 ) {
8691 residue . push ( { kind : 'unavailable-fact' , fact : 'acquisition-depth' } ) ;
8792 }
93+ if ( producer . truncationEvidence === 'unavailable' ) {
94+ residue . push ( { kind : 'unavailable-fact' , fact : 'truncation' } ) ;
95+ }
8896 return Object . freeze ( residue ) ;
8997}
9098
99+ export function deriveIosSnapshotAcquisitionResidue (
100+ producer : IosSnapshotProducerCapabilities ,
101+ viewport : IosViewportEvidence ,
102+ ) : readonly IosAcquisitionResidue [ ] {
103+ return Object . freeze ( [
104+ ...deriveIosSnapshotCapabilityResidue ( producer ) ,
105+ ...( viewport . kind === 'missing'
106+ ? [ { kind : 'missing-viewport' as const , reason : viewport . reason } ]
107+ : [ ] ) ,
108+ ] ) ;
109+ }
110+
91111export function createIosSnapshotRequest ( input : IosSnapshotRequestInput = { } ) : IosSnapshotRequest {
92112 return Object . freeze ( {
93113 projection : input . projection ?? ( input . raw === true ? 'raw' : 'regular' ) ,
@@ -149,6 +169,7 @@ export function planIosSnapshot(
149169 interactiveQuery : producer . interactiveQueryCompleteness ,
150170 viewport : producer . viewportEvidence ,
151171 hittability : producer . hittabilityEvidence ,
172+ truncation : producer . truncationEvidence ,
152173 } ) ,
153174 } ) ;
154175}
0 commit comments