@agent-device/macos 0.0.0 → 0.22.0-nightly-0-22.20261122.241
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/dist/agent-device.d.mts +2105 -0
- package/dist/agent-device.mjs +1 -0
- package/dist/apps.mjs +4 -0
- package/dist/errors.mjs +1 -0
- package/dist/helper.mjs +1 -0
- package/dist/launch-services-registration.mjs +4 -0
- package/dist/native-app-actions.mjs +1 -0
- package/dist/native-backend-facts.mjs +1 -0
- package/dist/runner-commands.mjs +1 -0
- package/dist/scroll-gesture.mjs +1 -0
- package/dist/snapshot-producers.mjs +1 -0
- package/dist/snapshot.mjs +1 -0
- package/dist/surface-snapshot.mjs +1 -0
- package/macos-helper/Package.swift +34 -0
- package/macos-helper/Sources/AgentDeviceMacOSHelper/AppWindowScreenshot.swift +120 -0
- package/macos-helper/Sources/AgentDeviceMacOSHelper/AudioProbe.swift +301 -0
- package/macos-helper/Sources/AgentDeviceMacOSHelper/BackgroundInteraction.swift +817 -0
- package/macos-helper/Sources/AgentDeviceMacOSHelper/GhostCursor.swift +141 -0
- package/macos-helper/Sources/AgentDeviceMacOSHelper/SnapshotTraversal.swift +854 -0
- package/macos-helper/Sources/AgentDeviceMacOSHelper/main.swift +884 -0
- package/macos-helper/Sources/AgentDeviceMacOSInput/MouseClickDelivery.swift +116 -0
- package/macos-helper/Sources/AgentDeviceMacOSInput/MouseClickSchedule.swift +61 -0
- package/macos-helper/Tests/AgentDeviceMacOSHelperTests/PackStub.swift +7 -0
- package/macos-helper/Tests/AgentDeviceMacOSInputTests/PackStub.swift +7 -0
- package/package.json +42 -3
- package/README.md +0 -3
|
@@ -0,0 +1,2105 @@
|
|
|
1
|
+
import { PlatformHost } from "agent-device/plugins";
|
|
2
|
+
//#region ../kernel/src/source-value.d.ts
|
|
3
|
+
type EnvMap = Record<string, string | undefined>;
|
|
4
|
+
//#endregion
|
|
5
|
+
//#region ../kernel/src/device-identity.d.ts
|
|
6
|
+
declare const PLATFORMS: readonly ['apple', 'android', 'harmonyos', 'vega', 'linux', 'web'];
|
|
7
|
+
type Platform = (typeof PLATFORMS)[number];
|
|
8
|
+
//#endregion
|
|
9
|
+
//#region ../kernel/src/device.d.ts
|
|
10
|
+
declare const APPLE_OS_VALUES: readonly ['ios', 'ipados', 'tvos', 'watchos', 'visionos', 'macos'];
|
|
11
|
+
type AppleOS = (typeof APPLE_OS_VALUES)[number];
|
|
12
|
+
declare const PUBLIC_PLATFORMS: readonly ['ios', 'macos', 'android', 'harmonyos', 'vega', 'linux', 'web'];
|
|
13
|
+
type PublicPlatform = (typeof PUBLIC_PLATFORMS)[number];
|
|
14
|
+
declare const DEVICE_KINDS: readonly ['simulator', 'emulator', 'device'];
|
|
15
|
+
type DeviceKind = (typeof DEVICE_KINDS)[number];
|
|
16
|
+
declare const DEVICE_TARGETS: readonly ['mobile', 'tv', 'desktop'];
|
|
17
|
+
type DeviceTarget = (typeof DEVICE_TARGETS)[number];
|
|
18
|
+
type DeviceInfo = {
|
|
19
|
+
platform: Platform;
|
|
20
|
+
id: string;
|
|
21
|
+
name: string;
|
|
22
|
+
kind: DeviceKind;
|
|
23
|
+
target?: DeviceTarget;
|
|
24
|
+
appleOs?: AppleOS;
|
|
25
|
+
model?: string;
|
|
26
|
+
osVersion?: string;
|
|
27
|
+
booted?: boolean;
|
|
28
|
+
simulatorSetPath?: string;
|
|
29
|
+
iosPhysicalDeviceBackend?: 'coredevice' | 'xctest';
|
|
30
|
+
/**
|
|
31
|
+
* Set when this device is one app of a host device rather than the host itself (ADR 0035). Its
|
|
32
|
+
* id is {@link hostAppDeviceId} of the two, so every per-device lock, claim, and session check
|
|
33
|
+
* treats the app as a device of its own; only {@link devicesOverlap} relates it to its host.
|
|
34
|
+
*/
|
|
35
|
+
hostApp?: {
|
|
36
|
+
hostDeviceId: string;
|
|
37
|
+
bundleId: string;
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
//#endregion
|
|
41
|
+
//#region ../contracts/src/app-inventory.d.ts
|
|
42
|
+
type AppsFilter = 'user-installed' | 'all';
|
|
43
|
+
//#endregion
|
|
44
|
+
//#region ../contracts/src/screenshot.d.ts
|
|
45
|
+
declare const SCREENSHOT_SCREEN_MASKS: readonly ['black'];
|
|
46
|
+
type ScreenshotScreenMask = (typeof SCREENSHOT_SCREEN_MASKS)[number];
|
|
47
|
+
//#endregion
|
|
48
|
+
//#region ../kernel/src/snapshot.d.ts
|
|
49
|
+
/**
|
|
50
|
+
* Structured quality verdict computed once by a platform snapshot capture/presentation plan.
|
|
51
|
+
* The daemon renders it; it never re-derives degradation from node shapes.
|
|
52
|
+
*
|
|
53
|
+
* Defined here (the foundational snapshot type module) rather than in
|
|
54
|
+
* capture-kit's snapshot-quality-verdict.ts so SnapshotNode can reference it without a cyclic
|
|
55
|
+
* import. Ownership splits three ways: this module owns the vocabularies below, capture-kit parses
|
|
56
|
+
* an untrusted runner payload into them, and contracts re-hydrates a verdict this repo published.
|
|
57
|
+
*/
|
|
58
|
+
/**
|
|
59
|
+
* Which capture STRATEGY produced a snapshot, within one platform's plan —
|
|
60
|
+
* distinct from `SnapshotBackend`, which names the platform channel
|
|
61
|
+
* (`xctest`/`android`/…). A platform plan may change strategy mid-sequence, and two strategies do
|
|
62
|
+
* not return comparable views of one screen (#1569). Android's helper presentation is included
|
|
63
|
+
* here so its quality verdict uses the same typed contract as the iOS strategy chain.
|
|
64
|
+
*/
|
|
65
|
+
type SnapshotCaptureBackend = 'tree' | 'queries' | 'private-ax' | 'android-helper';
|
|
66
|
+
/** Internal backends that evidence probes may select explicitly. */
|
|
67
|
+
type SnapshotPreferredBackend = 'tree' | 'private-ax';
|
|
68
|
+
type SnapshotQualityTiming = {
|
|
69
|
+
acquisitionMs: number;
|
|
70
|
+
presentationMs: number;
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* The verdict states a capture plan may stamp. This tuple is the ONE declaration of that
|
|
74
|
+
* vocabulary, and `SnapshotQualityVerdict['state']` is its projection; readers hold exhaustive maps
|
|
75
|
+
* over the union instead of importing this module, because the eager-closure gate freezes their
|
|
76
|
+
* loading shape (#2872). This tuple and the Apple runner's `SnapshotQualityState.allCases` are each
|
|
77
|
+
* pinned as a set to `contracts/fixtures/ios-snapshot-quality-states.json`, so a state one side
|
|
78
|
+
* renames, adds, or deletes without the other goes red there instead of arriving as a verdict the
|
|
79
|
+
* host cannot name — which reads as verdict-absent and drops the disclosure with it.
|
|
80
|
+
*/
|
|
81
|
+
declare const SNAPSHOT_QUALITY_STATES: readonly ['healthy', 'recovered', 'sparse'];
|
|
82
|
+
type SnapshotQualityState = (typeof SNAPSHOT_QUALITY_STATES)[number];
|
|
83
|
+
type SnapshotQualityNote = {
|
|
84
|
+
code: 'regular-geometry-clipped';
|
|
85
|
+
clippedNodeCount: number;
|
|
86
|
+
droppedNodeCount: number;
|
|
87
|
+
};
|
|
88
|
+
type SnapshotQualityVerdict = {
|
|
89
|
+
state: SnapshotQualityState;
|
|
90
|
+
backend: SnapshotCaptureBackend;
|
|
91
|
+
reason?: string;
|
|
92
|
+
reasonCode?: 'ax-rejected' | 'sparse-tree' | 'budget' | 'no-nodes' | 'capture-failed' | 'presentation-failed' | 'deferred' | 'requested-backend';
|
|
93
|
+
effectiveDepth?: number;
|
|
94
|
+
collapsedLeafIndexes?: number[];
|
|
95
|
+
/**
|
|
96
|
+
* Coverage of an opt-in custom-action pass (`snapshot --actions`): how many
|
|
97
|
+
* merged elements were eligible and how many the bounded pass reached. An
|
|
98
|
+
* unread element is indistinguishable from one with no actions, so a partial
|
|
99
|
+
* pass has to be disclosed rather than left to look complete.
|
|
100
|
+
*/
|
|
101
|
+
customActions?: {
|
|
102
|
+
read: number;
|
|
103
|
+
candidates: number;
|
|
104
|
+
truncated: number;
|
|
105
|
+
blocked: boolean;
|
|
106
|
+
};
|
|
107
|
+
/** Response-level phase timing for the backend named by `backend`. */
|
|
108
|
+
timing?: SnapshotQualityTiming;
|
|
109
|
+
};
|
|
110
|
+
type Rect = {
|
|
111
|
+
x: number;
|
|
112
|
+
y: number;
|
|
113
|
+
width: number;
|
|
114
|
+
height: number;
|
|
115
|
+
};
|
|
116
|
+
type Point = {
|
|
117
|
+
x: number;
|
|
118
|
+
y: number;
|
|
119
|
+
};
|
|
120
|
+
type IosSnapshotObservation = {
|
|
121
|
+
mode: 'observe-only';
|
|
122
|
+
activationPerformed: false;
|
|
123
|
+
/** XCTest's report, not proof of foreground ownership (#2696). */
|
|
124
|
+
appState: 'runningForeground';
|
|
125
|
+
appStateSource: 'xcuiapplication-state';
|
|
126
|
+
};
|
|
127
|
+
type SnapshotOptions$1 = {
|
|
128
|
+
observeOnly?: boolean;
|
|
129
|
+
interactiveOnly?: boolean;
|
|
130
|
+
depth?: number;
|
|
131
|
+
scope?: string;
|
|
132
|
+
raw?: boolean;
|
|
133
|
+
/**
|
|
134
|
+
* Internal (never CLI-exposed): capture with this backend first regardless of
|
|
135
|
+
* channel health. Evidence comparisons are only valid same-backend (backends
|
|
136
|
+
* are not comparable views of a screen), so a corroboration probe must be
|
|
137
|
+
* captured the way its baseline was.
|
|
138
|
+
*/
|
|
139
|
+
preferredBackend?: SnapshotPreferredBackend;
|
|
140
|
+
/**
|
|
141
|
+
* Read accessibility custom actions for elements that merge their children
|
|
142
|
+
* away. Opt-in because each such element costs its own accessibility round
|
|
143
|
+
* trip; see `RawSnapshotNode.actions`.
|
|
144
|
+
*/
|
|
145
|
+
customActions?: boolean;
|
|
146
|
+
};
|
|
147
|
+
/** The CLI/daemon flag key for each snapshot capture option, by option name. */
|
|
148
|
+
declare const SNAPSHOT_OPTION_FLAGS: {
|
|
149
|
+
readonly interactiveOnly: 'snapshotInteractiveOnly';
|
|
150
|
+
readonly depth: 'snapshotDepth';
|
|
151
|
+
readonly scope: 'snapshotScope';
|
|
152
|
+
readonly raw: 'snapshotRaw';
|
|
153
|
+
readonly observeOnly: 'snapshotObserveOnly';
|
|
154
|
+
readonly customActions: 'snapshotCustomActions';
|
|
155
|
+
readonly forceFull: 'snapshotForceFull';
|
|
156
|
+
readonly includeHiddenContentHints: 'snapshotIncludeHiddenContentHints';
|
|
157
|
+
readonly preferredBackend: 'snapshotPreferredBackend';
|
|
158
|
+
};
|
|
159
|
+
type SnapshotOptionKey = keyof typeof SNAPSHOT_OPTION_FLAGS;
|
|
160
|
+
type SnapshotOptionValues = {
|
|
161
|
+
observeOnly: boolean;
|
|
162
|
+
interactiveOnly: boolean;
|
|
163
|
+
depth: number;
|
|
164
|
+
scope: string;
|
|
165
|
+
raw: boolean;
|
|
166
|
+
customActions: boolean;
|
|
167
|
+
forceFull: boolean;
|
|
168
|
+
includeHiddenContentHints: boolean;
|
|
169
|
+
preferredBackend: SnapshotPreferredBackend;
|
|
170
|
+
};
|
|
171
|
+
/** The option-vocabulary view of the declared pairs, narrowed to `TKeys`. */
|
|
172
|
+
type SnapshotOptionFields<TKeys extends SnapshotOptionKey = SnapshotOptionKey> = { [TKey in TKeys]?: SnapshotOptionValues[TKey]; };
|
|
173
|
+
/** Option keys that identify a presentation; see {@link buildSnapshotPresentationKey}. */
|
|
174
|
+
declare const SNAPSHOT_PRESENTATION_OPTION_KEYS: readonly ['depth', 'interactiveOnly', 'raw', 'scope', 'customActions'];
|
|
175
|
+
/** The options that decide a capture's node set, and so the refs minted on it. */
|
|
176
|
+
type SnapshotPresentation = SnapshotOptionFields<(typeof SNAPSHOT_PRESENTATION_OPTION_KEYS)[number]>;
|
|
177
|
+
/**
|
|
178
|
+
* The bounded, non-actionable description of the element that occludes a covered node. It carries
|
|
179
|
+
* only what the occlusion scan observed — presented role, an optional clipped accessible name, and
|
|
180
|
+
* the cover's rect — and deliberately no ref: the cover may be a container the snapshot never
|
|
181
|
+
* issues refs for, and naming it is diagnosis, not an invitation to target it.
|
|
182
|
+
*/
|
|
183
|
+
type SnapshotCoveringNode = {
|
|
184
|
+
/** The canonical persistent-bar kind or the cover's presented role. */
|
|
185
|
+
kind: string;
|
|
186
|
+
/** The cover's accessible name, trimmed and clipped to {@link SNAPSHOT_COVERING_LABEL_MAX_LENGTH}. */
|
|
187
|
+
label?: string;
|
|
188
|
+
/** The cover's positive rect as the scan measured it. */
|
|
189
|
+
rect?: Rect;
|
|
190
|
+
/**
|
|
191
|
+
* Set when the cover is persistent bar chrome (tab bar, toolbar, navigation bar, bottom
|
|
192
|
+
* navigation), read from the cover's type, role, and subrole. Absent for any other cover.
|
|
193
|
+
*/
|
|
194
|
+
persistentBar?: true;
|
|
195
|
+
/**
|
|
196
|
+
* Set when the cover is a persistent bar and scrolling can reveal the covered node clear of the
|
|
197
|
+
* bar: a scrollable ancestor of the node reports hidden content toward the bar
|
|
198
|
+
* (`hiddenContentBelow` with its frame reaching above the bar, or `hiddenContentAbove` with its
|
|
199
|
+
* frame reaching below the bar), so a scroll in that ancestor moves the node off the bar.
|
|
200
|
+
* The touch refusal still stands at the current scroll position; the audit reads this fact to
|
|
201
|
+
* stay silent about controls a scroll can reveal. Absent for any other cover and when no scroll
|
|
202
|
+
* can reveal the node, such as a list already scrolled to its end or a fixed control.
|
|
203
|
+
*/
|
|
204
|
+
scrollCanReveal?: true;
|
|
205
|
+
};
|
|
206
|
+
/** Evidence from an exact English React Native iOS value signature, not proof of its renderer. */
|
|
207
|
+
type IosValueSemantics = {
|
|
208
|
+
source: 'react-native-ios-value-heuristic';
|
|
209
|
+
encoding: 'en';
|
|
210
|
+
role?: string;
|
|
211
|
+
checked?: boolean | 'mixed';
|
|
212
|
+
expanded?: boolean;
|
|
213
|
+
busy?: true;
|
|
214
|
+
};
|
|
215
|
+
type RawSnapshotNode = {
|
|
216
|
+
index: number;
|
|
217
|
+
type?: string;
|
|
218
|
+
role?: string;
|
|
219
|
+
subrole?: string;
|
|
220
|
+
label?: string;
|
|
221
|
+
value?: string;
|
|
222
|
+
/** Derived RN evidence; value and native type/role remain verbatim. Explicit facts take precedence. */
|
|
223
|
+
iosValueSemantics?: IosValueSemantics;
|
|
224
|
+
/**
|
|
225
|
+
* Android content description when it is not already the `label`. An Android node is
|
|
226
|
+
* labelled by its text and falls back to the content description only when it has none,
|
|
227
|
+
* so an accessibility label the app set beside visible text (a labelled text view, a
|
|
228
|
+
* filled or hinted field) is carried here for consumers that want the accessible name.
|
|
229
|
+
*/
|
|
230
|
+
contentDescription?: string;
|
|
231
|
+
/**
|
|
232
|
+
* Android view text when it is not already the `label`: the empty string on a view that has
|
|
233
|
+
* a content description and no text, where the description is the label. Absent otherwise,
|
|
234
|
+
* so `text ?? label` is the text the view shows.
|
|
235
|
+
*/
|
|
236
|
+
text?: string;
|
|
237
|
+
identifier?: string;
|
|
238
|
+
rect?: Rect;
|
|
239
|
+
enabled?: boolean;
|
|
240
|
+
selected?: boolean;
|
|
241
|
+
/** Checked state of a checkable control (switch, checkbox, radio); absent means not checkable or unavailable. */
|
|
242
|
+
checked?: boolean;
|
|
243
|
+
focused?: boolean;
|
|
244
|
+
/** Accessibility heading flag an app set on the node; absent means not a heading or unavailable. */
|
|
245
|
+
heading?: boolean;
|
|
246
|
+
/** Localized role description an app set beside the native class, verbatim (`Tab`, `Tab List`, `Link`). */
|
|
247
|
+
roleDescription?: string;
|
|
248
|
+
/** Native accessibility facts; absent means unavailable, not false. */
|
|
249
|
+
editable?: boolean;
|
|
250
|
+
password?: boolean;
|
|
251
|
+
hintShowing?: boolean;
|
|
252
|
+
/**
|
|
253
|
+
* Placeholder text of a text field (the Android hint), whether or not the field is showing it.
|
|
254
|
+
* Absent when the field has none or the producer did not read it.
|
|
255
|
+
*/
|
|
256
|
+
placeholder?: string;
|
|
257
|
+
/** Accessibility selection offsets, never a character count or proof of value equality. */
|
|
258
|
+
selectionStart?: number;
|
|
259
|
+
selectionEnd?: number;
|
|
260
|
+
visibleToUser?: boolean;
|
|
261
|
+
/** UIKit `isUserInteractionEnabled`; absent means the producer did not read it, not false. */
|
|
262
|
+
userInteractionEnabled?: boolean;
|
|
263
|
+
hittable?: boolean;
|
|
264
|
+
clickable?: boolean;
|
|
265
|
+
focusable?: boolean;
|
|
266
|
+
longClickable?: boolean;
|
|
267
|
+
scrollable?: boolean;
|
|
268
|
+
depth?: number;
|
|
269
|
+
parentIndex?: number;
|
|
270
|
+
pid?: number;
|
|
271
|
+
bundleId?: string;
|
|
272
|
+
/**
|
|
273
|
+
* Android status/navigation bar subtree membership, retained when ancestors are omitted.
|
|
274
|
+
* Shade headers, dialogs, and other SystemUI overlays are not bars. Absent means the
|
|
275
|
+
* producer did not establish bar membership.
|
|
276
|
+
*/
|
|
277
|
+
systemBar?: 'status' | 'navigation';
|
|
278
|
+
appName?: string;
|
|
279
|
+
windowTitle?: string;
|
|
280
|
+
surface?: string;
|
|
281
|
+
/** Keyboard tap-surface membership, including hosted app controls; independent of settle ownership.
|
|
282
|
+
* Omission means unevaluated. Survives ancestor removal. */
|
|
283
|
+
keyboardOwned?: boolean;
|
|
284
|
+
/**
|
|
285
|
+
* Content above the visible area that scrolling can reveal. Vertical axis by construction: no
|
|
286
|
+
* producer publishes it for a horizontal-only scroller.
|
|
287
|
+
*/
|
|
288
|
+
hiddenContentAbove?: boolean;
|
|
289
|
+
/** Content below the visible area that scrolling can reveal. Vertical axis by construction. */
|
|
290
|
+
hiddenContentBelow?: boolean;
|
|
291
|
+
interactionBlocked?: 'covered';
|
|
292
|
+
/**
|
|
293
|
+
* Bounded description of the element the geometric occlusion scan found drawing on top of this
|
|
294
|
+
* node, published together with `interactionBlocked: 'covered'` so a refusal can name the culprit
|
|
295
|
+
* instead of only the fact of coverage. Absent when the covered decision came from a
|
|
296
|
+
* backend-policy annotation that reports a boolean, and when the cover the scan found is an
|
|
297
|
+
* anonymous container no reader could recognize; both refusals keep the generic recovery rather
|
|
298
|
+
* than guessing a culprit. This is a description, not an authorization: it carries no ref and is
|
|
299
|
+
* never an actionable target.
|
|
300
|
+
*/
|
|
301
|
+
coveredBy?: SnapshotCoveringNode;
|
|
302
|
+
presentationHints?: string[];
|
|
303
|
+
/**
|
|
304
|
+
* Backend-minted ref for this node, when the capture backend already assigns a
|
|
305
|
+
* stable, actionable ref (e.g. the web/agent-browser backend resolves actions
|
|
306
|
+
* against its own `@eN` refs). `attachRefs` preserves this instead of re-minting
|
|
307
|
+
* a dense positional ref, so the ref an agent sees in the snapshot is the same
|
|
308
|
+
* ref the backend can resolve on the next action. Absent for backends that do
|
|
309
|
+
* not mint refs — those fall back to dense `e${index}` numbering.
|
|
310
|
+
*/
|
|
311
|
+
ref?: string;
|
|
312
|
+
/**
|
|
313
|
+
* Accessibility custom actions the element exposes (iOS
|
|
314
|
+
* `UIAccessibilityCustomAction`, React Native `accessibilityActions`). Merged
|
|
315
|
+
* cards publish their real affordances here instead of as child elements, so
|
|
316
|
+
* this is often the only evidence that a collapsed node has any. Populated by
|
|
317
|
+
* opt-in captures only — see `snapshot --actions`.
|
|
318
|
+
*/
|
|
319
|
+
actions?: string[];
|
|
320
|
+
};
|
|
321
|
+
/**
|
|
322
|
+
* Keyboard evidence in the node coordinate space: `visible` measured; `derived` from the shared
|
|
323
|
+
* docked-tree policy before projection; `visibility-only` boolean; `tree-rejected` rejected geometry
|
|
324
|
+
* against a usable viewport with optional visibility; `unmeasurable` unknown; `absent` explicit absence.
|
|
325
|
+
* `treeBound`: read from the capture's own tree (iOS XCTest, Android, docked-tree), not a probe. A full
|
|
326
|
+
* pre-projection iOS root scan proves absence; projected or partial nodes and omitted facts never do.
|
|
327
|
+
*/
|
|
328
|
+
type SnapshotKeyboardBandFact = {
|
|
329
|
+
kind: 'visible';
|
|
330
|
+
frame: Rect;
|
|
331
|
+
treeBound?: true;
|
|
332
|
+
} | {
|
|
333
|
+
kind: 'derived';
|
|
334
|
+
derivation: 'docked-tree';
|
|
335
|
+
frame: Rect;
|
|
336
|
+
treeBound?: true;
|
|
337
|
+
} | {
|
|
338
|
+
kind: 'visibility-only';
|
|
339
|
+
visible: boolean;
|
|
340
|
+
} | {
|
|
341
|
+
kind: 'tree-rejected';
|
|
342
|
+
derivation: 'docked-tree';
|
|
343
|
+
visible?: boolean;
|
|
344
|
+
} | {
|
|
345
|
+
kind: 'absent';
|
|
346
|
+
treeBound?: true;
|
|
347
|
+
} | {
|
|
348
|
+
kind: 'unmeasurable';
|
|
349
|
+
reason: string;
|
|
350
|
+
};
|
|
351
|
+
/**
|
|
352
|
+
* Whether this capture read a modal presentation over the app's own content (#3565).
|
|
353
|
+
*
|
|
354
|
+
* The capture producer owns this: an interactive capture, a full capture, a depth cut, and a scoped
|
|
355
|
+
* capture of ONE screen all answer the same value, because the fact is decided on the acquired tree
|
|
356
|
+
* before any of those projections runs. Settle's dismissal confirmation (#1831) arms on this value
|
|
357
|
+
* instead of reconstructing a presentation from the shape of a tree it happens to hold.
|
|
358
|
+
*
|
|
359
|
+
* `'absent'` is a positive reading, not a default: the producer walked every window it captured and
|
|
360
|
+
* every window showed only its own presentation container. Anything the producer could not read —
|
|
361
|
+
* a tree from a producer that reports no UIKit class facts, an unexplained extra container, a
|
|
362
|
+
* truncated capture — answers `'unknown'`, never `'absent'`.
|
|
363
|
+
*/
|
|
364
|
+
type PresentedSurface = 'presented' | 'absent' | 'unknown';
|
|
365
|
+
/**
|
|
366
|
+
* The box a capture's node rects are measured in, published beside them so a reader never has to
|
|
367
|
+
* infer it from the tree (#3182). Two dimensions and no origin: the field answers "how big is the
|
|
368
|
+
* surface these numbers describe", which is the only question a consumer that places points on the
|
|
369
|
+
* tree cannot answer from the tree itself when the tree is empty or sparse.
|
|
370
|
+
*
|
|
371
|
+
* It is the box of the surface the producer read, which is not always the physical panel. iOS
|
|
372
|
+
* reports the app window in the app's orientation space (ADR 0004), which is smaller than the panel
|
|
373
|
+
* under iPad Split View and is never the foldable panel `fold` reports (ADR 0025); Android and the
|
|
374
|
+
* Apple TV runner report the screen the bounds were measured on. The Tizen and webOS TV plugins
|
|
375
|
+
* report the page's layout viewport in CSS px, which is not the screenshot size: a webOS app at
|
|
376
|
+
* 1280x720 fills only the top-left 1280x720 of a 1920x1080 capture. A producer that has no box of its
|
|
377
|
+
* own to answer with leaves the field off: the macOS desktop, whose rects are absolute in window
|
|
378
|
+
* space and answer to no single frame, and the web and Linux backends, which read a tree without
|
|
379
|
+
* reading a screen. A consumer that needs a *gesture* band inside those bounds still reads `keyboard`
|
|
380
|
+
* and the app window, which is #1821's remaining scope.
|
|
381
|
+
*
|
|
382
|
+
* Absent means the producer measured no box. Absence is never `0`: `snapshotViewportSizeFrom` from
|
|
383
|
+
* `@agent-device/kernel/rect` is the sole construction path and refuses a box
|
|
384
|
+
* `isPositiveFiniteRect` refuses. The brand makes that invariant part of the type: a plain
|
|
385
|
+
* `{ width, height }` literal — including one with a zero in it — is not assignable here, so only
|
|
386
|
+
* modules that import the brand token from `kernel/rect` can build one, and they build it through
|
|
387
|
+
* the guard.
|
|
388
|
+
*/
|
|
389
|
+
type SnapshotViewportSize = {
|
|
390
|
+
width: number;
|
|
391
|
+
height: number;
|
|
392
|
+
} & SnapshotViewportSizeBrand;
|
|
393
|
+
/** @internal Exported only so `kernel/rect` can mint values of {@link SnapshotViewportSize}. */
|
|
394
|
+
declare const SNAPSHOT_VIEWPORT_SIZE_BRAND: unique symbol;
|
|
395
|
+
type SnapshotViewportSizeBrand = {
|
|
396
|
+
readonly [SNAPSHOT_VIEWPORT_SIZE_BRAND]: 'validated';
|
|
397
|
+
};
|
|
398
|
+
/**
|
|
399
|
+
* Screenshot pixels per rect unit, published by a producer whose own screenshots magnify its rects:
|
|
400
|
+
* a TV app page's `visualViewport.scale`, which a meta viewport sets and which the page's
|
|
401
|
+
* `devicePixelRatio` does not predict. Positive and finite by construction:
|
|
402
|
+
* `snapshotCaptureScaleFrom` from `@agent-device/kernel/rect` is the sole construction path, and the
|
|
403
|
+
* brand keeps a plain number from standing in for one.
|
|
404
|
+
*/
|
|
405
|
+
type SnapshotCaptureScale = number & SnapshotCaptureScaleBrand;
|
|
406
|
+
/** @internal Exported only so `kernel/rect` can mint values of {@link SnapshotCaptureScale}. */
|
|
407
|
+
declare const SNAPSHOT_CAPTURE_SCALE_BRAND: unique symbol;
|
|
408
|
+
type SnapshotCaptureScaleBrand = {
|
|
409
|
+
readonly [SNAPSHOT_CAPTURE_SCALE_BRAND]: 'validated';
|
|
410
|
+
};
|
|
411
|
+
type SnapshotNode = RawSnapshotNode & {
|
|
412
|
+
/**
|
|
413
|
+
* The ref an agent addresses this node by, or absent when nothing can address it.
|
|
414
|
+
*
|
|
415
|
+
* A backend that mints its own refs (web/agent-browser) owns that namespace and can only act on
|
|
416
|
+
* the refs it minted, so {@link attachRefs} mints nothing into it — a node the backend left
|
|
417
|
+
* unaddressed stays ref-less in the tree, which is how on-screen-but-not-actionable content
|
|
418
|
+
* (static text, a status region) reaches a reader without ever being offered as a tap target.
|
|
419
|
+
* Backends that mint no refs (Apple, Android, Linux) keep dense `e${index}` numbering, so every
|
|
420
|
+
* node of their trees carries a ref, as before.
|
|
421
|
+
*
|
|
422
|
+
* Every consumer that offers a node as an address must read this as an absence rather than print
|
|
423
|
+
* one: a ref-less node is selectable by text and by `find`/`wait`/`get`, and refused as a target.
|
|
424
|
+
*
|
|
425
|
+
* A ref-less node also carries no `rect`. Producers that mint refs measure geometry for the refs
|
|
426
|
+
* they issued (see `RawSnapshotNode.ref`), and producers that mint none get dense numbering, so
|
|
427
|
+
* every node a geometry-requiring path can reach — promotion, the touch point, the covered and
|
|
428
|
+
* keyboard refusals — has a ref. That is why those paths print `node.ref` without a guard.
|
|
429
|
+
*/
|
|
430
|
+
ref?: string;
|
|
431
|
+
/**
|
|
432
|
+
* Normalized role, from the same table the text presenter reads (`formatRole` below). `type`
|
|
433
|
+
* stays the raw platform class; `kind` is the presenter's own answer, published so a `--json`
|
|
434
|
+
* consumer gets the presented role without re-deriving it from `type` (#2656). `attachRefs` is
|
|
435
|
+
* the one production construction path and always sets it; optional here only so the many
|
|
436
|
+
* hand-built `SnapshotNode` fixtures across the daemon/selector test suites that predate #2656 and
|
|
437
|
+
* never route through `attachRefs` do not all need updating for a field their assertions never
|
|
438
|
+
* read. An absent `ref` is a real answer about the node; an absent `kind` is a fixture shortcut.
|
|
439
|
+
*/
|
|
440
|
+
kind?: string;
|
|
441
|
+
/**
|
|
442
|
+
* Output-only marker set by client-serialization dedup (see
|
|
443
|
+
* ../snapshot/snapshot-label-dedup.ts) when `label`/`identifier` was omitted
|
|
444
|
+
* because it string-equals the nearest ancestor's value in the parent chain.
|
|
445
|
+
* Never set on the in-daemon session tree used by selectors/wait/replay.
|
|
446
|
+
*/
|
|
447
|
+
inheritsLabel?: true;
|
|
448
|
+
inheritsIdentifier?: true;
|
|
449
|
+
};
|
|
450
|
+
/**
|
|
451
|
+
* Reasons the Apple runner can stamp when serving a command required re-activating the session app
|
|
452
|
+
* (#2682). Mirrors its `activateTarget(bundleId:reason:)` call sites.
|
|
453
|
+
*/
|
|
454
|
+
declare const IOS_TARGET_ACTIVATION_REASONS: readonly ['bundle_changed', 'stale_target', 'missing_after_wait', 'interaction_foreground_guard'];
|
|
455
|
+
type IosTargetActivationReason = (typeof IOS_TARGET_ACTIVATION_REASONS)[number];
|
|
456
|
+
/**
|
|
457
|
+
* How XCTest reports an app running (`XCUIApplication.State`), in the SDK's raw order: unknown 0,
|
|
458
|
+
* notRunning 1, suspended 2, plain background 3, foreground 4 — the SDK declares suspended on
|
|
459
|
+
* non-macOS platforms only. This is the one declaration of those names; the `appState` runner
|
|
460
|
+
* command answers the session app's state with them, and `RunnerTests+ApplicationStateRawValueTests`
|
|
461
|
+
* ties them to the SDK enum. The `appState` path names states, so nothing here assigns a raw value;
|
|
462
|
+
* only the activation decoder's raw table does.
|
|
463
|
+
*/
|
|
464
|
+
declare const APPLE_APPLICATION_STATES: readonly ['unknown', 'notRunning', 'runningBackgroundSuspended', 'runningBackground', 'runningForeground'];
|
|
465
|
+
type AppleApplicationState = (typeof APPLE_APPLICATION_STATES)[number];
|
|
466
|
+
/**
|
|
467
|
+
* States an activation could have been needed for: every Apple state except the foreground one,
|
|
468
|
+
* which the runner skips `activate()` in and therefore stamps no fact about. Derived from the full
|
|
469
|
+
* list so the two cannot drift, and in the SDK's raw order — a state added to the full list lands
|
|
470
|
+
* here and must then be pinned natively before the decoder tie accepts it.
|
|
471
|
+
*/
|
|
472
|
+
declare const IOS_TARGET_ACTIVATION_PRIOR_STATES: readonly ("notRunning" | "runningBackground" | "runningBackgroundSuspended" | "unknown")[];
|
|
473
|
+
type IosTargetActivationPriorState = (typeof IOS_TARGET_ACTIVATION_PRIOR_STATES)[number];
|
|
474
|
+
/**
|
|
475
|
+
* Foreground repair the Apple runner performed while serving one command (#2682). `priorState` is
|
|
476
|
+
* the session app's state BEFORE the runner activated it, so the fact describes what was repaired
|
|
477
|
+
* rather than what the repair produced. `otherActiveApplicationPid` is present only when exactly one
|
|
478
|
+
* application other than the session app held an active accessibility session at that moment: a
|
|
479
|
+
* liveness claim and nothing more, since the private AX client reports no ordering of
|
|
480
|
+
* `activeApplications`, resolves pids only, and answers no bundle id for an arbitrary app.
|
|
481
|
+
*/
|
|
482
|
+
type IosTargetActivation = Readonly<{
|
|
483
|
+
reason: IosTargetActivationReason;
|
|
484
|
+
priorState: IosTargetActivationPriorState;
|
|
485
|
+
otherActiveApplicationPid?: number;
|
|
486
|
+
}>;
|
|
487
|
+
//#endregion
|
|
488
|
+
//#region ../contracts/src/app-state-runtime.d.ts
|
|
489
|
+
/** Neutral foreground identity returned by a selected platform/provider runtime. */
|
|
490
|
+
type AppStateRuntimeResult = Readonly<{
|
|
491
|
+
package?: string;
|
|
492
|
+
activity?: string;
|
|
493
|
+
/**
|
|
494
|
+
* Apple: how the app named by the input is running, as a live runner reads it. It says nothing
|
|
495
|
+
* about which app is frontmost; a session app in a background state has left the foreground.
|
|
496
|
+
* Absent when no runner session is live to ask, so the read never starts one.
|
|
497
|
+
*/
|
|
498
|
+
applicationState?: AppleApplicationState;
|
|
499
|
+
}>;
|
|
500
|
+
//#endregion
|
|
501
|
+
//#region ../contracts/src/keyboard.d.ts
|
|
502
|
+
/** A platform reports `unknown` when it cannot identify the action and `none` when it establishes there is no action. */
|
|
503
|
+
declare const KEYBOARD_RETURN_KEYS: readonly ['go', 'search', 'send', 'next', 'done', 'previous', 'join', 'route', 'continue', 'enter', 'none', 'unknown'];
|
|
504
|
+
type KeyboardReturnKey = (typeof KEYBOARD_RETURN_KEYS)[number];
|
|
505
|
+
//#endregion
|
|
506
|
+
//#region ../contracts/src/element-text-target.d.ts
|
|
507
|
+
/** Identity carried from a resolved node into its live text read. */
|
|
508
|
+
type ElementTextTarget = Pick<SnapshotNode, 'identifier' | 'bundleId' | 'type'>;
|
|
509
|
+
//#endregion
|
|
510
|
+
//#region ../contracts/src/back-mode.d.ts
|
|
511
|
+
declare const BACK_MODES: readonly ['in-app', 'system'];
|
|
512
|
+
type BackMode = (typeof BACK_MODES)[number];
|
|
513
|
+
//#endregion
|
|
514
|
+
//#region ../contracts/src/ios-system-surface.d.ts
|
|
515
|
+
/**
|
|
516
|
+
* iOS out-of-process system surfaces that agent-device observes and drives IN PLACE, never by
|
|
517
|
+
* activation: launching or activating the host cancels what it presents (issue #2438), so the
|
|
518
|
+
* runner addresses the host process while it is foreground and the `open` path refuses it. The set
|
|
519
|
+
* is deliberately closed and tiny; add a host only with live evidence that it presents out of
|
|
520
|
+
* process and dies on activation. Rationale per host lives in the canonical fixture
|
|
521
|
+
* `contracts/fixtures/ios-system-surface-hosts.json` (see also docs/adr/0004); this module and the
|
|
522
|
+
* Swift `SystemSurfaceHostRegistry` both mirror it, each guarded by a parity test.
|
|
523
|
+
*/
|
|
524
|
+
/** Why a system surface is served in place; carried at snapshot-response level as provenance. */
|
|
525
|
+
type IosSystemSurfaceKind = 'web-auth' | 'payment';
|
|
526
|
+
/**
|
|
527
|
+
* Whole-snapshot provenance: the capture describes a system surface presented over the session app,
|
|
528
|
+
* not the app itself. Carried at response level (it applies to the entire snapshot) and folded into
|
|
529
|
+
* iOS snapshot lineage so `--verify`/`--settle` never compare an app baseline against a sheet
|
|
530
|
+
* capture. Mirrors the Android system-chrome/system-surface provenance model.
|
|
531
|
+
*/
|
|
532
|
+
type IosSystemSurfaceProvenance = Readonly<{
|
|
533
|
+
bundleId: string;
|
|
534
|
+
kind: IosSystemSurfaceKind;
|
|
535
|
+
}>;
|
|
536
|
+
//#endregion
|
|
537
|
+
//#region ../contracts/src/device-rotation.d.ts
|
|
538
|
+
declare const DEVICE_ROTATIONS: readonly ['portrait', 'portrait-upside-down', 'landscape-left', 'landscape-right'];
|
|
539
|
+
type DeviceRotation = (typeof DEVICE_ROTATIONS)[number];
|
|
540
|
+
//#endregion
|
|
541
|
+
//#region ../contracts/src/scroll-command.d.ts
|
|
542
|
+
type ScrollReleaseBehavior = 'controlled' | 'inertial';
|
|
543
|
+
type ScrollDistanceOptions = {
|
|
544
|
+
amount?: number;
|
|
545
|
+
pixels?: number;
|
|
546
|
+
};
|
|
547
|
+
type ScrollTimingOptions = {
|
|
548
|
+
durationMs?: number;
|
|
549
|
+
};
|
|
550
|
+
type ScrollCommandOptions = ScrollDistanceOptions & ScrollTimingOptions;
|
|
551
|
+
/**
|
|
552
|
+
* The scroll container the caller resolved from the current tree, in the snapshot's absolute space.
|
|
553
|
+
* An owner that plans its own swipe keeps both endpoints inside it (#2714); an owner without that
|
|
554
|
+
* planner ignores it.
|
|
555
|
+
*/
|
|
556
|
+
type ScrollContainerTarget = {
|
|
557
|
+
containerRect?: Rect;
|
|
558
|
+
};
|
|
559
|
+
type ScrollExecutionOptions = ScrollCommandOptions & ScrollContainerTarget & {
|
|
560
|
+
releaseBehavior?: ScrollReleaseBehavior;
|
|
561
|
+
};
|
|
562
|
+
//#endregion
|
|
563
|
+
//#region ../contracts/src/scroll-gesture.d.ts
|
|
564
|
+
declare const SCROLL_DIRECTIONS: readonly ['up', 'down', 'left', 'right'];
|
|
565
|
+
type ScrollDirection = (typeof SCROLL_DIRECTIONS)[number];
|
|
566
|
+
//#endregion
|
|
567
|
+
//#region ../contracts/src/tv-remote.d.ts
|
|
568
|
+
declare const TV_REMOTE_BUTTON_DEFINITIONS: {
|
|
569
|
+
readonly up: {
|
|
570
|
+
readonly aliases: readonly [];
|
|
571
|
+
readonly androidKeyevent: 'KEYCODE_DPAD_UP';
|
|
572
|
+
readonly appleRemoteButton: 'up';
|
|
573
|
+
readonly vegaKey: 'KEY_UP';
|
|
574
|
+
};
|
|
575
|
+
readonly down: {
|
|
576
|
+
readonly aliases: readonly [];
|
|
577
|
+
readonly androidKeyevent: 'KEYCODE_DPAD_DOWN';
|
|
578
|
+
readonly appleRemoteButton: 'down';
|
|
579
|
+
readonly vegaKey: 'KEY_DOWN';
|
|
580
|
+
};
|
|
581
|
+
readonly left: {
|
|
582
|
+
readonly aliases: readonly [];
|
|
583
|
+
readonly androidKeyevent: 'KEYCODE_DPAD_LEFT';
|
|
584
|
+
readonly appleRemoteButton: 'left';
|
|
585
|
+
readonly vegaKey: 'KEY_LEFT';
|
|
586
|
+
};
|
|
587
|
+
readonly right: {
|
|
588
|
+
readonly aliases: readonly [];
|
|
589
|
+
readonly androidKeyevent: 'KEYCODE_DPAD_RIGHT';
|
|
590
|
+
readonly appleRemoteButton: 'right';
|
|
591
|
+
readonly vegaKey: 'KEY_RIGHT';
|
|
592
|
+
};
|
|
593
|
+
readonly select: {
|
|
594
|
+
readonly aliases: readonly ["ok", "center", "enter"];
|
|
595
|
+
readonly androidKeyevent: 'KEYCODE_DPAD_CENTER';
|
|
596
|
+
readonly appleRemoteButton: 'select';
|
|
597
|
+
readonly vegaKey: 'KEY_ENTER';
|
|
598
|
+
};
|
|
599
|
+
readonly menu: {
|
|
600
|
+
readonly aliases: readonly [];
|
|
601
|
+
readonly androidKeyevent: 'KEYCODE_MENU';
|
|
602
|
+
readonly appleRemoteButton: 'menu';
|
|
603
|
+
readonly vegaKey: 'KEY_MENU';
|
|
604
|
+
};
|
|
605
|
+
readonly home: {
|
|
606
|
+
readonly aliases: readonly [];
|
|
607
|
+
readonly androidKeyevent: 'KEYCODE_HOME';
|
|
608
|
+
readonly appleRemoteButton: 'home';
|
|
609
|
+
readonly vegaKey: 'KEY_HOMEPAGE';
|
|
610
|
+
};
|
|
611
|
+
readonly back: {
|
|
612
|
+
readonly aliases: readonly [];
|
|
613
|
+
readonly androidKeyevent: 'KEYCODE_BACK';
|
|
614
|
+
readonly appleRemoteButton: 'menu';
|
|
615
|
+
readonly vegaKey: 'KEY_BACK';
|
|
616
|
+
};
|
|
617
|
+
readonly 'volume-up': {
|
|
618
|
+
readonly aliases: readonly [];
|
|
619
|
+
readonly androidKeyevent: '24';
|
|
620
|
+
};
|
|
621
|
+
readonly 'volume-down': {
|
|
622
|
+
readonly aliases: readonly [];
|
|
623
|
+
readonly androidKeyevent: '25';
|
|
624
|
+
};
|
|
625
|
+
readonly mute: {
|
|
626
|
+
readonly aliases: readonly [];
|
|
627
|
+
readonly androidKeyevent: '164';
|
|
628
|
+
};
|
|
629
|
+
readonly power: {
|
|
630
|
+
readonly aliases: readonly [];
|
|
631
|
+
readonly androidKeyevent: '26';
|
|
632
|
+
};
|
|
633
|
+
readonly sleep: {
|
|
634
|
+
readonly aliases: readonly [];
|
|
635
|
+
readonly androidKeyevent: '223';
|
|
636
|
+
};
|
|
637
|
+
readonly wake: {
|
|
638
|
+
readonly aliases: readonly [];
|
|
639
|
+
readonly androidKeyevent: '224';
|
|
640
|
+
};
|
|
641
|
+
readonly 'media-play-pause': {
|
|
642
|
+
readonly aliases: readonly [];
|
|
643
|
+
readonly androidKeyevent: '85';
|
|
644
|
+
};
|
|
645
|
+
readonly 'media-play': {
|
|
646
|
+
readonly aliases: readonly [];
|
|
647
|
+
readonly androidKeyevent: '126';
|
|
648
|
+
};
|
|
649
|
+
readonly 'media-pause': {
|
|
650
|
+
readonly aliases: readonly [];
|
|
651
|
+
readonly androidKeyevent: '127';
|
|
652
|
+
};
|
|
653
|
+
readonly 'media-stop': {
|
|
654
|
+
readonly aliases: readonly [];
|
|
655
|
+
readonly androidKeyevent: '86';
|
|
656
|
+
};
|
|
657
|
+
readonly 'media-next': {
|
|
658
|
+
readonly aliases: readonly [];
|
|
659
|
+
readonly androidKeyevent: '87';
|
|
660
|
+
};
|
|
661
|
+
readonly 'media-previous': {
|
|
662
|
+
readonly aliases: readonly [];
|
|
663
|
+
readonly androidKeyevent: '88';
|
|
664
|
+
};
|
|
665
|
+
readonly 'media-rewind': {
|
|
666
|
+
readonly aliases: readonly [];
|
|
667
|
+
readonly androidKeyevent: '89';
|
|
668
|
+
};
|
|
669
|
+
readonly 'media-fast-forward': {
|
|
670
|
+
readonly aliases: readonly [];
|
|
671
|
+
readonly androidKeyevent: '90';
|
|
672
|
+
};
|
|
673
|
+
readonly 'channel-up': {
|
|
674
|
+
readonly aliases: readonly [];
|
|
675
|
+
readonly androidKeyevent: '166';
|
|
676
|
+
};
|
|
677
|
+
readonly 'channel-down': {
|
|
678
|
+
readonly aliases: readonly [];
|
|
679
|
+
readonly androidKeyevent: '167';
|
|
680
|
+
};
|
|
681
|
+
readonly 'last-channel': {
|
|
682
|
+
readonly aliases: readonly [];
|
|
683
|
+
readonly androidKeyevent: '229';
|
|
684
|
+
};
|
|
685
|
+
readonly guide: {
|
|
686
|
+
readonly aliases: readonly [];
|
|
687
|
+
readonly androidKeyevent: '172';
|
|
688
|
+
};
|
|
689
|
+
readonly info: {
|
|
690
|
+
readonly aliases: readonly [];
|
|
691
|
+
readonly androidKeyevent: '165';
|
|
692
|
+
};
|
|
693
|
+
readonly captions: {
|
|
694
|
+
readonly aliases: readonly [];
|
|
695
|
+
readonly androidKeyevent: '175';
|
|
696
|
+
};
|
|
697
|
+
readonly 'tv-input': {
|
|
698
|
+
readonly aliases: readonly [];
|
|
699
|
+
readonly androidKeyevent: '178';
|
|
700
|
+
};
|
|
701
|
+
readonly 'color-red': {
|
|
702
|
+
readonly aliases: readonly [];
|
|
703
|
+
readonly androidKeyevent: '183';
|
|
704
|
+
};
|
|
705
|
+
readonly 'color-green': {
|
|
706
|
+
readonly aliases: readonly [];
|
|
707
|
+
readonly androidKeyevent: '184';
|
|
708
|
+
};
|
|
709
|
+
readonly 'color-yellow': {
|
|
710
|
+
readonly aliases: readonly [];
|
|
711
|
+
readonly androidKeyevent: '185';
|
|
712
|
+
};
|
|
713
|
+
readonly 'color-blue': {
|
|
714
|
+
readonly aliases: readonly [];
|
|
715
|
+
readonly androidKeyevent: '186';
|
|
716
|
+
};
|
|
717
|
+
};
|
|
718
|
+
declare const TV_REMOTE_BUTTONS: (keyof typeof TV_REMOTE_BUTTON_DEFINITIONS)[];
|
|
719
|
+
type NamedTvRemoteButton = (typeof TV_REMOTE_BUTTONS)[number];
|
|
720
|
+
type TvRemoteButton = NamedTvRemoteButton | `android-keycode:${number}`;
|
|
721
|
+
//#endregion
|
|
722
|
+
//#region ../contracts/src/gesture-plan-types.d.ts
|
|
723
|
+
/** Selects one-pointer release timing without changing semantic gesture intent. */
|
|
724
|
+
type GestureExecutionProfile = 'endpoint-hold' | 'timed-pan';
|
|
725
|
+
type PointerTrajectorySample = {
|
|
726
|
+
offsetMs: number;
|
|
727
|
+
point: Point;
|
|
728
|
+
};
|
|
729
|
+
type TapPointerId = 0 | 1 | 2 | 3 | 4;
|
|
730
|
+
type PointerTrajectory<PointerId extends number = 0 | 1> = {
|
|
731
|
+
pointerId: PointerId;
|
|
732
|
+
samples: readonly PointerTrajectorySample[];
|
|
733
|
+
};
|
|
734
|
+
type SinglePointerTrajectory = {
|
|
735
|
+
pointerId: 0;
|
|
736
|
+
samples: readonly [PointerTrajectorySample, PointerTrajectorySample, ...PointerTrajectorySample[]];
|
|
737
|
+
};
|
|
738
|
+
/**
|
|
739
|
+
* Where a contact starts. `screen-edge` asks the platform to deliver the contact as a screen-edge
|
|
740
|
+
* touch, which edge gesture recognizers require.
|
|
741
|
+
*/
|
|
742
|
+
type GestureContactOrigin = 'screen-edge';
|
|
743
|
+
type SinglePointerGesturePlan = {
|
|
744
|
+
topology: 'single';
|
|
745
|
+
intent: 'fling' | 'pan';
|
|
746
|
+
executionProfile: GestureExecutionProfile;
|
|
747
|
+
contactOrigin?: GestureContactOrigin;
|
|
748
|
+
durationMs: number;
|
|
749
|
+
viewport: Rect;
|
|
750
|
+
pointers: readonly [SinglePointerTrajectory];
|
|
751
|
+
};
|
|
752
|
+
type TwoContactGesturePlan = {
|
|
753
|
+
topology: 'multi';
|
|
754
|
+
intent: 'pan' | 'pinch' | 'rotate' | 'transform';
|
|
755
|
+
durationMs: number;
|
|
756
|
+
viewport: Rect;
|
|
757
|
+
pointers: readonly [PointerTrajectory, PointerTrajectory];
|
|
758
|
+
};
|
|
759
|
+
/** Stationary contacts that touch down together and lift together after `durationMs`. */
|
|
760
|
+
type TapGesturePlan = {
|
|
761
|
+
topology: 'multi';
|
|
762
|
+
intent: 'tap';
|
|
763
|
+
durationMs: number;
|
|
764
|
+
viewport: Rect;
|
|
765
|
+
pointers: readonly [PointerTrajectory<TapPointerId>, PointerTrajectory<TapPointerId>, ...PointerTrajectory<TapPointerId>[]];
|
|
766
|
+
};
|
|
767
|
+
type MultiTouchGesturePlan = TwoContactGesturePlan | TapGesturePlan;
|
|
768
|
+
type GesturePlan = SinglePointerGesturePlan | MultiTouchGesturePlan;
|
|
769
|
+
//#endregion
|
|
770
|
+
//#region ../contracts/src/settings-catalog.d.ts
|
|
771
|
+
declare const TEXT_SIZE_CATEGORIES: readonly ['extra-small', 'small', 'medium', 'large', 'extra-large', 'extra-extra-large', 'extra-extra-extra-large', 'accessibility-medium', 'accessibility-large', 'accessibility-extra-large', 'accessibility-extra-extra-large', 'accessibility-extra-extra-extra-large'];
|
|
772
|
+
type TextSizeCategory = (typeof TEXT_SIZE_CATEGORIES)[number];
|
|
773
|
+
declare const SETTINGS: {
|
|
774
|
+
readonly wifi: {
|
|
775
|
+
readonly forms: readonly [{
|
|
776
|
+
readonly kind: 'on-off';
|
|
777
|
+
}];
|
|
778
|
+
readonly help: 'Android switches Wi-Fi with svc wifi; an Apple simulator overrides only its status bar.';
|
|
779
|
+
};
|
|
780
|
+
readonly bluetooth: {
|
|
781
|
+
readonly forms: readonly [{
|
|
782
|
+
readonly kind: 'on-off';
|
|
783
|
+
}];
|
|
784
|
+
readonly app: 'input';
|
|
785
|
+
readonly appScope: {
|
|
786
|
+
readonly mobile: 'device-level';
|
|
787
|
+
};
|
|
788
|
+
readonly help: 'Android over adb turns its Bluetooth adapter on or off with svc bluetooth, from Android 8.1. It reports the bluetooth state the device holds afterwards, or fails with bluetooth-not-applied or bluetooth-unreadable. A device without an adapter refuses with android_bluetooth_adapter_missing, and an adapter on a build older than 8.1 with android_bluetooth_command_unavailable, before anything changes. --app is refused.';
|
|
789
|
+
};
|
|
790
|
+
readonly airplane: {
|
|
791
|
+
readonly forms: readonly [{
|
|
792
|
+
readonly kind: 'on-off';
|
|
793
|
+
}];
|
|
794
|
+
readonly help: 'Android applies it through the connectivity service (Android 11+) and reports the airplaneMode that service holds; older builds fail without changing anything. An Apple simulator overrides only its status bar.';
|
|
795
|
+
};
|
|
796
|
+
readonly 'mobile-data': {
|
|
797
|
+
readonly forms: readonly [{
|
|
798
|
+
readonly kind: 'on-off';
|
|
799
|
+
}];
|
|
800
|
+
readonly app: 'input';
|
|
801
|
+
readonly appScope: {
|
|
802
|
+
readonly mobile: 'device-level';
|
|
803
|
+
};
|
|
804
|
+
readonly help: 'Android only. Runs svc data and reports the stored mobileData state, or fails with mobile-data-not-applied or mobile-data-unreadable. Multi-SIM read-back is not covered yet, and --app is refused.';
|
|
805
|
+
};
|
|
806
|
+
readonly location: {
|
|
807
|
+
readonly forms: readonly [{
|
|
808
|
+
readonly kind: 'on-off';
|
|
809
|
+
readonly appScope: {
|
|
810
|
+
readonly apple: 'app-scoped';
|
|
811
|
+
readonly mobile: 'device-level';
|
|
812
|
+
};
|
|
813
|
+
}, {
|
|
814
|
+
readonly kind: 'coordinates';
|
|
815
|
+
readonly appScope: {
|
|
816
|
+
readonly apple: 'device-level';
|
|
817
|
+
readonly mobile: 'device-level';
|
|
818
|
+
};
|
|
819
|
+
}];
|
|
820
|
+
readonly app: 'input';
|
|
821
|
+
readonly help: "on|off writes Android's device-wide location_mode, and on an Apple simulator grants or revokes the app's location permission. set <lat> <lon> moves the device's own coordinates on Apple simulators and Android emulators.";
|
|
822
|
+
};
|
|
823
|
+
readonly animations: {
|
|
824
|
+
readonly forms: readonly [{
|
|
825
|
+
readonly kind: 'on-off';
|
|
826
|
+
}];
|
|
827
|
+
readonly help: 'Android sets its window, transition, and animator duration scales to 1 or 0.';
|
|
828
|
+
};
|
|
829
|
+
readonly appearance: {
|
|
830
|
+
readonly forms: readonly [{
|
|
831
|
+
readonly kind: 'choice';
|
|
832
|
+
readonly states: readonly ["light", "dark", "toggle"];
|
|
833
|
+
}];
|
|
834
|
+
readonly help: 'Switches to light or dark mode, or toggles it, on Android, Apple simulators, and the macOS host.';
|
|
835
|
+
};
|
|
836
|
+
readonly 'text-size': {
|
|
837
|
+
readonly forms: readonly [{
|
|
838
|
+
readonly kind: 'choice';
|
|
839
|
+
readonly states: readonly ["extra-small", "small", "medium", "large", "extra-large", "extra-extra-large", "extra-extra-extra-large", "accessibility-medium", "accessibility-large", "accessibility-extra-large", "accessibility-extra-extra-large", "accessibility-extra-extra-extra-large"];
|
|
840
|
+
}];
|
|
841
|
+
readonly readable: true;
|
|
842
|
+
readonly help: 'Reads the preferred text size without a category and applies one with it, on iPhone and iPad simulators (simctl content size) and Android (system font_scale). Android has no ladder of its own: a read names the nearest rung and reports the multiplier as platformValue. A running app adopts a new size at its next configuration change, so relaunch it.';
|
|
843
|
+
};
|
|
844
|
+
readonly faceid: {
|
|
845
|
+
readonly forms: readonly [{
|
|
846
|
+
readonly kind: 'choice';
|
|
847
|
+
readonly states: readonly ["match", "nonmatch", "enroll", "unenroll"];
|
|
848
|
+
}];
|
|
849
|
+
readonly help: 'Simulates Face ID on iPhone and iPad simulators.';
|
|
850
|
+
};
|
|
851
|
+
readonly touchid: {
|
|
852
|
+
readonly forms: readonly [{
|
|
853
|
+
readonly kind: 'choice';
|
|
854
|
+
readonly states: readonly ["match", "nonmatch", "enroll", "unenroll"];
|
|
855
|
+
}];
|
|
856
|
+
readonly help: 'Simulates Touch ID on iPhone and iPad simulators.';
|
|
857
|
+
};
|
|
858
|
+
readonly fingerprint: {
|
|
859
|
+
readonly forms: readonly [{
|
|
860
|
+
readonly kind: 'choice';
|
|
861
|
+
readonly states: readonly ["match", "nonmatch"];
|
|
862
|
+
}];
|
|
863
|
+
readonly help: 'Simulates a fingerprint touch on Android emulators, and on devices that expose cmd fingerprint.';
|
|
864
|
+
};
|
|
865
|
+
readonly 'clear-app-state': {
|
|
866
|
+
readonly forms: readonly [{
|
|
867
|
+
readonly kind: 'app-id';
|
|
868
|
+
}];
|
|
869
|
+
readonly app: 'positional';
|
|
870
|
+
readonly appRequired: true;
|
|
871
|
+
readonly appScope: {
|
|
872
|
+
readonly apple: 'app-scoped';
|
|
873
|
+
readonly mobile: 'app-scoped';
|
|
874
|
+
};
|
|
875
|
+
readonly help: 'Clears the data of the positional app, the --app app, or the session app, and refuses two different apps. It leaves the keychain alone. An app with no data container, such as a simulator system app, refuses with app-no-data-container.';
|
|
876
|
+
};
|
|
877
|
+
readonly 'reset-keychain': {
|
|
878
|
+
readonly forms: readonly [{
|
|
879
|
+
readonly kind: 'choice';
|
|
880
|
+
readonly states: readonly ["clear"];
|
|
881
|
+
}];
|
|
882
|
+
readonly help: 'Resets the whole iOS simulator keychain, for every app on it: simctl has no per-app reset. A fresh-install reset needs this and clear-app-state; relaunch the app afterwards to see it signed out.';
|
|
883
|
+
};
|
|
884
|
+
readonly permission: {
|
|
885
|
+
readonly forms: readonly [{
|
|
886
|
+
readonly kind: 'permission';
|
|
887
|
+
readonly actions: readonly ["grant", "deny", "reset"];
|
|
888
|
+
readonly targets: readonly ["all", "camera", "microphone", "photos", "contacts", "contacts-limited", "notifications", "calendar", "location", "location-always", "media-library", "motion", "reminders", "siri"];
|
|
889
|
+
readonly modes: readonly ["full", "limited"];
|
|
890
|
+
}, {
|
|
891
|
+
readonly kind: 'permission';
|
|
892
|
+
readonly actions: readonly ["grant", "reset"];
|
|
893
|
+
readonly targets: readonly ["accessibility", "screen-recording", "input-monitoring"];
|
|
894
|
+
}];
|
|
895
|
+
readonly app: 'input';
|
|
896
|
+
readonly appScope: {
|
|
897
|
+
readonly apple: 'app-scoped';
|
|
898
|
+
readonly mobile: 'app-scoped';
|
|
899
|
+
readonly 'macos-host': 'device-level';
|
|
900
|
+
};
|
|
901
|
+
readonly help: 'Changes a permission of the --app app or the session app. An iOS simulator, local or Limrun, resolves --app to an installed bundle id or display name, and Android to an installed package. On Android, deny|reset of a held permission kills a running app; the response reports priorGrantState and warns, and open <app> --relaunch restores it. Android needs a resolvable foreground user and changes nothing without one. On the macOS host, grant|reset change the host TCC grants for the three desktop targets and take no --app.';
|
|
902
|
+
};
|
|
903
|
+
};
|
|
904
|
+
type SettingName = keyof typeof SETTINGS;
|
|
905
|
+
/** The settings whose definition is `readable`. */
|
|
906
|
+
type ReadableSetting = { [Name in SettingName]: (typeof SETTINGS)[Name] extends {
|
|
907
|
+
readable: true;
|
|
908
|
+
} ? Name : never; }[SettingName];
|
|
909
|
+
//#endregion
|
|
910
|
+
//#region ../contracts/src/settings.d.ts
|
|
911
|
+
/**
|
|
912
|
+
* What `text-size` answers with. The ladder is shared across platforms, so a read names the
|
|
913
|
+
* category the ladder calls the device's value *and* the value the platform itself reported: an
|
|
914
|
+
* Apple content-size name, or an Android `font_scale` multiplier. The ladder is coarser than any
|
|
915
|
+
* one platform's own scale, and `platformValue` is what keeps a normalized answer auditable.
|
|
916
|
+
*/
|
|
917
|
+
type TextSizeSettingPayload = Readonly<{
|
|
918
|
+
setting: 'text-size';
|
|
919
|
+
category: TextSizeCategory;
|
|
920
|
+
platformValue: string;
|
|
921
|
+
}>;
|
|
922
|
+
/**
|
|
923
|
+
* The payload a readable setting answers with, keyed by the setting that answered. Each readable
|
|
924
|
+
* setting has its own shape — a category and a multiplier are not the same observation — so the
|
|
925
|
+
* discriminant is what lets a response be composed, recorded, and printed from one place without
|
|
926
|
+
* assuming every setting is a ladder rung. A second readable setting joins this union and supplies
|
|
927
|
+
* its own sentence in `describeSettingRead`, which is where the compiler then asks for it.
|
|
928
|
+
*/
|
|
929
|
+
type ReadSettingResult = TextSizeSettingPayload;
|
|
930
|
+
type SettingOptions = {
|
|
931
|
+
permissionTarget?: string;
|
|
932
|
+
permissionMode?: string;
|
|
933
|
+
latitude?: number;
|
|
934
|
+
longitude?: number;
|
|
935
|
+
};
|
|
936
|
+
//#endregion
|
|
937
|
+
//#region ../contracts/src/snapshot-producers.d.ts
|
|
938
|
+
/**
|
|
939
|
+
* Every acquisition that can produce a snapshot tree, named for the source and never for the
|
|
940
|
+
* platform: one platform channel can be fed by several producers with different guarantees, and
|
|
941
|
+
* one producer can feed more than one channel (`appium-source` answers for WebDriver iOS and
|
|
942
|
+
* Android). Sharing a parser does not make two sources one producer.
|
|
943
|
+
*/
|
|
944
|
+
type SnapshotProducer = 'apple-runner' | 'simulator-ax-bridge' | 'appium-source' | 'revyl-ios-tree' | 'revyl-android-tree' | 'android-uiautomator' | 'cdp-dom' | 'harmonyos-uitest' | 'macos-helper' | 'linux-atspi' | 'agent-browser';
|
|
945
|
+
/**
|
|
946
|
+
* The closed backend vocabulary. A registry row may name only these channels, so a typo in a row
|
|
947
|
+
* fails to compile instead of becoming a new backend.
|
|
948
|
+
*/
|
|
949
|
+
declare const SNAPSHOT_BACKENDS: {
|
|
950
|
+
readonly xctest: true;
|
|
951
|
+
readonly android: true;
|
|
952
|
+
readonly 'harmonyos-arkui': true;
|
|
953
|
+
readonly 'macos-helper': true;
|
|
954
|
+
readonly 'linux-atspi': true;
|
|
955
|
+
readonly web: true;
|
|
956
|
+
};
|
|
957
|
+
type SnapshotBackend = keyof typeof SNAPSHOT_BACKENDS;
|
|
958
|
+
/**
|
|
959
|
+
* The one table of producer facts. Every other producer-keyed fact derives from it: the provenance
|
|
960
|
+
* pairs below, the iOS producer subsets (`ios-snapshot.ts`), truncation, residue,
|
|
961
|
+
* quiet time, ref minting, and producer warning dispatch. A new producer adds a row here and stamps
|
|
962
|
+
* its served identity through {@link stampSnapshotIdentity}.
|
|
963
|
+
*/
|
|
964
|
+
declare const SNAPSHOT_PRODUCERS: {
|
|
965
|
+
readonly 'apple-runner': {
|
|
966
|
+
readonly channels: readonly ["xctest"];
|
|
967
|
+
readonly truncation: 'available';
|
|
968
|
+
readonly residue: 'source-measured';
|
|
969
|
+
readonly quietMs: 500;
|
|
970
|
+
readonly refs: 'dense';
|
|
971
|
+
readonly sparseRootWarning: 'xctest-query';
|
|
972
|
+
};
|
|
973
|
+
readonly 'simulator-ax-bridge': {
|
|
974
|
+
readonly channels: readonly ["xctest"];
|
|
975
|
+
readonly truncation: 'available';
|
|
976
|
+
readonly residue: 'source-measured';
|
|
977
|
+
readonly quietMs: 300;
|
|
978
|
+
readonly refs: 'dense';
|
|
979
|
+
readonly sparseRootWarning: 'none';
|
|
980
|
+
};
|
|
981
|
+
readonly 'appium-source': {
|
|
982
|
+
readonly channels: readonly ["xctest", "android"];
|
|
983
|
+
readonly truncation: 'unavailable';
|
|
984
|
+
readonly residue: 'provider-derived';
|
|
985
|
+
readonly quietMs: 500;
|
|
986
|
+
readonly refs: 'dense';
|
|
987
|
+
readonly sparseRootWarning: 'appium-page-source';
|
|
988
|
+
};
|
|
989
|
+
readonly 'revyl-ios-tree': {
|
|
990
|
+
readonly channels: readonly ["xctest"];
|
|
991
|
+
readonly truncation: 'unavailable';
|
|
992
|
+
readonly residue: 'provider-derived';
|
|
993
|
+
readonly quietMs: 500;
|
|
994
|
+
readonly refs: 'dense';
|
|
995
|
+
readonly sparseRootWarning: 'none';
|
|
996
|
+
};
|
|
997
|
+
readonly 'revyl-android-tree': {
|
|
998
|
+
readonly channels: readonly ["android"];
|
|
999
|
+
readonly truncation: 'unavailable';
|
|
1000
|
+
readonly residue: 'provider-derived';
|
|
1001
|
+
readonly quietMs: 500;
|
|
1002
|
+
readonly refs: 'dense';
|
|
1003
|
+
readonly sparseRootWarning: 'none';
|
|
1004
|
+
};
|
|
1005
|
+
readonly 'android-uiautomator': {
|
|
1006
|
+
readonly channels: readonly ["android"];
|
|
1007
|
+
readonly truncation: 'available';
|
|
1008
|
+
readonly residue: 'source-measured';
|
|
1009
|
+
readonly quietMs: 500;
|
|
1010
|
+
readonly refs: 'dense';
|
|
1011
|
+
readonly sparseRootWarning: 'none';
|
|
1012
|
+
};
|
|
1013
|
+
readonly 'cdp-dom': {
|
|
1014
|
+
readonly channels: readonly ["android"];
|
|
1015
|
+
readonly truncation: 'available';
|
|
1016
|
+
readonly residue: 'source-measured';
|
|
1017
|
+
readonly quietMs: 500;
|
|
1018
|
+
readonly refs: 'dense';
|
|
1019
|
+
readonly sparseRootWarning: 'none';
|
|
1020
|
+
};
|
|
1021
|
+
readonly 'harmonyos-uitest': {
|
|
1022
|
+
readonly channels: readonly ["harmonyos-arkui"];
|
|
1023
|
+
readonly truncation: 'available';
|
|
1024
|
+
readonly residue: 'source-measured';
|
|
1025
|
+
readonly quietMs: 500;
|
|
1026
|
+
readonly refs: 'dense';
|
|
1027
|
+
readonly sparseRootWarning: 'none';
|
|
1028
|
+
};
|
|
1029
|
+
readonly 'macos-helper': {
|
|
1030
|
+
readonly channels: readonly ["macos-helper"];
|
|
1031
|
+
readonly truncation: 'available';
|
|
1032
|
+
readonly residue: 'source-measured';
|
|
1033
|
+
readonly quietMs: 500;
|
|
1034
|
+
readonly refs: 'dense';
|
|
1035
|
+
readonly sparseRootWarning: 'none';
|
|
1036
|
+
};
|
|
1037
|
+
readonly 'linux-atspi': {
|
|
1038
|
+
readonly channels: readonly ["linux-atspi"];
|
|
1039
|
+
readonly truncation: 'available';
|
|
1040
|
+
readonly residue: 'source-measured';
|
|
1041
|
+
readonly quietMs: 500;
|
|
1042
|
+
readonly refs: 'dense';
|
|
1043
|
+
readonly sparseRootWarning: 'none';
|
|
1044
|
+
};
|
|
1045
|
+
readonly 'agent-browser': {
|
|
1046
|
+
readonly channels: readonly ["web"];
|
|
1047
|
+
readonly truncation: 'available';
|
|
1048
|
+
readonly residue: 'source-measured';
|
|
1049
|
+
readonly quietMs: 500;
|
|
1050
|
+
readonly refs: 'backend-issued';
|
|
1051
|
+
readonly sparseRootWarning: 'none';
|
|
1052
|
+
};
|
|
1053
|
+
};
|
|
1054
|
+
type SnapshotProducerRegistry = typeof SNAPSHOT_PRODUCERS;
|
|
1055
|
+
type ProducerChannel<Producer extends SnapshotProducer> = SnapshotProducerRegistry[Producer]['channels'][number];
|
|
1056
|
+
type ProducerOnChannel<Backend extends SnapshotBackend> = { [Producer in SnapshotProducer]: Backend extends ProducerChannel<Producer> ? Producer : never; }[SnapshotProducer];
|
|
1057
|
+
/**
|
|
1058
|
+
* The channel↔producer pairs that can actually occur, derived from {@link SNAPSHOT_PRODUCERS}.
|
|
1059
|
+
* `xctest` trees come from the local Apple runner, the Simulator AX bridge, Appium page-source XML,
|
|
1060
|
+
* or a cloud provider's AX element tree (Revyl), and only the runner's output has been through its
|
|
1061
|
+
* presentation (clip fold, effective geometry, scope). Logic that assumes those guarantees must key
|
|
1062
|
+
* on the producer, never on the channel alone.
|
|
1063
|
+
*
|
|
1064
|
+
* Every carrier embeds the pair atomically, so a cross-channel pair does not compile.
|
|
1065
|
+
*/
|
|
1066
|
+
type SnapshotProvenance = { [Backend in SnapshotBackend]: {
|
|
1067
|
+
backend: Backend;
|
|
1068
|
+
producer: ProducerOnChannel<Backend>;
|
|
1069
|
+
}; }[SnapshotBackend];
|
|
1070
|
+
//#endregion
|
|
1071
|
+
//#region ../contracts/src/snapshot-model.d.ts
|
|
1072
|
+
type OptionalProducerProvenance<Pair> = Pair extends {
|
|
1073
|
+
backend: infer Backend;
|
|
1074
|
+
producer: infer Producer;
|
|
1075
|
+
} ? {
|
|
1076
|
+
backend: Backend;
|
|
1077
|
+
producer?: Producer;
|
|
1078
|
+
} : never;
|
|
1079
|
+
/**
|
|
1080
|
+
* The provenance carrier for {@link SnapshotState}: the producer may be absent (a client-side
|
|
1081
|
+
* fallback that rebuilds a state from a bare backend result knows the channel and nothing more),
|
|
1082
|
+
* but a present pair still has to come from the {@link SnapshotProvenance} table — the channel
|
|
1083
|
+
* may not carry a foreign producer.
|
|
1084
|
+
*/
|
|
1085
|
+
type SnapshotStateProvenance = OptionalProducerProvenance<SnapshotProvenance> | {
|
|
1086
|
+
backend?: undefined;
|
|
1087
|
+
producer?: undefined;
|
|
1088
|
+
};
|
|
1089
|
+
type SnapshotState = {
|
|
1090
|
+
nodes: SnapshotNode[];
|
|
1091
|
+
createdAt: number;
|
|
1092
|
+
truncated?: boolean;
|
|
1093
|
+
snapshotQuality?: SnapshotQualityVerdict;
|
|
1094
|
+
snapshotQualityNotes?: SnapshotQualityNote[];
|
|
1095
|
+
comparisonSafe?: boolean;
|
|
1096
|
+
presentationKey?: string;
|
|
1097
|
+
/** The presentation this capture was taken with; absent means the default full tree. */
|
|
1098
|
+
presentation?: SnapshotPresentation;
|
|
1099
|
+
/** Opaque equality key for iOS acquisition and presentation lineage. */
|
|
1100
|
+
comparisonKey?: string;
|
|
1101
|
+
/**
|
|
1102
|
+
* Android: the capture is an occluding system surface (notification shade, quick settings)
|
|
1103
|
+
* rather than app content. Consumers that surface this tree to the agent must disclose the
|
|
1104
|
+
* occlusion (see `@agent-device/contracts/android-system-surface-disclosure`).
|
|
1105
|
+
*/
|
|
1106
|
+
systemSurfaceOnly?: boolean;
|
|
1107
|
+
/**
|
|
1108
|
+
* Android: the producer proved this capture a complete read of the current hierarchy, taken after
|
|
1109
|
+
* it cleared the platform node cache. Absent proves nothing.
|
|
1110
|
+
*/
|
|
1111
|
+
freshTraversal?: true;
|
|
1112
|
+
/**
|
|
1113
|
+
* iOS: the bundle id of the in-place system surface this capture describes (a web sign-in sheet
|
|
1114
|
+
* presented over the app, #2438). Two captures that disagree here describe different surfaces and
|
|
1115
|
+
* must never be compared as the same presentation; consumers that surface the tree disclose it.
|
|
1116
|
+
*/
|
|
1117
|
+
iosSystemSurfaceBundleId?: string;
|
|
1118
|
+
/**
|
|
1119
|
+
* iOS: whether this capture read a modal presentation over the app's own content (#3565), decided
|
|
1120
|
+
* on the acquired tree before interactive filtering, compaction, depth, or scope, so every view of
|
|
1121
|
+
* one screen carries one value. `'absent'` is read, never defaulted; an unreadable or unexplained
|
|
1122
|
+
* capture answers `'unknown'`. Settle's presented-surface confirmation arms on this fact.
|
|
1123
|
+
*/
|
|
1124
|
+
presentedSurface?: PresentedSurface;
|
|
1125
|
+
/**
|
|
1126
|
+
* iOS and Android: keyboard observations made during acquisition. Measured and derived frames
|
|
1127
|
+
* take precedence over reconstruction from the presented tree. Visibility-only and unknown facts
|
|
1128
|
+
* carry no band; missing nodes or an omitted fact never establish absence.
|
|
1129
|
+
*/
|
|
1130
|
+
keyboard?: SnapshotKeyboardBandFact;
|
|
1131
|
+
/**
|
|
1132
|
+
* The box these rects are measured in, as the producer measured it (#3182). The state is the carrier
|
|
1133
|
+
* the response reads, so the stored tree and the published `viewport` are one fact rather than two:
|
|
1134
|
+
* a consumer of a stored capture — a later diff, a re-read of the session's tree — gets the box the
|
|
1135
|
+
* producer measured instead of inferring one from the largest rect still on screen.
|
|
1136
|
+
*/
|
|
1137
|
+
viewport?: SnapshotViewportSize;
|
|
1138
|
+
/**
|
|
1139
|
+
* Screenshot pixels per rect unit, when the producer published one (a TV app page's CSS px). The
|
|
1140
|
+
* state carries it beside `viewport` so every projection of a stored tree onto a capture uses the
|
|
1141
|
+
* producer's scale. See {@link SnapshotCaptureScale}.
|
|
1142
|
+
*/
|
|
1143
|
+
captureScale?: SnapshotCaptureScale;
|
|
1144
|
+
/**
|
|
1145
|
+
* Rect units per density-independent pixel of the surface these rects are measured in: 1 where the
|
|
1146
|
+
* producer publishes points (Apple), the display's density where it publishes physical pixels
|
|
1147
|
+
* (Android). A consumer that reads a layout constant written in dp — LogBox's 10-unit banner inset
|
|
1148
|
+
* — can only check it on a device-pixel tree with this fact, so the state carries it beside
|
|
1149
|
+
* `viewport`. Absent means the producer published nothing, which reads as 1.
|
|
1150
|
+
*/
|
|
1151
|
+
rectUnitsPerDp?: number;
|
|
1152
|
+
/**
|
|
1153
|
+
* iOS: this capture's own command found the session app out of foreground and the runner
|
|
1154
|
+
* activated it before answering, so an earlier observation in the session described whatever held
|
|
1155
|
+
* the foreground instead (#2682). Consumers that surface this tree disclose the repair.
|
|
1156
|
+
*/
|
|
1157
|
+
targetActivation?: IosTargetActivation;
|
|
1158
|
+
/** What post-gesture stabilization proved about the gesture before this capture. */
|
|
1159
|
+
postGestureOutcome?: PostGestureOutcome;
|
|
1160
|
+
} & SnapshotStateProvenance;
|
|
1161
|
+
/** The gesture a post-gesture outcome fact names: the command and its positionals. */
|
|
1162
|
+
type PostGestureAction = {
|
|
1163
|
+
action: string;
|
|
1164
|
+
positionals: string[];
|
|
1165
|
+
};
|
|
1166
|
+
/**
|
|
1167
|
+
* `unsettled`: the surface was still changing when the stabilization deadline expired.
|
|
1168
|
+
* `no-effect`: the settled surface still matches the pre-gesture tree (#1600).
|
|
1169
|
+
* `loading`: an app launch's budget expired before its tree showed a first screen; the tree may be
|
|
1170
|
+
* a launch or loading surface.
|
|
1171
|
+
*/
|
|
1172
|
+
type PostGestureOutcome = {
|
|
1173
|
+
kind: 'unsettled' | 'no-effect' | 'loading';
|
|
1174
|
+
gesture: PostGestureAction;
|
|
1175
|
+
};
|
|
1176
|
+
//#endregion
|
|
1177
|
+
//#region ../contracts/src/session-surface.d.ts
|
|
1178
|
+
declare const SESSION_SURFACES: readonly ['app', 'frontmost-app', 'desktop', 'menubar'];
|
|
1179
|
+
type SessionSurface = (typeof SESSION_SURFACES)[number];
|
|
1180
|
+
declare const helperSurface: unique symbol;
|
|
1181
|
+
/** A surface the owner routed to the macOS helper; only `macOsHelperSurface` produces one. */
|
|
1182
|
+
type MacOsHelperSurface = SessionSurface & {
|
|
1183
|
+
readonly [helperSurface]: true;
|
|
1184
|
+
};
|
|
1185
|
+
//#endregion
|
|
1186
|
+
//#region ../contracts/src/snapshot-diagnostics.d.ts
|
|
1187
|
+
type SnapshotTimingStats = {
|
|
1188
|
+
count: number;
|
|
1189
|
+
p50Ms: number;
|
|
1190
|
+
p95Ms: number;
|
|
1191
|
+
maxMs: number;
|
|
1192
|
+
slowThresholdMs: number;
|
|
1193
|
+
platform?: PublicPlatform;
|
|
1194
|
+
/**
|
|
1195
|
+
* Captures per producer that served them, keyed by producer id such as `simulator-ax-bridge` or
|
|
1196
|
+
* `apple-runner`. A capture with no known producer counts under its channel, such as `xctest`.
|
|
1197
|
+
*/
|
|
1198
|
+
backends?: Record<string, number>;
|
|
1199
|
+
};
|
|
1200
|
+
type SnapshotDiagnosticsSummary = {
|
|
1201
|
+
stats: SnapshotTimingStats;
|
|
1202
|
+
warning?: string;
|
|
1203
|
+
};
|
|
1204
|
+
//#endregion
|
|
1205
|
+
//#region ../contracts/src/snapshot-types.d.ts
|
|
1206
|
+
/** What a platform interactor's snapshot capture returns, before the daemon builds `SnapshotState`. */
|
|
1207
|
+
type InteractorSnapshotCapture = {
|
|
1208
|
+
nodes?: SnapshotNode[];
|
|
1209
|
+
truncated?: boolean;
|
|
1210
|
+
backend?: string;
|
|
1211
|
+
snapshot?: SnapshotState;
|
|
1212
|
+
appName?: string;
|
|
1213
|
+
appBundleId?: string;
|
|
1214
|
+
snapshotDiagnostics?: SnapshotDiagnosticsSummary;
|
|
1215
|
+
/**
|
|
1216
|
+
* The box the node rects are measured in, as the producer measured it (#3182). Absent means the
|
|
1217
|
+
* producer measured no box; see {@link SnapshotViewportSize} for what each producer measures.
|
|
1218
|
+
*/
|
|
1219
|
+
viewport?: SnapshotViewportSize;
|
|
1220
|
+
/** See {@link SnapshotCaptureScale}. Absent means the producer published no scale. */
|
|
1221
|
+
captureScale?: SnapshotCaptureScale;
|
|
1222
|
+
analysis?: {
|
|
1223
|
+
rawNodeCount: number;
|
|
1224
|
+
maxDepth: number;
|
|
1225
|
+
};
|
|
1226
|
+
androidSnapshot?: AndroidSnapshotBackendMetadata;
|
|
1227
|
+
freshness?: {
|
|
1228
|
+
action: string;
|
|
1229
|
+
retryCount: number;
|
|
1230
|
+
staleAfterRetries: boolean;
|
|
1231
|
+
reason?: 'empty-interactive' | 'sharp-drop' | 'stuck-route';
|
|
1232
|
+
};
|
|
1233
|
+
quality?: SnapshotQualityVerdict;
|
|
1234
|
+
qualityNotes?: SnapshotQualityNote[];
|
|
1235
|
+
warnings?: string[];
|
|
1236
|
+
observation?: IosSnapshotObservation;
|
|
1237
|
+
};
|
|
1238
|
+
type AndroidSnapshotBackendMetadata = {
|
|
1239
|
+
backend: 'android-helper';
|
|
1240
|
+
/**
|
|
1241
|
+
* Physical pixels per density-independent pixel of the display the bounds are measured on, as
|
|
1242
|
+
* the helper's `DisplayMetrics` report it (2.625 on a 420 dpi phone). Node rects and the points
|
|
1243
|
+
* `press` takes stay in physical pixels; a consumer that lays out in dp divides by it. Absent on
|
|
1244
|
+
* an older helper.
|
|
1245
|
+
*/
|
|
1246
|
+
pixelDensity?: number;
|
|
1247
|
+
helperVersion?: string;
|
|
1248
|
+
helperApiVersion?: string;
|
|
1249
|
+
helperTransport?: string;
|
|
1250
|
+
helperSessionReused?: boolean;
|
|
1251
|
+
installReason?: string;
|
|
1252
|
+
waitForIdleTimeoutMs?: number;
|
|
1253
|
+
waitForIdleQuietMs?: number;
|
|
1254
|
+
timeoutMs?: number;
|
|
1255
|
+
maxDepth?: number;
|
|
1256
|
+
maxNodes?: number;
|
|
1257
|
+
rootPresent?: boolean;
|
|
1258
|
+
/** This capture cleared the platform accessibility node cache through UiAutomation.clearCache(). */
|
|
1259
|
+
cacheInvalidated?: boolean;
|
|
1260
|
+
captureMode?: string;
|
|
1261
|
+
systemSurfaceOnly?: boolean;
|
|
1262
|
+
/**
|
|
1263
|
+
* Package of the foreground application window the snapshot helper captured: active or focused,
|
|
1264
|
+
* at the highest layer, and not owned by the system. Absent when the helper saw none.
|
|
1265
|
+
*/
|
|
1266
|
+
foregroundWindowPackage?: string;
|
|
1267
|
+
windowCount?: number;
|
|
1268
|
+
/**
|
|
1269
|
+
* `AccessibilityWindowInfo` types of the listed windows the helper could not serialize because
|
|
1270
|
+
* reading their root returned null or threw (`2` is an input method window); `windowCount` counts
|
|
1271
|
+
* only the roots it serialized. Empty when every listed window was read. Absent on an older helper.
|
|
1272
|
+
*/
|
|
1273
|
+
missingRootWindowTypes?: number[];
|
|
1274
|
+
nodeCount?: number;
|
|
1275
|
+
helperTruncated?: boolean;
|
|
1276
|
+
elapsedMs?: number;
|
|
1277
|
+
presentationFailure?: {
|
|
1278
|
+
phase: 'deadline' | 'complexity' | 'regular-invariant';
|
|
1279
|
+
workUnits: number;
|
|
1280
|
+
maxWorkUnits?: number;
|
|
1281
|
+
};
|
|
1282
|
+
/** API 23 exposes no sibling drawing order, so same-window occlusion fails conservative. */
|
|
1283
|
+
occlusionScanUnavailable?: boolean;
|
|
1284
|
+
};
|
|
1285
|
+
//#endregion
|
|
1286
|
+
//#region ../contracts/src/runner-lease-context.d.ts
|
|
1287
|
+
type RunnerLogicalLeaseContext = {
|
|
1288
|
+
leaseId?: string;
|
|
1289
|
+
clientId?: string;
|
|
1290
|
+
tenantId?: string;
|
|
1291
|
+
runId?: string;
|
|
1292
|
+
leaseProvider?: string;
|
|
1293
|
+
deviceKey?: string;
|
|
1294
|
+
};
|
|
1295
|
+
//#endregion
|
|
1296
|
+
//#region ../contracts/src/ios-snapshot.d.ts
|
|
1297
|
+
/** The producers whose trees arrive on the iOS (`xctest`) channel, from the producer registry. */
|
|
1298
|
+
type IosSnapshotProducer = { [Producer in keyof SnapshotProducerRegistry]: 'xctest' extends SnapshotProducerRegistry[Producer]['channels'][number] ? Producer : never; }[keyof SnapshotProducerRegistry];
|
|
1299
|
+
type IosAcquisitionProducer = Exclude<IosSnapshotProducer, 'apple-runner'>;
|
|
1300
|
+
type IosAcquisitionIntent = 'full' | 'surface-observation';
|
|
1301
|
+
type IosSnapshotProjection = 'regular' | 'raw';
|
|
1302
|
+
type IosSnapshotGeneration = string;
|
|
1303
|
+
type IosSnapshotLineage = Readonly<{
|
|
1304
|
+
targetId?: string;
|
|
1305
|
+
generation?: IosSnapshotGeneration;
|
|
1306
|
+
}>;
|
|
1307
|
+
type IosSnapshotPresentationKey = Readonly<{
|
|
1308
|
+
projection: IosSnapshotProjection;
|
|
1309
|
+
interactiveOnly: boolean;
|
|
1310
|
+
depth: number | null;
|
|
1311
|
+
scope: string | null;
|
|
1312
|
+
customActions: boolean;
|
|
1313
|
+
}>;
|
|
1314
|
+
type CaptureHint = Readonly<{
|
|
1315
|
+
projection: IosSnapshotProjection;
|
|
1316
|
+
rawTraversalDepth: number | null;
|
|
1317
|
+
regularPresentedDepth: number | null;
|
|
1318
|
+
interactiveOnly: boolean;
|
|
1319
|
+
customActions: boolean;
|
|
1320
|
+
acquisitionIntent: IosAcquisitionIntent;
|
|
1321
|
+
}>;
|
|
1322
|
+
type IosSnapshotFact = 'acquisition-depth' | 'scope' | 'interactive-query' | 'viewport' | 'hittability' | 'generation' | 'truncation';
|
|
1323
|
+
type IosViewportEvidence = Readonly<{
|
|
1324
|
+
kind: 'reported';
|
|
1325
|
+
rect: Rect;
|
|
1326
|
+
}> | Readonly<{
|
|
1327
|
+
kind: 'derived';
|
|
1328
|
+
rect: Rect;
|
|
1329
|
+
}> | Readonly<{
|
|
1330
|
+
kind: 'missing';
|
|
1331
|
+
reason: 'not-provided' | 'not-supported' | 'invalid';
|
|
1332
|
+
}>;
|
|
1333
|
+
type IosProviderPrunedField = 'nodes' | 'depth' | 'scope' | 'interactive-only';
|
|
1334
|
+
/**
|
|
1335
|
+
* Why a provider left a collapsed tab bar unexpanded:
|
|
1336
|
+
* - `rejected`: a hit-test across the bar failed.
|
|
1337
|
+
* - `timed-out`: a hit-test across the bar did not answer in time.
|
|
1338
|
+
* - `budget-exhausted`: the hit-test budget ran out before a candidate with a tab bar's height
|
|
1339
|
+
* was checked.
|
|
1340
|
+
*/
|
|
1341
|
+
type IosCollapsedTabBarProbeFailure = 'rejected' | 'timed-out' | 'budget-exhausted';
|
|
1342
|
+
type IosAcquisitionResidue = Readonly<{
|
|
1343
|
+
kind: 'provider-pruned';
|
|
1344
|
+
fields: readonly IosProviderPrunedField[];
|
|
1345
|
+
}> | Readonly<{
|
|
1346
|
+
kind: 'missing-viewport';
|
|
1347
|
+
reason: 'not-provided' | 'not-supported' | 'invalid';
|
|
1348
|
+
}> | Readonly<{
|
|
1349
|
+
kind: 'truncated';
|
|
1350
|
+
}> | Readonly<{
|
|
1351
|
+
kind: 'stale-generation';
|
|
1352
|
+
expected?: IosSnapshotGeneration;
|
|
1353
|
+
observed?: IosSnapshotGeneration;
|
|
1354
|
+
}> | Readonly<{
|
|
1355
|
+
kind: 'unknown-generation';
|
|
1356
|
+
captureId: string;
|
|
1357
|
+
}> | Readonly<{
|
|
1358
|
+
kind: 'unavailable-fact';
|
|
1359
|
+
fact: IosSnapshotFact;
|
|
1360
|
+
}> | Readonly<{
|
|
1361
|
+
kind: 'fallback-source';
|
|
1362
|
+
producer: IosSnapshotProducer;
|
|
1363
|
+
}> | Readonly<{
|
|
1364
|
+
kind: 'collapsed-tab-bar-probe-failed';
|
|
1365
|
+
reason: IosCollapsedTabBarProbeFailure;
|
|
1366
|
+
}>;
|
|
1367
|
+
type IosSnapshotAcquisitionForIntent<Intent extends IosAcquisitionIntent> = Readonly<{
|
|
1368
|
+
producer: IosAcquisitionProducer;
|
|
1369
|
+
intent: Intent;
|
|
1370
|
+
hint: CaptureHint & Readonly<{
|
|
1371
|
+
acquisitionIntent: Intent;
|
|
1372
|
+
}>;
|
|
1373
|
+
nodes: readonly RawSnapshotNode[];
|
|
1374
|
+
truncated?: boolean;
|
|
1375
|
+
viewport: IosViewportEvidence;
|
|
1376
|
+
keyboard?: SnapshotKeyboardBandFact;
|
|
1377
|
+
lineage: IosSnapshotLineage;
|
|
1378
|
+
residue: readonly IosAcquisitionResidue[];
|
|
1379
|
+
}>;
|
|
1380
|
+
type IosSnapshotAcquisition = IosSnapshotAcquisitionForIntent<'full'> | IosSnapshotAcquisitionForIntent<'surface-observation'>;
|
|
1381
|
+
type IosSnapshotAcquisitionFacts = Omit<IosSnapshotAcquisition, 'hint'>;
|
|
1382
|
+
type IosSnapshotComparisonIdentity = Readonly<{
|
|
1383
|
+
producer: IosSnapshotProducer;
|
|
1384
|
+
intent: IosAcquisitionIntent;
|
|
1385
|
+
lineage: IosSnapshotLineage;
|
|
1386
|
+
presentationKey: IosSnapshotPresentationKey;
|
|
1387
|
+
residue: readonly IosAcquisitionResidue[];
|
|
1388
|
+
}>;
|
|
1389
|
+
//#endregion
|
|
1390
|
+
//#region ../contracts/src/interactor-types.d.ts
|
|
1391
|
+
type RunnerContext = {
|
|
1392
|
+
requestId?: string;
|
|
1393
|
+
signal?: AbortSignal;
|
|
1394
|
+
appBundleId?: string;
|
|
1395
|
+
verbose?: boolean;
|
|
1396
|
+
logPath?: string;
|
|
1397
|
+
traceLogPath?: string;
|
|
1398
|
+
iosXctestrunFile?: string;
|
|
1399
|
+
iosXctestDerivedDataPath?: string;
|
|
1400
|
+
iosXctestEnvDir?: string;
|
|
1401
|
+
runnerLeaseContext?: RunnerLogicalLeaseContext;
|
|
1402
|
+
};
|
|
1403
|
+
/** Subset of {@link RunnerContext} forwarded to runner command invocations. */
|
|
1404
|
+
type RunnerCallOptions = Pick<RunnerContext, 'signal' | 'verbose' | 'logPath' | 'traceLogPath' | 'requestId' | 'iosXctestrunFile' | 'iosXctestDerivedDataPath' | 'iosXctestEnvDir' | 'runnerLeaseContext'>;
|
|
1405
|
+
type ScreenshotOptions = {
|
|
1406
|
+
appBundleId?: string;
|
|
1407
|
+
pixelDensity?: number;
|
|
1408
|
+
screenMask?: ScreenshotScreenMask;
|
|
1409
|
+
fullscreen?: boolean;
|
|
1410
|
+
normalizeStatusBar?: boolean;
|
|
1411
|
+
stabilize?: boolean;
|
|
1412
|
+
surface?: SessionSurface;
|
|
1413
|
+
skipIosSimulatorBootCheck?: boolean;
|
|
1414
|
+
captureBackend?: 'runner';
|
|
1415
|
+
};
|
|
1416
|
+
/**
|
|
1417
|
+
* What the capture owner observed while writing the image. `displayRotation` is the rotation the display
|
|
1418
|
+
* rendered the pixels in, so a landscape value pairs with a landscape image; it is absent when the
|
|
1419
|
+
* owner has no rotation reading it can stand behind for this capture.
|
|
1420
|
+
*/
|
|
1421
|
+
type ScreenshotCaptureFacts = Readonly<{
|
|
1422
|
+
displayRotation?: DeviceRotation;
|
|
1423
|
+
/** Actual physical iOS capture route, including any fallback from CoreDevice to XCTest. */
|
|
1424
|
+
iosPhysicalCaptureBackend?: 'coredevice' | 'xctest';
|
|
1425
|
+
}>;
|
|
1426
|
+
type ElementSelectorKey = 'id' | 'label' | 'text' | 'value';
|
|
1427
|
+
type ElementSelectorTapOptions = {
|
|
1428
|
+
key: ElementSelectorKey;
|
|
1429
|
+
value: string;
|
|
1430
|
+
allowNonHittableCoordinateFallback?: boolean;
|
|
1431
|
+
expectedPoint?: Point;
|
|
1432
|
+
};
|
|
1433
|
+
/** Text-input geometry from the capture that measured the tap point; the native owner decides admission. */
|
|
1434
|
+
type CoordinateTapTextInputEvidence = Readonly<{
|
|
1435
|
+
targetBundleId: string;
|
|
1436
|
+
point: Point;
|
|
1437
|
+
textInputRects: readonly Rect[];
|
|
1438
|
+
}>;
|
|
1439
|
+
type PressPointOptions = Readonly<{
|
|
1440
|
+
button: 'primary' | 'secondary' | 'middle';
|
|
1441
|
+
count: number;
|
|
1442
|
+
intervalMs: number;
|
|
1443
|
+
holdMs: number;
|
|
1444
|
+
jitterPx: number;
|
|
1445
|
+
doubleTap: boolean;
|
|
1446
|
+
surface?: SessionSurface;
|
|
1447
|
+
coordinateTapTextInputEvidence?: CoordinateTapTextInputEvidence;
|
|
1448
|
+
}>;
|
|
1449
|
+
/**
|
|
1450
|
+
* The channel the XCTest runner actually entered text through — the Swift
|
|
1451
|
+
* `TextEntryResult.textEntryRoute` (RunnerTests+TextTyping.swift,
|
|
1452
|
+
* RunnerTests+SynthesizedTextEntry.swift). Closed set, because the runner is
|
|
1453
|
+
* its only producer and the boundary that narrows it
|
|
1454
|
+
* (readTypeTextBackendResult, packages/platform-apple/src/interactions.ts) drops a
|
|
1455
|
+
* route it cannot name — so a Swift-side addition would silently vanish. The
|
|
1456
|
+
* route-parity test in packages/platform-apple/src/interactions.test.ts
|
|
1457
|
+
* reads the Swift sources and fails instead.
|
|
1458
|
+
*/
|
|
1459
|
+
declare const TEXT_ENTRY_ROUTES: readonly ['xctest-element', 'synthesized-first-responder', 'synthesized-first-responder-replacement', 'xctest-application-fallback', 'watch-input-sheet'];
|
|
1460
|
+
type TextEntryRoute = (typeof TEXT_ENTRY_ROUTES)[number];
|
|
1461
|
+
/**
|
|
1462
|
+
* What `Interactor.type` reports back about the entry it performed. Only the
|
|
1463
|
+
* Apple runner populates it; every other platform types blind and returns void.
|
|
1464
|
+
*/
|
|
1465
|
+
type TypeTextBackendResult = {
|
|
1466
|
+
textEntryRoute?: TextEntryRoute;
|
|
1467
|
+
};
|
|
1468
|
+
type SnapshotOptions = SnapshotOptions$1 & {
|
|
1469
|
+
appBundleId?: string;
|
|
1470
|
+
signal?: AbortSignal;
|
|
1471
|
+
includeRects?: boolean;
|
|
1472
|
+
includeHiddenContentHints?: boolean;
|
|
1473
|
+
surface?: SessionSurface;
|
|
1474
|
+
/** Internal capture purpose; action outcomes always require the full tree. */
|
|
1475
|
+
acquisitionIntent?: 'full' | 'surface-observation';
|
|
1476
|
+
/** A stored observation remains current; action and settling captures do not supply this fact. */
|
|
1477
|
+
captureBasis?: 'unchanged-since-observation';
|
|
1478
|
+
/**
|
|
1479
|
+
* A one-off read, such as an open's launch observation. It may use a capture host the session
|
|
1480
|
+
* already keeps warm, but it never installs one or leaves running one that it started. It starts
|
|
1481
|
+
* no re-capture after `settleBy` (epoch ms); only `signal` cancels work already started.
|
|
1482
|
+
*/
|
|
1483
|
+
transient?: Readonly<{
|
|
1484
|
+
settleBy: number;
|
|
1485
|
+
}>;
|
|
1486
|
+
};
|
|
1487
|
+
/**
|
|
1488
|
+
* What `keyboard status` answers with, discriminated by which owner produced it: Android's IME
|
|
1489
|
+
* probe fields, or Apple's keyboard read (visible plus the focused field's return key). The daemon
|
|
1490
|
+
* derives the wire `platform` label from `kind` rather than re-deriving it from the device, so an
|
|
1491
|
+
* owner can only ever produce its own result shape.
|
|
1492
|
+
*
|
|
1493
|
+
* `returnKey` is the one field both owners carry, and it is present only on a visible keyboard: a
|
|
1494
|
+
* hidden one has no return key, so neither owner reports one. Each owner names the kinds its own
|
|
1495
|
+
* reading establishes; neither guesses the other's.
|
|
1496
|
+
*/
|
|
1497
|
+
type KeyboardStatusResult = Readonly<{
|
|
1498
|
+
kind: 'ime-probe';
|
|
1499
|
+
visible: boolean;
|
|
1500
|
+
inputType?: string;
|
|
1501
|
+
type?: string;
|
|
1502
|
+
inputMethodPackage?: string;
|
|
1503
|
+
focusedPackage?: string;
|
|
1504
|
+
focusedResourceId?: string;
|
|
1505
|
+
inputOwner?: string;
|
|
1506
|
+
returnKey?: KeyboardReturnKey;
|
|
1507
|
+
returnKeyLabel?: string;
|
|
1508
|
+
}> | Readonly<{
|
|
1509
|
+
kind: 'keyboard';
|
|
1510
|
+
visible: boolean;
|
|
1511
|
+
/**
|
|
1512
|
+
* The kinds the Apple reading can establish. `none` is excluded: this owner reads the keyboard's
|
|
1513
|
+
* own controls, which can name a key or fail to identify one, and never establishes that the
|
|
1514
|
+
* focused field offers no action (Android's `IME_ACTION_NONE` does). A layout with no return key,
|
|
1515
|
+
* such as a number pad, therefore answers `unknown` with no label rather than `none`.
|
|
1516
|
+
*/
|
|
1517
|
+
returnKey?: Exclude<KeyboardReturnKey, 'none'>;
|
|
1518
|
+
returnKeyLabel?: string;
|
|
1519
|
+
}>;
|
|
1520
|
+
/**
|
|
1521
|
+
* Owner-shaped dismiss evidence, discriminated by which owner produced it: Android's IME probe
|
|
1522
|
+
* fields, or iOS's `mechanism` disclosure (#1598), or HarmonyOS's bare acknowledgment (its HDC
|
|
1523
|
+
* key press reports nothing beyond success). The daemon derives the wire `platform` label from
|
|
1524
|
+
* `kind` rather than re-deriving it from the device, so an owner can only ever produce its own
|
|
1525
|
+
* result shape — an android-probe result under an `ios` label is unrepresentable.
|
|
1526
|
+
*/
|
|
1527
|
+
type KeyboardDismissResult = Readonly<{
|
|
1528
|
+
kind: 'ime-probe';
|
|
1529
|
+
attempts?: number;
|
|
1530
|
+
wasVisible?: boolean;
|
|
1531
|
+
dismissed?: boolean;
|
|
1532
|
+
visible?: boolean;
|
|
1533
|
+
inputType?: string;
|
|
1534
|
+
type?: string;
|
|
1535
|
+
inputMethodPackage?: string;
|
|
1536
|
+
focusedPackage?: string;
|
|
1537
|
+
focusedResourceId?: string;
|
|
1538
|
+
inputOwner?: string;
|
|
1539
|
+
}> | Readonly<{
|
|
1540
|
+
kind: 'mechanism';
|
|
1541
|
+
wasVisible?: boolean;
|
|
1542
|
+
dismissed?: boolean;
|
|
1543
|
+
visible?: boolean;
|
|
1544
|
+
mechanism?: string;
|
|
1545
|
+
}> | Readonly<{
|
|
1546
|
+
kind: 'acknowledged';
|
|
1547
|
+
}>;
|
|
1548
|
+
/**
|
|
1549
|
+
* Only the Apple runner echoes visibility around the return-key press; Android and HarmonyOS
|
|
1550
|
+
* acknowledge with no fields beyond success. Kind is owner-specific, not just content-shaped —
|
|
1551
|
+
* Android's and HarmonyOS's acknowledgments are structurally identical, so only the discriminant
|
|
1552
|
+
* itself tells the daemon which owner actually pressed enter.
|
|
1553
|
+
*/
|
|
1554
|
+
type KeyboardEnterResult = Readonly<{
|
|
1555
|
+
kind: 'visibility-echo';
|
|
1556
|
+
visible?: boolean;
|
|
1557
|
+
wasVisible?: boolean;
|
|
1558
|
+
}> | Readonly<{
|
|
1559
|
+
kind: 'android-acknowledged';
|
|
1560
|
+
}> | Readonly<{
|
|
1561
|
+
kind: 'harmonyos-acknowledged';
|
|
1562
|
+
}>;
|
|
1563
|
+
/**
|
|
1564
|
+
* Every acquisition carries its provenance pair atomically: the channel alone cannot say who
|
|
1565
|
+
* acquired the tree or which guarantees it carries, and `SnapshotProvenance`
|
|
1566
|
+
* (`@agent-device/kernel/snapshot`) makes a cross-channel `backend`/`producer` combination
|
|
1567
|
+
* fail to compile.
|
|
1568
|
+
*/
|
|
1569
|
+
type SnapshotResult = Omit<InteractorSnapshotCapture, 'backend' | 'nodes'> & {
|
|
1570
|
+
nodes?: RawSnapshotNode[];
|
|
1571
|
+
comparisonIdentity?: IosSnapshotComparisonIdentity;
|
|
1572
|
+
/**
|
|
1573
|
+
* Set when the capture describes an in-place iOS system surface (a web sign-in sheet) presented
|
|
1574
|
+
* over the session app rather than the app itself (#2438).
|
|
1575
|
+
*/
|
|
1576
|
+
systemSurface?: IosSystemSurfaceProvenance;
|
|
1577
|
+
/**
|
|
1578
|
+
* Whether this capture read a modal presentation over the app (#3565), computed by the producer on
|
|
1579
|
+
* the acquired tree before any projection. Absent means the producer published no fact at all,
|
|
1580
|
+
* which a consumer must treat as `'unknown'`.
|
|
1581
|
+
*/
|
|
1582
|
+
presentedSurface?: PresentedSurface;
|
|
1583
|
+
/**
|
|
1584
|
+
* Keyboard evidence acquired with this tree: measured `visible`, policy-derived `derived`,
|
|
1585
|
+
* additive `visibility-only`, rejected `tree-rejected`, proven `absent`, or unknown `unmeasurable` facts. Measured and
|
|
1586
|
+
* derived frames survive projection and take precedence over tree reconstruction. Visibility-only
|
|
1587
|
+
* facts carry no band; rejected acquisition geometry stays rejected. Other failed measurements or
|
|
1588
|
+
* an omitted fact may use tree geometry, but missing nodes never prove absence.
|
|
1589
|
+
* See {@link SnapshotKeyboardBandFact}.
|
|
1590
|
+
*/
|
|
1591
|
+
keyboard?: SnapshotKeyboardBandFact;
|
|
1592
|
+
/**
|
|
1593
|
+
* Set when this capture's own command had to bring the session app back to the foreground, i.e.
|
|
1594
|
+
* something else held it and an earlier observation described that instead (#2682).
|
|
1595
|
+
*/
|
|
1596
|
+
targetActivation?: IosTargetActivation;
|
|
1597
|
+
} & SnapshotProvenance;
|
|
1598
|
+
type SnapshotRuntimeAcquiredResult = Readonly<{
|
|
1599
|
+
stage: 'acquired';
|
|
1600
|
+
acquisition: IosSnapshotAcquisitionFacts & Readonly<{
|
|
1601
|
+
producer: IosAcquisitionProducer;
|
|
1602
|
+
}>;
|
|
1603
|
+
}>;
|
|
1604
|
+
type SnapshotRuntimeResult = SnapshotResult | SnapshotRuntimeAcquiredResult;
|
|
1605
|
+
/** The application an owner's launch reports it started, when the launch names one. */
|
|
1606
|
+
type ApplicationLaunchReport = Readonly<{
|
|
1607
|
+
launchedAppBundleId?: string;
|
|
1608
|
+
}>;
|
|
1609
|
+
type Interactor = {
|
|
1610
|
+
open(app: string, options?: {
|
|
1611
|
+
activity?: string;
|
|
1612
|
+
appBundleId?: string;
|
|
1613
|
+
launchConsole?: string;
|
|
1614
|
+
launchArgs?: string[];
|
|
1615
|
+
terminateRunningApp?: boolean;
|
|
1616
|
+
url?: string;
|
|
1617
|
+
}): Promise<ApplicationLaunchReport | void>;
|
|
1618
|
+
openDevice(): Promise<void>;
|
|
1619
|
+
close(app: string): Promise<void>;
|
|
1620
|
+
tap(x: number, y: number): Promise<Record<string, unknown> | void>;
|
|
1621
|
+
/** Complete point-press semantics for owners with fused series, alternate buttons, or surfaces. */
|
|
1622
|
+
pressPoint?(point: Point, options: PressPointOptions): Promise<Record<string, unknown> | void>;
|
|
1623
|
+
/** Alternate mouse buttons for owners that otherwise use the shared point-press series. */
|
|
1624
|
+
alternateClick?(point: Point, button: 'secondary' | 'middle'): Promise<Record<string, unknown> | void>;
|
|
1625
|
+
/** Owner-native ref routes; currently the managed web runtime is their only local owner. */
|
|
1626
|
+
tapRef?(ref: string): Promise<Record<string, unknown> | void>;
|
|
1627
|
+
tapElementSelector?(selector: ElementSelectorTapOptions): Promise<Record<string, unknown> | void>;
|
|
1628
|
+
/**
|
|
1629
|
+
* Fused double-click for owners that have one. The shared `--count` series cannot stand in for it —
|
|
1630
|
+
* it spaces and jitters independent presses rather than firing one pair the target reads as a
|
|
1631
|
+
* double — so an owner with no such mechanic leaves this undefined and `press --double` reports the
|
|
1632
|
+
* gap instead of resolving a denial.
|
|
1633
|
+
*/
|
|
1634
|
+
doubleTap?(x: number, y: number): Promise<Record<string, unknown> | void>;
|
|
1635
|
+
longPress(x: number, y: number, durationMs?: number): Promise<Record<string, unknown> | void>;
|
|
1636
|
+
/**
|
|
1637
|
+
* How the app the runner context names is running, as the platform reports it. The Apple runner
|
|
1638
|
+
* reads `XCUIApplication.state`; owners that read the foreground elsewhere leave it undefined.
|
|
1639
|
+
*/
|
|
1640
|
+
appState?(): Promise<AppStateRuntimeResult>;
|
|
1641
|
+
/**
|
|
1642
|
+
* Move the pointer to a point without pressing. Only pointer-driven
|
|
1643
|
+
* platforms (web today) implement it; touch platforms have no hover state
|
|
1644
|
+
* and leave it undefined, which the `hover` command reports as unsupported.
|
|
1645
|
+
*/
|
|
1646
|
+
hover?(x: number, y: number): Promise<Record<string, unknown> | void>;
|
|
1647
|
+
hoverRef?(ref: string): Promise<Record<string, unknown> | void>;
|
|
1648
|
+
focus(x: number, y: number): Promise<Record<string, unknown> | void>;
|
|
1649
|
+
type(text: string, delayMs?: number): Promise<TypeTextBackendResult | void>;
|
|
1650
|
+
/**
|
|
1651
|
+
* Replace the target's text with `text`. The empty string is the clear request (#2063), not a
|
|
1652
|
+
* no-op: an implementation must empty the field or fail — never report success over an
|
|
1653
|
+
* untouched value. A backend with no clear mechanism refuses the empty text up front (see the
|
|
1654
|
+
* webdriver interactor).
|
|
1655
|
+
*/
|
|
1656
|
+
fill(x: number, y: number, text: string, delayMs?: number, options?: {
|
|
1657
|
+
allowNonHittableCoordinateFallback?: boolean;
|
|
1658
|
+
}): Promise<Record<string, unknown> | void>;
|
|
1659
|
+
fillRef?(ref: string, text: string, delayMs?: number): Promise<Record<string, unknown> | void>;
|
|
1660
|
+
scroll(direction: ScrollDirection, options?: ScrollExecutionOptions): Promise<Record<string, unknown> | void>;
|
|
1661
|
+
screenshot(outPath: string, options?: ScreenshotOptions): Promise<ScreenshotCaptureFacts | void>;
|
|
1662
|
+
setViewport?(width: number, height: number): Promise<Record<string, unknown> | void>;
|
|
1663
|
+
snapshot(options?: SnapshotOptions): Promise<SnapshotRuntimeResult>;
|
|
1664
|
+
/**
|
|
1665
|
+
* Native reading of the live text at a point, when the backend has one. Answers the text the
|
|
1666
|
+
* owner can see right now, which can exceed what an already-captured node carries (an editable
|
|
1667
|
+
* field whose value is longer than its label). Optional: a backend without it leaves the
|
|
1668
|
+
* captured tree as the complete answer.
|
|
1669
|
+
*/
|
|
1670
|
+
readTextAtPoint?(point: Point, options?: {
|
|
1671
|
+
appBundleId?: string;
|
|
1672
|
+
surface?: SessionSurface;
|
|
1673
|
+
signal?: AbortSignal;
|
|
1674
|
+
target?: ElementTextTarget;
|
|
1675
|
+
}): Promise<string | undefined>;
|
|
1676
|
+
/**
|
|
1677
|
+
* Native text-presence reading, when the backend has one that does not require a tree capture.
|
|
1678
|
+
* A `true` answer is authoritative; anything else means "not proven here" and the caller
|
|
1679
|
+
* consults the canonical tree (see `FindTextResult`).
|
|
1680
|
+
*/
|
|
1681
|
+
findText?(text: string, options?: {
|
|
1682
|
+
appBundleId?: string;
|
|
1683
|
+
signal?: AbortSignal;
|
|
1684
|
+
}): Promise<{
|
|
1685
|
+
found: boolean;
|
|
1686
|
+
}>;
|
|
1687
|
+
gestureViewport?(includesKeyboard?: true): Promise<Rect>;
|
|
1688
|
+
back(mode?: BackMode): Promise<void>;
|
|
1689
|
+
/**
|
|
1690
|
+
* Optional (parity with `actionButton`): opens the springboard, a control not every owner
|
|
1691
|
+
* carries. An owner without it leaves it undefined; its fact refuses the press before binding,
|
|
1692
|
+
* and the system-button binder fails closed rather than resolving an absent member as a
|
|
1693
|
+
* successful no-op.
|
|
1694
|
+
*/
|
|
1695
|
+
home?(): Promise<void>;
|
|
1696
|
+
setOrientation(orientation: DeviceRotation): Promise<{
|
|
1697
|
+
orientation?: DeviceRotation;
|
|
1698
|
+
} | void>;
|
|
1699
|
+
/** Hands rotation back to the sensor; only an owner whose `setOrientation` locks it carries this. */
|
|
1700
|
+
unlockOrientation?(): Promise<void>;
|
|
1701
|
+
performGesture?(plan: GesturePlan): Promise<Record<string, unknown> | void>;
|
|
1702
|
+
/**
|
|
1703
|
+
* Optional (parity with `home`): opens the recents surface, a control not every owner carries.
|
|
1704
|
+
* An owner without it leaves it undefined; its fact refuses the press before binding, and the
|
|
1705
|
+
* system-button binder fails closed rather than resolving an absent member as a successful
|
|
1706
|
+
* no-op.
|
|
1707
|
+
*/
|
|
1708
|
+
appSwitcher?(): Promise<void>;
|
|
1709
|
+
/**
|
|
1710
|
+
* Optional (parity with `home`): presses one TV remote key, a control only TV-capable owners
|
|
1711
|
+
* carry. An owner without it leaves it undefined; its fact refuses the press before binding,
|
|
1712
|
+
* and the TV remote binder fails closed rather than resolving an absent member as a silent
|
|
1713
|
+
* no-op.
|
|
1714
|
+
*/
|
|
1715
|
+
tvRemote?(button: TvRemoteButton, durationMs?: number): Promise<void>;
|
|
1716
|
+
/**
|
|
1717
|
+
* Optional (parity with `keyboardDismiss`): presses the iPhone/iPad Action Button, hardware only
|
|
1718
|
+
* the Apple owner carries. An owner without the button leaves it undefined; its fact refuses the
|
|
1719
|
+
* press before binding, and the system-button binder fails closed rather than resolving an
|
|
1720
|
+
* absent member as a successful no-op.
|
|
1721
|
+
*/
|
|
1722
|
+
actionButton?(): Promise<void>;
|
|
1723
|
+
/**
|
|
1724
|
+
* Optional (parity with `actionButton`): sends one shake motion event to the device, which only
|
|
1725
|
+
* an owner with a host control for it carries. An owner without it leaves it undefined; its fact
|
|
1726
|
+
* refuses the shake before binding, and the system-button binder fails closed rather than
|
|
1727
|
+
* resolving an absent member as a successful no-op.
|
|
1728
|
+
*/
|
|
1729
|
+
shake?(): Promise<void>;
|
|
1730
|
+
/**
|
|
1731
|
+
* Optional (parity with `home`): presses the physical volume-up key once, a control phone
|
|
1732
|
+
* owners with a volume button carry. An owner without it leaves it undefined; its fact refuses
|
|
1733
|
+
* the press before binding, and the system-button binder fails closed rather than resolving an
|
|
1734
|
+
* absent member as a silent no-op.
|
|
1735
|
+
*/
|
|
1736
|
+
volumeUp?(): Promise<void>;
|
|
1737
|
+
/**
|
|
1738
|
+
* Optional (parity with `volumeUp`): presses the physical volume-down key once.
|
|
1739
|
+
*/
|
|
1740
|
+
volumeDown?(): Promise<void>;
|
|
1741
|
+
/**
|
|
1742
|
+
* Optional (parity with `volumeUp`): presses the physical power key once, which toggles the
|
|
1743
|
+
* screen on Android. Apple exposes no public power/lock button press, so no Apple leaf carries
|
|
1744
|
+
* it; an owner without it leaves it undefined and its fact refuses before binding.
|
|
1745
|
+
*/
|
|
1746
|
+
power?(): Promise<void>;
|
|
1747
|
+
/**
|
|
1748
|
+
* Optional (parity with `volumeUp`): presses the media mute key once. Android-only today:
|
|
1749
|
+
* Apple exposes no public mute press, so no Apple leaf carries it.
|
|
1750
|
+
*/
|
|
1751
|
+
mute?(): Promise<void>;
|
|
1752
|
+
/**
|
|
1753
|
+
* Optional (parity with `volumeUp`): sends the explicit Android sleep event (KEYCODE_SLEEP),
|
|
1754
|
+
* which turns the screen off without toggling the way `power` does.
|
|
1755
|
+
*/
|
|
1756
|
+
sleep?(): Promise<void>;
|
|
1757
|
+
/**
|
|
1758
|
+
* Optional (parity with `volumeUp`): sends the explicit Android wake event (KEYCODE_WAKEUP),
|
|
1759
|
+
* which turns the screen on without toggling the way `power` does.
|
|
1760
|
+
*/
|
|
1761
|
+
wake?(): Promise<void>;
|
|
1762
|
+
/**
|
|
1763
|
+
* Optional (parity with `volumeUp`): presses the media play/pause key once. The press goes to
|
|
1764
|
+
* whatever media session the OS routes it to; it does not claim playback started.
|
|
1765
|
+
*/
|
|
1766
|
+
mediaPlayPause?(): Promise<void>;
|
|
1767
|
+
/** Optional (parity with `mediaPlayPause`): presses the media next key once. */
|
|
1768
|
+
mediaNext?(): Promise<void>;
|
|
1769
|
+
/** Optional (parity with `mediaPlayPause`): presses the media previous key once. */
|
|
1770
|
+
mediaPrevious?(): Promise<void>;
|
|
1771
|
+
/** Optional (parity with `mediaPlayPause`): presses the media rewind key once. */
|
|
1772
|
+
mediaRewind?(): Promise<void>;
|
|
1773
|
+
/** Optional (parity with `mediaPlayPause`): presses the media fast-forward key once. */
|
|
1774
|
+
mediaFastForward?(): Promise<void>;
|
|
1775
|
+
/** Optional: owners with no live keyboard status read leave it undefined. Each owner answers with
|
|
1776
|
+
* its own {@link KeyboardStatusResult} kind. */
|
|
1777
|
+
keyboardStatus?(): Promise<KeyboardStatusResult>;
|
|
1778
|
+
/** Optional: platforms with no keyboard-dismiss concept leave it undefined. */
|
|
1779
|
+
keyboardDismiss?(): Promise<KeyboardDismissResult>;
|
|
1780
|
+
/** Optional: platforms with no keyboard-return concept leave it undefined. */
|
|
1781
|
+
keyboardEnter?(): Promise<KeyboardEnterResult>;
|
|
1782
|
+
/**
|
|
1783
|
+
* Optional (parity with `readSetting`): the owner's pasteboard read. An owner with no clipboard
|
|
1784
|
+
* surface leaves both halves undefined; its fact refuses the half before binding, and the
|
|
1785
|
+
* clipboard binder fails closed rather than resolving an absent member as an empty answer.
|
|
1786
|
+
*/
|
|
1787
|
+
readClipboard?(): Promise<string>;
|
|
1788
|
+
/**
|
|
1789
|
+
* Optional (parity with `readClipboard`): the owner's pasteboard write, with the same
|
|
1790
|
+
* fact-then-guard contract as the read.
|
|
1791
|
+
*/
|
|
1792
|
+
writeClipboard?(text: string): Promise<void>;
|
|
1793
|
+
setSetting(setting: string, state: string, appId?: string, options?: SettingOptions): Promise<Record<string, unknown> | void>;
|
|
1794
|
+
/**
|
|
1795
|
+
* Optional: reads back the value a device holds for one readable setting. The name is narrowed to
|
|
1796
|
+
* `READABLE_SETTINGS`, which is not every setting the write switch serves, and an owner's dispatch
|
|
1797
|
+
* is exhaustive over it — a setting joins the list only with an owner that answers it. An owner with
|
|
1798
|
+
* no read path leaves the member undefined; its fact refuses the read before binding, so an absent
|
|
1799
|
+
* method can never resolve into an empty answer.
|
|
1800
|
+
*/
|
|
1801
|
+
readSetting?(setting: ReadableSetting): Promise<ReadSettingResult>;
|
|
1802
|
+
/**
|
|
1803
|
+
* The four alert legs. Each owner runs its own observation and, where it needs one, its own
|
|
1804
|
+
* poll: an alert is a transient device surface, and how long to look for it — and how to press
|
|
1805
|
+
* its buttons — is family mechanics, not something a caller can supply. `timeoutMs` is the
|
|
1806
|
+
* whole window the caller allows; the owner spends it however its backend requires.
|
|
1807
|
+
*
|
|
1808
|
+
* Optional: an owner with no alert surface leaves all four undefined. Its facts refuse every leg
|
|
1809
|
+
* before binding, so the absent members are never resolved, and a fact that admitted a leg the
|
|
1810
|
+
* interactor cannot serve fails closed instead of answering empty.
|
|
1811
|
+
*/
|
|
1812
|
+
readAlert?(options?: AlertInteractorOptions): Promise<Record<string, unknown>>;
|
|
1813
|
+
awaitAlert?(options?: AlertInteractorOptions): Promise<Record<string, unknown>>;
|
|
1814
|
+
acceptAlert?(options?: AlertInteractorOptions): Promise<Record<string, unknown>>;
|
|
1815
|
+
dismissAlert?(options?: AlertInteractorOptions): Promise<Record<string, unknown>>;
|
|
1816
|
+
};
|
|
1817
|
+
/**
|
|
1818
|
+
* The session-derived target one alert leg acts on. `appBundleId` is separate from the runner
|
|
1819
|
+
* context's because the macOS helper reads a frontmost-app surface with no bundle at all, and
|
|
1820
|
+
* the two must not collapse into one field that means both.
|
|
1821
|
+
*/
|
|
1822
|
+
type AlertInteractorOptions = {
|
|
1823
|
+
timeoutMs?: number;
|
|
1824
|
+
/** The daemon request's cancellation; owners whose transport can abort thread it into the legs. */
|
|
1825
|
+
signal?: AbortSignal;
|
|
1826
|
+
appBundleId?: string;
|
|
1827
|
+
surface?: SessionSurface;
|
|
1828
|
+
};
|
|
1829
|
+
//#endregion
|
|
1830
|
+
//#region ../contracts/src/platform-runtime.d.ts
|
|
1831
|
+
type RuntimeOperationUnavailability = Readonly<{
|
|
1832
|
+
available: false;
|
|
1833
|
+
reason: 'unsupported-platform-leaf' | 'unsupported-device-kind' | 'unsupported-device-backend' | 'unsupported-device-scope' | 'unsupported-provider-mode' | 'owner-capability-missing' |
|
|
1834
|
+
/**
|
|
1835
|
+
* A hosted provider owns the network path for its session, so a live `network dump` has no
|
|
1836
|
+
* source to read. Where the provider records traffic at all, it publishes that report only
|
|
1837
|
+
* after its own session ends, on the provider's side.
|
|
1838
|
+
*/
|
|
1839
|
+
'network-capture-post-session';
|
|
1840
|
+
hint?: string;
|
|
1841
|
+
}>;
|
|
1842
|
+
type RuntimeSubjectFact = Readonly<{
|
|
1843
|
+
available: true;
|
|
1844
|
+
}> | RuntimeOperationUnavailability;
|
|
1845
|
+
/**
|
|
1846
|
+
* `subjects` names, for an operation an owner serves for only some of its subjects (the settings
|
|
1847
|
+
* `setSetting` changes), each subject's own fact; `unlisted` answers for every other subject.
|
|
1848
|
+
* Admission checks the requested subject's fact; a bound runtime keeps only `available`.
|
|
1849
|
+
*/
|
|
1850
|
+
type RuntimeOperationFact = Readonly<{
|
|
1851
|
+
available: true;
|
|
1852
|
+
subjects?: Readonly<Record<string, RuntimeSubjectFact>>;
|
|
1853
|
+
unlisted?: RuntimeOperationUnavailability;
|
|
1854
|
+
}> | RuntimeOperationUnavailability;
|
|
1855
|
+
//#endregion
|
|
1856
|
+
//#region ../contracts/src/snapshot-runtime.d.ts
|
|
1857
|
+
/** Runner metadata needed by the selected snapshot implementation, without request-owned state. */
|
|
1858
|
+
type SnapshotRuntimeExecution = Readonly<Omit<RunnerContext, 'appBundleId' | 'signal'>>;
|
|
1859
|
+
/** Neutral snapshot intent. The request binding supplies exact-owner authority. */
|
|
1860
|
+
type CaptureSnapshotInput = Readonly<{
|
|
1861
|
+
options?: Readonly<Omit<SnapshotOptions, 'signal'>>;
|
|
1862
|
+
execution?: SnapshotRuntimeExecution;
|
|
1863
|
+
/**
|
|
1864
|
+
* Per-capture cancellation, composed with the binding's own signal. A command that captures
|
|
1865
|
+
* once needs nothing here. A POLLING command does: `wait` enforces each poll's remaining
|
|
1866
|
+
* budget by aborting that capture and then waiting for it to quiesce (it deliberately does
|
|
1867
|
+
* not race-and-abandon, so a late capture cannot mutate session state or keep a helper).
|
|
1868
|
+
* Without this a stalled capture consumes the whole request instead of producing the poll's
|
|
1869
|
+
* stalled-capture verdict.
|
|
1870
|
+
*/
|
|
1871
|
+
signal?: AbortSignal;
|
|
1872
|
+
}>;
|
|
1873
|
+
//#endregion
|
|
1874
|
+
//#region ../contracts/src/macos-platform-leaf.d.ts
|
|
1875
|
+
/** The TCC services the macOS helper grants and resets. */
|
|
1876
|
+
type MacOsPermissionTarget = 'accessibility' | 'screen-recording' | 'input-monitoring';
|
|
1877
|
+
/** How an app-surface action reached the app, as the helper reports it. */
|
|
1878
|
+
type MacOsDeliveryMechanism = 'ax-press' | 'ax-focus' | 'ax-value' | 'ax-selected-text' | 'ax-confirm' | 'ax-scroll-bar' | 'ax-show-menu' | 'key-events';
|
|
1879
|
+
/** What the host answered one macOS tool: its streams and its exit code. */
|
|
1880
|
+
type MacOsCommandResult = Readonly<{
|
|
1881
|
+
stdout: string;
|
|
1882
|
+
stderr: string;
|
|
1883
|
+
exitCode: number;
|
|
1884
|
+
}>;
|
|
1885
|
+
/** How one macOS tool call runs. `kill` names a first signal for a child that must undo something. */
|
|
1886
|
+
type MacOsCommandOptions = Readonly<{
|
|
1887
|
+
cwd?: string;
|
|
1888
|
+
allowFailure?: boolean;
|
|
1889
|
+
timeoutMs?: number;
|
|
1890
|
+
signal?: AbortSignal;
|
|
1891
|
+
stdin?: string;
|
|
1892
|
+
kill?: Readonly<{
|
|
1893
|
+
signal: 'SIGTERM';
|
|
1894
|
+
graceMs: number;
|
|
1895
|
+
}>;
|
|
1896
|
+
}>;
|
|
1897
|
+
/** A process the host started and left running; the caller owns its stop. */
|
|
1898
|
+
type MacOsBackgroundProcess = Readonly<{
|
|
1899
|
+
pid?: number;
|
|
1900
|
+
wait: Promise<Readonly<{
|
|
1901
|
+
stdout: string;
|
|
1902
|
+
stderr: string;
|
|
1903
|
+
exitCode: number;
|
|
1904
|
+
}>>;
|
|
1905
|
+
terminate(): Promise<void>;
|
|
1906
|
+
}>;
|
|
1907
|
+
type MacOsInstalledApp = {
|
|
1908
|
+
bundleId: string;
|
|
1909
|
+
name: string;
|
|
1910
|
+
url?: string;
|
|
1911
|
+
};
|
|
1912
|
+
type MacOsOpenOptions = {
|
|
1913
|
+
background?: boolean;
|
|
1914
|
+
};
|
|
1915
|
+
/** The host routes a request may substitute: LaunchServices, the pasteboard, and appearance. */
|
|
1916
|
+
type MacOsHostProvider = {
|
|
1917
|
+
/** `background` launches or reopens without bringing the app to the front. */
|
|
1918
|
+
openBundle(bundleId: string, url?: string, options?: MacOsOpenOptions): Promise<void>;
|
|
1919
|
+
openTarget(target: string, options?: MacOsOpenOptions): Promise<void>;
|
|
1920
|
+
readClipboard(): Promise<string>;
|
|
1921
|
+
writeClipboard(text: string): Promise<void>;
|
|
1922
|
+
readDarkMode(): Promise<boolean>;
|
|
1923
|
+
setDarkMode(enabled: boolean): Promise<void>;
|
|
1924
|
+
listApps(filter: AppsFilter): Promise<MacOsInstalledApp[]>;
|
|
1925
|
+
};
|
|
1926
|
+
/**
|
|
1927
|
+
* The Apple tool routes of one request, as the Apple owner resolved them. The leaf runs every
|
|
1928
|
+
* command through `runCommand`, so a request that scopes its own Apple tools reaches the leaf too
|
|
1929
|
+
* and no command starts from the plugin's bundled copy of the host kit.
|
|
1930
|
+
*/
|
|
1931
|
+
type MacOsLeafTools = Readonly<{
|
|
1932
|
+
runCommand(cmd: string, args: string[], options?: MacOsCommandOptions): Promise<MacOsCommandResult>;
|
|
1933
|
+
/**
|
|
1934
|
+
* The process table of the host these tools run on. A scoped request answers it with its own
|
|
1935
|
+
* executor, so a probe never pairs pids from one host with tools on another.
|
|
1936
|
+
*/
|
|
1937
|
+
listProcesses(options: {
|
|
1938
|
+
timeoutMs: number;
|
|
1939
|
+
}): Promise<readonly Readonly<{
|
|
1940
|
+
pid: number;
|
|
1941
|
+
command: string;
|
|
1942
|
+
}>[]>;
|
|
1943
|
+
/** Starts a command the caller stops itself, with its output captured. */
|
|
1944
|
+
startBackground(cmd: string, args: string[]): Promise<MacOsBackgroundProcess>;
|
|
1945
|
+
/** The helper transport a scoped request supplies in place of the leaf's own binary. */
|
|
1946
|
+
helper?: Readonly<{
|
|
1947
|
+
run(args: string[], options?: MacOsCommandOptions): Promise<MacOsCommandResult>;
|
|
1948
|
+
}>;
|
|
1949
|
+
/** The host routes a scoped request supplies in place of the leaf's local ones. */
|
|
1950
|
+
host?: MacOsHostProvider;
|
|
1951
|
+
readPlistJson(path: string, signal?: AbortSignal): Promise<Record<string, unknown> | null>;
|
|
1952
|
+
/** True when a request scoped the Apple tools: the helper binary is then that scope's to name. */
|
|
1953
|
+
scoped: boolean;
|
|
1954
|
+
}>;
|
|
1955
|
+
/** The macOS wire cases of the Apple XCTest runner that the leaf maps commands to. */
|
|
1956
|
+
type MacOsRunnerCommand = Readonly<{
|
|
1957
|
+
command: 'desktopScroll';
|
|
1958
|
+
direction: ScrollDirection;
|
|
1959
|
+
amount?: number;
|
|
1960
|
+
pixels?: number;
|
|
1961
|
+
durationMs?: number;
|
|
1962
|
+
appBundleId?: string;
|
|
1963
|
+
}> | Readonly<{
|
|
1964
|
+
command: 'mouseClick';
|
|
1965
|
+
x: number;
|
|
1966
|
+
y: number;
|
|
1967
|
+
button: 'secondary' | 'middle';
|
|
1968
|
+
appBundleId?: string;
|
|
1969
|
+
}>;
|
|
1970
|
+
/**
|
|
1971
|
+
* The Apple XCTest runner, bound by the Apple owner to one macOS device. It is the only way the
|
|
1972
|
+
* leaf reaches the runner: the owner keeps the runner's build, session, and transport.
|
|
1973
|
+
*/
|
|
1974
|
+
type MacOsRunner = Readonly<{
|
|
1975
|
+
run(command: MacOsRunnerCommand, options?: RunnerCallOptions): Promise<Record<string, unknown>>;
|
|
1976
|
+
}>;
|
|
1977
|
+
type MacOsSurfaceSnapshotOptions = Omit<NonNullable<CaptureSnapshotInput['options']>, 'surface'> & {
|
|
1978
|
+
surface: MacOsHelperSurface;
|
|
1979
|
+
};
|
|
1980
|
+
type HelperContext = {
|
|
1981
|
+
bundleId?: string;
|
|
1982
|
+
signal?: AbortSignal;
|
|
1983
|
+
env: Readonly<EnvMap>;
|
|
1984
|
+
};
|
|
1985
|
+
type MacOsPressResult = {
|
|
1986
|
+
x: number;
|
|
1987
|
+
y: number;
|
|
1988
|
+
holdMs?: number;
|
|
1989
|
+
clicks?: number;
|
|
1990
|
+
doubleClick?: boolean;
|
|
1991
|
+
bundleId?: string;
|
|
1992
|
+
surface?: SessionSurface;
|
|
1993
|
+
mechanism?: MacOsDeliveryMechanism;
|
|
1994
|
+
/** The window the helper acted in, for an app-surface press. */
|
|
1995
|
+
windowTitle?: string;
|
|
1996
|
+
};
|
|
1997
|
+
/**
|
|
1998
|
+
* The interactor members the `native` app backend serves itself. The Apple owner assembles the
|
|
1999
|
+
* session's interactor from these and from its own members that never reach the runner.
|
|
2000
|
+
*/
|
|
2001
|
+
type MacOsNativeAppActions = Required<Pick<Interactor, 'tap' | 'pressPoint' | 'longPress' | 'focus' | 'type' | 'fill' | 'scroll' | 'back' | 'setOrientation'>>;
|
|
2002
|
+
/** Every macOS operation the Apple owner delegates, bound to one request's tools. */
|
|
2003
|
+
type MacOsLeafOperations = Readonly<{
|
|
2004
|
+
resolveApp(app: string): Promise<string>;
|
|
2005
|
+
/** The open target of an app device (ADR 0035): its own app, which a link alone also opens. */
|
|
2006
|
+
resolveAppDeviceOpenTarget(device: DeviceInfo, target: string | undefined): Promise<{
|
|
2007
|
+
appBundleId: string;
|
|
2008
|
+
appName?: string;
|
|
2009
|
+
}>;
|
|
2010
|
+
openApp(device: DeviceInfo, app: string, options?: {
|
|
2011
|
+
appBundleId?: string;
|
|
2012
|
+
url?: string;
|
|
2013
|
+
}): Promise<void>;
|
|
2014
|
+
closeApp(device: DeviceInfo, app: string, env: Readonly<EnvMap>): Promise<void>;
|
|
2015
|
+
listApps(filter: AppsFilter): Promise<MacOsInstalledApp[]>;
|
|
2016
|
+
readClipboardText(): Promise<string>;
|
|
2017
|
+
writeClipboardText(text: string): Promise<void>;
|
|
2018
|
+
setAppearance(state: string): Promise<void>;
|
|
2019
|
+
frontmostApp(env: Readonly<EnvMap>): Promise<{
|
|
2020
|
+
bundleId?: string;
|
|
2021
|
+
appName?: string;
|
|
2022
|
+
pid?: number;
|
|
2023
|
+
}>;
|
|
2024
|
+
runPermissionAction(action: 'grant' | 'reset', target: MacOsPermissionTarget, env: Readonly<EnvMap>): Promise<{
|
|
2025
|
+
target: MacOsPermissionTarget;
|
|
2026
|
+
granted: boolean;
|
|
2027
|
+
requested: boolean;
|
|
2028
|
+
openedSettings: boolean;
|
|
2029
|
+
action: 'grant' | 'reset';
|
|
2030
|
+
message?: string;
|
|
2031
|
+
}>;
|
|
2032
|
+
runAlertAction(action: 'get' | 'accept' | 'dismiss', options: {
|
|
2033
|
+
bundleId?: string;
|
|
2034
|
+
surface?: SessionSurface;
|
|
2035
|
+
env: Readonly<EnvMap>;
|
|
2036
|
+
}): Promise<{
|
|
2037
|
+
title?: string;
|
|
2038
|
+
role?: string;
|
|
2039
|
+
buttons?: string[];
|
|
2040
|
+
action?: string;
|
|
2041
|
+
bundleId?: string;
|
|
2042
|
+
}>;
|
|
2043
|
+
readTextAtPoint(x: number, y: number, options: HelperContext & {
|
|
2044
|
+
surface: MacOsHelperSurface;
|
|
2045
|
+
}): Promise<{
|
|
2046
|
+
text: string;
|
|
2047
|
+
}>;
|
|
2048
|
+
press(x: number, y: number, options: HelperContext & {
|
|
2049
|
+
surface: MacOsHelperSurface;
|
|
2050
|
+
holdMs?: number;
|
|
2051
|
+
/** Independent presses, each a single click; `--count` on every platform. */
|
|
2052
|
+
clicks?: number;
|
|
2053
|
+
/** Post each press as a double-click pair; `--double-tap`. */
|
|
2054
|
+
doubleClick?: boolean;
|
|
2055
|
+
intervalMs?: number;
|
|
2056
|
+
}): Promise<MacOsPressResult>;
|
|
2057
|
+
screenshot(outPath: string, options: HelperContext & {
|
|
2058
|
+
surface: MacOsHelperSurface;
|
|
2059
|
+
}): Promise<{
|
|
2060
|
+
path: string;
|
|
2061
|
+
surface?: SessionSurface;
|
|
2062
|
+
}>;
|
|
2063
|
+
captureSurfaceSnapshot(options: MacOsSurfaceSnapshotOptions, signal: AbortSignal | undefined, env: Readonly<EnvMap>): Promise<SnapshotResult>;
|
|
2064
|
+
/** Samples host system audio through the helper's ScreenCaptureKit probe. */
|
|
2065
|
+
startAudioProbe(options: {
|
|
2066
|
+
durationMs: number;
|
|
2067
|
+
bucketMs: number;
|
|
2068
|
+
statusPath: string;
|
|
2069
|
+
env: Readonly<EnvMap>;
|
|
2070
|
+
}): Promise<MacOsBackgroundProcess>;
|
|
2071
|
+
/**
|
|
2072
|
+
* The actions of the `native` app backend: helper actions, with no runner request. `base` is the
|
|
2073
|
+
* Apple owner's interactor, which the press of another surface goes back to.
|
|
2074
|
+
*/
|
|
2075
|
+
nativeAppActions(base: Pick<Interactor, 'pressPoint'>, context: RunnerContext, env: Readonly<EnvMap>): Promise<MacOsNativeAppActions>;
|
|
2076
|
+
/** The operations the `native` app backend refuses at admission. */
|
|
2077
|
+
nativeBackendFacts(): Promise<Readonly<Record<string, RuntimeOperationFact>>>;
|
|
2078
|
+
/** The XCTest backend's desktop scroll, mapped to the runner's `desktopScroll` wire case. */
|
|
2079
|
+
desktopScroll(runner: MacOsRunner, context: RunnerContext, runnerOptions: RunnerCallOptions, direction: ScrollDirection, options?: ScrollExecutionOptions): Promise<Record<string, unknown>>;
|
|
2080
|
+
/** The XCTest backend's secondary and middle click, mapped to the `mouseClick` wire case. */
|
|
2081
|
+
alternateClick(runner: MacOsRunner, context: RunnerContext, runnerOptions: RunnerCallOptions, point: {
|
|
2082
|
+
x: number;
|
|
2083
|
+
y: number;
|
|
2084
|
+
}, button: 'secondary' | 'middle'): Promise<Record<string, unknown>>;
|
|
2085
|
+
}>;
|
|
2086
|
+
/** What the macOS leaf's `setup(host)` registers. */
|
|
2087
|
+
type MacOsPlatformLeafRegistration = Readonly<{
|
|
2088
|
+
family: 'apple';
|
|
2089
|
+
appleOs: 'macos';
|
|
2090
|
+
/** Binds the leaf's operations to the tools the Apple owner resolved for one request. */
|
|
2091
|
+
bind(tools: MacOsLeafTools): MacOsLeafOperations;
|
|
2092
|
+
}>;
|
|
2093
|
+
//#endregion
|
|
2094
|
+
//#region src/index.d.ts
|
|
2095
|
+
declare function macOsPlatformPlugin(): {
|
|
2096
|
+
apiVersion: 3;
|
|
2097
|
+
contributes: [{
|
|
2098
|
+
kind: "platform";
|
|
2099
|
+
family: "apple";
|
|
2100
|
+
appleOs: "macos";
|
|
2101
|
+
setup(host: PlatformHost): MacOsPlatformLeafRegistration;
|
|
2102
|
+
}];
|
|
2103
|
+
};
|
|
2104
|
+
//#endregion
|
|
2105
|
+
export { macOsPlatformPlugin as default };
|