Repository navigation
Expand file tree
/
Copy pathrunner-demand.ts
More file actions
117 lines (114 loc) · 4.22 KB
/
Copy pathrunner-demand.ts
File metadata and controls
117 lines (114 loc) · 4.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
import type { OpenApplicationRunnerDemand } from '@agent-device/contracts/application-lifecycle-runtime';
import type { RuntimeOperationName } from '@agent-device/contracts/runtime-operation-names';
/**
* Which host the Apple runtime executes each declared runtime operation through on a local iOS
* Simulator. `runner` operations need the XCTest runner; `simulator` operations are served by
* simctl, the host AX bridge, or host-side tooling and never wait for runner readiness.
*
* Bridge-eligible snapshots keep their typed XCTest fallback, but a fallback is a recovery, not a
* plan requirement, so they classify as `simulator`. The record is complete over the runtime
* operation vocabulary by construction: a new operation refuses to compile until it is classified.
*/
type AppleSimulatorOperationHost = 'runner' | 'simulator';
const APPLE_SIMULATOR_OPERATION_HOSTS: Readonly<
Record<RuntimeOperationName, AppleSimulatorOperationHost>
> = Object.freeze({
// Application lifecycle: simctl launch/terminate and host readiness.
resolveOpenTarget: 'simulator',
prepareApplicationOpen: 'simulator',
openApplication: 'simulator',
applyRuntimeHints: 'simulator',
clearRuntimeHints: 'simulator',
closeApplication: 'simulator',
finalizeApplicationClose: 'simulator',
prepareAppleRunner: 'runner',
configureProviderPortReverse: 'simulator',
ensureReady: 'simulator',
bootTarget: 'simulator',
bootTargetHeadless: 'simulator',
shutdownTarget: 'simulator',
// App inventory, deployment, state, logs, network, audio: simctl and host tooling.
listApps: 'simulator',
deployApp: 'simulator',
materializeAppSource: 'simulator',
deployMaterializedApp: 'simulator',
sendPushNotification: 'simulator',
appState: 'simulator',
appLogStart: 'simulator',
appLogInspect: 'simulator',
appLogDoctor: 'simulator',
appLogReattach: 'simulator',
appLogCleanup: 'simulator',
networkDump: 'simulator',
audioProbeStart: 'simulator',
audioProbeQuery: 'simulator',
audioProbeReattach: 'simulator',
audioProbeCleanup: 'simulator',
readClipboard: 'simulator',
writeClipboard: 'simulator',
setSetting: 'simulator',
readSetting: 'simulator',
setFoldPose: 'simulator',
// Observation: the AX bridge presents regular and raw trees; custom actions need XCTest.
captureSnapshot: 'simulator',
captureSnapshotWithoutActiveApp: 'simulator',
captureSnapshotWithCustomActions: 'runner',
captureScreenshot: 'simulator',
findText: 'runner',
readTextAtPoint: 'runner',
// Every interaction and runner-driven capture.
tapPoint: 'runner',
tapRef: 'runner',
tapElementSelector: 'runner',
fillPoint: 'runner',
fillRef: 'runner',
longPressPoint: 'runner',
hoverPoint: 'runner',
hoverRef: 'runner',
focusPoint: 'runner',
typeText: 'runner',
scrollDirection: 'runner',
performGesturePlan: 'runner',
performMultiTouchGesturePlan: 'runner',
performTargetAuthoredDrag: 'runner',
performDirectionalFlingPlan: 'runner',
gestureViewport: 'runner',
setViewport: 'runner',
back: 'runner',
home: 'runner',
setOrientation: 'runner',
appSwitcher: 'runner',
actionButton: 'runner',
tvRemote: 'runner',
keyboardDismiss: 'runner',
keyboardEnter: 'runner',
keyboardStatus: 'runner',
triggerAppEvent: 'runner',
readAlert: 'runner',
awaitAlert: 'runner',
acceptAlert: 'runner',
dismissAlert: 'runner',
perfFrames: 'runner',
perfMemorySample: 'runner',
perfMemorySnapshot: 'runner',
perfNativeCaptureStart: 'runner',
perfNativeCaptureReattach: 'runner',
perfNativeCaptureCleanup: 'runner',
perfProfileReport: 'runner',
screenRecordingStart: 'runner',
screenRecordingReattach: 'runner',
screenRecordingCleanup: 'runner',
});
/**
* The runner demand of one local-Simulator open. An unknown plan keeps today's speculative
* prewarm; a plan whose required operations are all simulator-served proves no runner is needed;
* any runner-served operation makes readiness worth preparing now.
*/
export function resolveAppleSimulatorRunnerDemand(
operations: readonly RuntimeOperationName[] | undefined,
): OpenApplicationRunnerDemand {
if (operations === undefined) return 'possible';
return operations.some((operation) => APPLE_SIMULATOR_OPERATION_HOSTS[operation] === 'runner')
? 'required'
: 'none';
}