agent-device 0.20.8 → 0.20.10

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.
Files changed (220) hide show
  1. package/README.md +94 -31
  2. package/android/ime-helper/dist/{agent-device-android-ime-helper-0.20.8.apk → agent-device-android-ime-helper-0.20.10.apk} +0 -0
  3. package/android/ime-helper/dist/agent-device-android-ime-helper-0.20.10.apk.sha256 +1 -0
  4. package/android/ime-helper/dist/{agent-device-android-ime-helper-0.20.8.manifest.json → agent-device-android-ime-helper-0.20.10.manifest.json} +4 -4
  5. package/android/snapshot-helper/dist/{agent-device-android-snapshot-helper-0.20.8.apk → agent-device-android-snapshot-helper-0.20.10.apk} +0 -0
  6. package/android/snapshot-helper/dist/agent-device-android-snapshot-helper-0.20.10.apk.sha256 +1 -0
  7. package/android/snapshot-helper/dist/{agent-device-android-snapshot-helper-0.20.8.manifest.json → agent-device-android-snapshot-helper-0.20.10.manifest.json} +6 -6
  8. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerAXSnapshotBridge.h +3 -0
  9. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerAXSnapshotBridge.m +13 -7
  10. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+AXSnapshotFallback.swift +10 -117
  11. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+CommandExecution.swift +4 -4
  12. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+FlatSnapshotFiltering.swift +103 -2
  13. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Interaction.swift +22 -23
  14. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Models.swift +3 -23
  15. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Navigation.swift +10 -11
  16. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+PrivateAXPresentation.swift +108 -0
  17. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+ScrollGesture.swift +8 -5
  18. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Snapshot.swift +179 -73
  19. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SnapshotCapturePlan.swift +13 -12
  20. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SnapshotPresentation.swift +183 -0
  21. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SnapshotPresentationTests.swift +0 -0
  22. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SystemModal.swift +20 -18
  23. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+TextInputCandidatePolicy.swift +19 -0
  24. package/dist/src/agent-browser-tool.js +1 -1
  25. package/dist/src/agent-device-client.js +2 -2
  26. package/dist/src/ai-sdk.d.ts +61 -0
  27. package/dist/src/ai-sdk.js +1 -0
  28. package/dist/src/android-adb.d.ts +6 -6
  29. package/dist/src/android-adb.js +1 -1
  30. package/dist/src/android.js +1 -1
  31. package/dist/src/app-helpers.js +1 -1
  32. package/dist/src/app-lifecycle.js +6 -7
  33. package/dist/src/app-lifecycle2.js +2 -2
  34. package/dist/src/app-log-reconnect.js +1 -1
  35. package/dist/src/app-log-runtime.js +3 -3
  36. package/dist/src/app-resolution.js +2 -2
  37. package/dist/src/app-state.js +2 -0
  38. package/dist/src/appearance.js +1 -0
  39. package/dist/src/apps.js +5 -5
  40. package/dist/src/artifacts.d.ts +1 -1
  41. package/dist/src/audio-probe.js +1 -1
  42. package/dist/src/auth-session.js +1 -1
  43. package/dist/src/backend-snapshot-options.js +1 -0
  44. package/dist/src/boot-diagnostics.js +2 -2
  45. package/dist/src/bounds.js +1 -0
  46. package/dist/src/byte-limit-stream.js +1 -0
  47. package/dist/src/cli-config.js +1 -1
  48. package/dist/src/cli-help.js +42 -30
  49. package/dist/src/cli-runner.js +1 -1
  50. package/dist/src/cli.js +7 -7
  51. package/dist/src/client-metro.js +1 -1
  52. package/dist/src/client-types.d.ts +1582 -0
  53. package/dist/src/command-catalog.js +1 -0
  54. package/dist/src/command-metadata.js +1 -1
  55. package/dist/src/command-schema.js +1 -1
  56. package/dist/src/command-surface.js +1 -1
  57. package/dist/src/command-tools.js +2 -0
  58. package/dist/src/config.js +1 -0
  59. package/dist/src/connection-runtime.js +1 -1
  60. package/dist/src/connection.js +3 -3
  61. package/dist/src/contracts.d.ts +1 -1
  62. package/dist/src/contracts.js +1 -1
  63. package/dist/src/daemon-shutdown-report.js +1 -1
  64. package/dist/src/daemon.js +1 -1
  65. package/dist/src/debug-symbols.js +3 -3
  66. package/dist/src/device-claim-inspection.js +1 -1
  67. package/dist/src/device-input-state.js +1 -1
  68. package/dist/src/device-ready.js +1 -1
  69. package/dist/src/device2.js +2 -2
  70. package/dist/src/dispatch.js +1 -1
  71. package/dist/src/entities.js +1 -1
  72. package/dist/src/find.js +1 -1
  73. package/dist/src/finders.js +1 -1
  74. package/dist/src/generic-settle.js +1 -1
  75. package/dist/src/generic.js +1 -1
  76. package/dist/src/harmonyos.js +1 -1
  77. package/dist/src/hdc.js +1 -1
  78. package/dist/src/helper-package-install.js +1 -0
  79. package/dist/src/helper.js +2 -2
  80. package/dist/src/host-process.js +1 -1
  81. package/dist/src/ime-lifecycle.js +2 -9
  82. package/dist/src/ime-recovery-marker.js +1 -0
  83. package/dist/src/index.d.ts +2 -1569
  84. package/dist/src/index.js +1 -1
  85. package/dist/src/input-actions.js +4 -4
  86. package/dist/src/input-actions2.js +1 -1
  87. package/dist/src/install-artifact.js +1 -1
  88. package/dist/src/install-artifact2.js +1 -1
  89. package/dist/src/install-source2.js +1 -1
  90. package/dist/src/interaction-common.js +1 -0
  91. package/dist/src/interaction-runtime.js +1 -1
  92. package/dist/src/interaction-snapshot.js +1 -1
  93. package/dist/src/interaction.js +1 -1
  94. package/dist/src/interaction2.js +1 -0
  95. package/dist/src/interactor.js +2 -2
  96. package/dist/src/interactor2.js +1 -1
  97. package/dist/src/interactors.js +1 -0
  98. package/dist/src/internal/bin.js +2 -2
  99. package/dist/src/internal/daemon.js +4 -7
  100. package/dist/src/internal/png-worker.js +1 -1
  101. package/dist/src/inventory.js +1 -1
  102. package/dist/src/keyed-lock.js +1 -0
  103. package/dist/src/lease-context.js +1 -1
  104. package/dist/src/lease.js +1 -1
  105. package/dist/src/limrun-runtime-dependencies.js +1 -1
  106. package/dist/src/limrun.d.ts +13 -3
  107. package/dist/src/limrun.js +1 -1
  108. package/dist/src/linux.js +1 -1
  109. package/dist/src/location-coordinates.js +1 -0
  110. package/dist/src/logcat.js +1 -1
  111. package/dist/src/manifest.js +1 -1
  112. package/dist/src/mobile-snapshot-semantics.js +1 -0
  113. package/dist/src/observability.js +1 -0
  114. package/dist/src/owner-identity.js +1 -1
  115. package/dist/src/perf.js +4 -0
  116. package/dist/src/physical-device-control.js +1 -1
  117. package/dist/src/platform-runtime-app-log-process.js +1 -1
  118. package/dist/src/platform-runtime-host.js +1 -1
  119. package/dist/src/platform-runtime-network-web-transport.js +1 -1
  120. package/dist/src/platform-runtime-open-target.js +1 -0
  121. package/dist/src/platform-runtime-operation-host.js +4 -4
  122. package/dist/src/platform-runtime-runtime-hints.js +2 -0
  123. package/dist/src/platform-runtime-screen-recording-apple-runner-host.js +1 -1
  124. package/dist/src/platform-runtime-screen-recording-apple-runner-transport.js +1 -1
  125. package/dist/src/platform-runtime-screen-recording-apple-transport.js +1 -1
  126. package/dist/src/platform-runtime-screen-recording-finalizer-host.js +1 -1
  127. package/dist/src/platform-runtime-screen-recording-web-host.js +1 -1
  128. package/dist/src/platform-runtime.js +1 -1
  129. package/dist/src/platform-runtime2.js +1 -0
  130. package/dist/src/plist.js +1 -1
  131. package/dist/src/png-resize.js +1 -0
  132. package/dist/src/png-worker-contract.js +1 -1
  133. package/dist/src/process-lock.js +1 -1
  134. package/dist/src/project-runtime.js +1 -0
  135. package/dist/src/provider-webdriver.js +1 -1
  136. package/dist/src/provider.js +1 -0
  137. package/dist/src/proxy.js +1 -1
  138. package/dist/src/react-native.js +1 -1
  139. package/dist/src/record-runtime.js +1 -1
  140. package/dist/src/record-trace.js +1 -1
  141. package/dist/src/recording-export-quality.js +1 -0
  142. package/dist/src/registry.js +29 -26
  143. package/dist/src/remote-config2.js +1 -1
  144. package/dist/src/replay.js +2 -2
  145. package/dist/src/reporting.js +5 -5
  146. package/dist/src/rolldown-runtime.js +1 -0
  147. package/dist/src/runner-client.js +1 -0
  148. package/dist/src/runner-disposal.js +1 -1
  149. package/dist/src/runner-lease.js +1 -1
  150. package/dist/src/runner-sequence.js +1 -1
  151. package/dist/src/runtime-transport.js +1 -1
  152. package/dist/src/runtime.js +3 -3
  153. package/dist/src/runtime2.js +4 -3
  154. package/dist/src/runtime3.js +1 -3
  155. package/dist/src/runtime4.js +3 -1
  156. package/dist/src/runtime5.js +1 -1
  157. package/dist/src/runtime6.js +1 -1
  158. package/dist/src/runtime7.js +1 -1
  159. package/dist/src/runtime8.js +1 -0
  160. package/dist/src/runtime9.js +1 -0
  161. package/dist/src/scoped-provider.js +1 -0
  162. package/dist/src/screenshot-density.js +1 -0
  163. package/dist/src/screenshot-result.js +4 -4
  164. package/dist/src/screenshot.js +1 -1
  165. package/dist/src/script-source-bundle.js +16 -0
  166. package/dist/src/sdk-android-adb.d.ts +44 -26
  167. package/dist/src/sdk-android-adb.js +4 -4
  168. package/dist/src/sdk-batch-runner.js +3 -3
  169. package/dist/src/sdk-contracts.d.ts +125 -88
  170. package/dist/src/sdk-contracts.js +2 -2
  171. package/dist/src/sdk-device.js +1 -1
  172. package/dist/src/sdk-finders.d.ts +1 -1
  173. package/dist/src/sdk-finders.js +1 -1
  174. package/dist/src/sdk-io.js +1 -1
  175. package/dist/src/sdk-remote-config.js +1 -1
  176. package/dist/src/sdk-selectors.d.ts +107 -95
  177. package/dist/src/sdk-selectors.js +1 -1
  178. package/dist/src/sdk.js +1 -0
  179. package/dist/src/selector-runtime.js +1 -1
  180. package/dist/src/selectors.d.ts +1 -1
  181. package/dist/src/selectors.js +1 -1
  182. package/dist/src/server.js +10 -3
  183. package/dist/src/session-target-evidence.js +1 -1
  184. package/dist/src/session.js +1 -30
  185. package/dist/src/session2.js +27 -0
  186. package/dist/src/setting-state.js +1 -1
  187. package/dist/src/shared.js +1 -1
  188. package/dist/src/simctl.js +1 -0
  189. package/dist/src/simulator-state.js +1 -0
  190. package/dist/src/simulator.js +1 -1
  191. package/dist/src/snapshot-runtime.js +1 -1
  192. package/dist/src/snapshot-scope.js +1 -0
  193. package/dist/src/snapshot-session.js +1 -1
  194. package/dist/src/snapshot.js +8 -1
  195. package/dist/src/snapshot2.js +1 -1
  196. package/dist/src/snapshot3.js +1 -0
  197. package/dist/src/src.js +1 -1
  198. package/dist/src/src2.js +1 -2
  199. package/dist/src/src3.js +2 -1
  200. package/dist/src/src4.js +1 -0
  201. package/dist/src/string-enum.js +1 -0
  202. package/dist/src/tool-provider.js +3 -3
  203. package/dist/src/tool-provider2.js +1 -1
  204. package/dist/src/tool-provider3.js +1 -1
  205. package/dist/src/update-check.js +1 -1
  206. package/dist/src/verdict.js +1 -0
  207. package/dist/src/verified-file.js +1 -0
  208. package/dist/src/version.js +1 -1
  209. package/dist/src/video.js +1 -1
  210. package/dist/src/web.js +1 -1
  211. package/package.json +27 -10
  212. package/server.json +3 -3
  213. package/android/ime-helper/dist/agent-device-android-ime-helper-0.20.8.apk.sha256 +0 -1
  214. package/android/snapshot-helper/dist/agent-device-android-snapshot-helper-0.20.8.apk.sha256 +0 -1
  215. package/dist/src/interaction-touch-reference-frame.js +0 -1
  216. package/dist/src/notifications.js +0 -1
  217. package/dist/src/platform-runtime-toolchain-host.js +0 -1
  218. package/dist/src/prepare-kind.js +0 -15
  219. package/dist/src/selector-vocabulary.js +0 -1
  220. package/dist/src/text-surface.js +0 -1
@@ -1,1573 +1,6 @@
1
- import { A as SnapshotNode, B as DeviceTarget, C as normalizeAgentDeviceError, F as SnapshotVisibility, H as PlatformSelector, I as centerOfRect, L as AppleOS, M as SnapshotQualityVerdict, P as SnapshotUnchanged, S as isAgentDeviceError, U as PublicPlatform, _ as SessionRuntimeHints, a as DaemonRequest, b as NormalizedError, f as LeaseBackend, g as SessionIsolationMode, h as ResponseLevel, i as DaemonLockPolicy, o as DaemonResponse, p as NetworkIncludeMode, r as DaemonInstallSource, s as DaemonResponseData, t as DaemonArtifact, v as AppError, y as DaemonError, z as DeviceKind } from "./sdk-contracts.js";
2
- import { c as ScrollDirection, d as SwipePreset, f as TransformGestureParams, l as ScrollInputDirection, s as GesturePointerCount, u as SwipePattern } from "./sdk-android-adb.js";
3
- import { C as SessionSurface, D as BackMode, E as ClickButton, S as SnapshotDiagnosticsSummary, T as DeviceRotation, b as FindLocator, d as ClickCommandResponseData, f as FillCommandResponseData, g as SettleObservation, h as PressCommandResponseData, m as LongPressCommandResponseData, p as FindCommandResponseData, w as TvRemoteButton, x as ScreenshotResultData, y as AndroidSnapshotBackendMetadata } from "./sdk-selectors.js";
4
- import { t as AppsFilter } from "./app-inventory.js";
5
- import { r as CloudProviderSessionResult, t as AgentArtifactsResult } from "./cloud-artifacts.js";
6
- import { t as BatchRunResult } from "./sdk-batch-runner.js";
7
- import { a as RemoteConnectionProfileFields, c as MetroPrepareResult, i as CloudProviderProfileFields, l as MetroReloadOptions, s as MetroPrepareOptions, u as MetroReloadResult } from "./sdk-remote-config.js";
1
+ import { A as AppError, F as normalizeAgentDeviceError, P as isAgentDeviceError, k as centerOfRect } from "./sdk-contracts.js";
2
+ import { n as AgentDeviceClientConfig, r as AgentDeviceDaemonTransport, t as AgentDeviceClient } from "./client-types.js";
8
3
  import { p as createLocalArtifactAdapter } from "./sdk-io.js";
9
- //#region packages/contracts/src/alert-contract.d.ts
10
- declare const ALERT_ACTIONS: readonly ['get', 'accept', 'dismiss', 'wait'];
11
- type AlertAction = (typeof ALERT_ACTIONS)[number];
12
- //#endregion
13
- //#region packages/contracts/src/clipboard.d.ts
14
- /**
15
- * Closed result of the `clipboard` command. Mirrors the dispatch handler's
16
- * literal return EXACTLY (src/core/dispatch.ts `handleClipboardCommand`): a
17
- * discriminated union on `action`. `read` returns the clipboard `text`; `write`
18
- * reports the written `textLength` plus the `successText` message. The handler
19
- * spreads nothing else, so each branch is closed.
20
- */
21
- type ClipboardCommandResult = {
22
- action: 'read';
23
- text: string;
24
- } | {
25
- action: 'write';
26
- textLength: number;
27
- message: string;
28
- };
29
- //#endregion
30
- //#region packages/contracts/src/keyboard.d.ts
31
- /**
32
- * Closed result of the `keyboard` command, grounded in the dispatch handlers'
33
- * literal returns (src/core/dispatch.ts `handleAndroidKeyboardCommand` /
34
- * `handleIosKeyboardCommand`).
35
- *
36
- * `platform` and `action` are always present; the remaining fields appear per
37
- * branch (Android `status`/`dismiss` carry the keyboard-state fields; `enter`
38
- * and iOS `dismiss` carry a `message`). It is kept as a flat closed shape rather
39
- * than a five-way `platform`×`action` union because the per-branch field sets
40
- * overlap heavily and the underlying Android keyboard-state types live in the
41
- * platform layer (below the public contract). The `Record` index signature of
42
- * the previous hand-written mirror is dropped, and the spurious `| null`s are
43
- * removed (the handler never returns `null` for these).
44
- */
45
- type KeyboardCommandResult = {
46
- platform: 'android' | 'ios';
47
- action: 'status' | 'dismiss' | 'enter';
48
- visible?: boolean;
49
- wasVisible?: boolean;
50
- dismissed?: boolean;
51
- attempts?: number;
52
- inputType?: string;
53
- type?: 'text' | 'number' | 'email' | 'phone' | 'password' | 'datetime' | 'unknown';
54
- inputMethodPackage?: string;
55
- focusedPackage?: string;
56
- focusedResourceId?: string;
57
- inputOwner?: 'app' | 'ime' | 'unknown';
58
- message?: string;
59
- /** iOS `dismiss` only (#1598): which mechanism actually resigned the
60
- * keyboard — 'dismissKey' (tapped the keyboard's own Hide/Dismiss/Done
61
- * key). Generic background-tap dismissal is deliberately unsupported
62
- * (#1606 review): no query can prove a coordinate is side-effect-free,
63
- * so the runner only ever taps the keyboard's own control. Absent when
64
- * the keyboard was not dismissed. */
65
- mechanism?: 'dismissKey';
66
- };
67
- //#endregion
68
- //#region packages/contracts/src/navigation.d.ts
69
- /**
70
- * Closed results of the navigation/global action commands. Each mirrors the
71
- * dispatch handler's literal return EXACTLY (src/core/dispatch.ts
72
- * `DISPATCH_HANDLERS`): a fixed `action` discriminant plus the always-present
73
- * `successText` message (the handlers always pass a non-empty message, so it is
74
- * required here). The handlers spread nothing else, so the shapes are closed —
75
- * consistent with the `viewport` contract, the generic-dispatch Android
76
- * dialog-recovery `warning` annotation is intentionally not part of the contract.
77
- */
78
- /** `home` — `{ action: 'home', message: 'Home' }`. */
79
- type HomeCommandResult = {
80
- action: 'home';
81
- message: string;
82
- };
83
- /**
84
- * `back` — `{ action: 'back', mode, message: 'Back' }`; `mode` defaults to
85
- * `'in-app'`. The one field the generic route may add on top of the dispatch
86
- * handler's literal return: `settle`, the opt-in `--settle` observation
87
- * (#1638), attached after the command by the generic dispatcher.
88
- */
89
- type BackCommandResult = {
90
- action: 'back';
91
- mode: BackMode;
92
- message: string;
93
- settle?: SettleObservation;
94
- };
95
- /** `orientation` — `{ action: 'orientation', orientation, message: 'Rotated to <orientation>' }`. */
96
- type OrientationCommandResult = {
97
- action: 'orientation';
98
- orientation: DeviceRotation;
99
- message: string;
100
- };
101
- /**
102
- * @deprecated The `rotate` command was renamed to `orientation`. This is the
103
- * legacy response contract (`action: 'rotate'`) that shipped in v0.18/v0.19,
104
- * retained for existing SDK consumers until the next major version. New code
105
- * should use {@link OrientationCommandResult}.
106
- */
107
- type RotateCommandResult = {
108
- action: 'rotate';
109
- orientation: DeviceRotation;
110
- message: string;
111
- };
112
- /** `app-switcher` — `{ action: 'app-switcher', message: 'Opened app switcher' }`. */
113
- type AppSwitcherCommandResult = {
114
- action: 'app-switcher';
115
- message: string;
116
- };
117
- /** `tv-remote` — `{ action: 'tv-remote', button, durationMs?, message }`. */
118
- type TvRemoteCommandResult = {
119
- action: 'tv-remote';
120
- button: TvRemoteButton;
121
- durationMs?: number;
122
- message: string;
123
- };
124
- //#endregion
125
- //#region packages/contracts/src/wait.d.ts
126
- /**
127
- * Public daemon result for `wait`. The runtime-local result carries a `kind`
128
- * discriminant, but `toDaemonWaitData` intentionally projects the normal daemon
129
- * payload to this compact shape. The direct iOS selector fast path may still
130
- * include `kind: 'selector'` additively.
131
- */
132
- type WaitCommandResult = {
133
- waitedMs: number;
134
- kind?: 'selector';
135
- text?: string;
136
- selector?: string;
137
- captures?: number;
138
- nodeCount?: number;
139
- hint?: string;
140
- warning?: string;
141
- };
142
- //#endregion
143
- //#region packages/contracts/src/app-events.d.ts
144
- type TriggerAppEventCommandResult = {
145
- event: string;
146
- eventUrl: string;
147
- transport: 'deep-link';
148
- message: string;
149
- };
150
- //#endregion
151
- //#region packages/contracts/src/app-state.d.ts
152
- /**
153
- * Closed result of the `appstate` command, grounded in the daemon handler's
154
- * success returns (src/daemon/handlers/session-state.ts `handleAppStateCommand`).
155
- * A discriminated union on `platform`:
156
- * - Apple (`ios` / `macos`) session state, with iOS-only device locators that
157
- * the previous hand-written mirror omitted; and
158
- * - Android and HarmonyOS foreground `package` / `activity`.
159
- *
160
- * The handler returns one of these fixed objects (errors take the `ok: false`
161
- * path), so each branch is closed.
162
- */
163
- type AppStateCommandResult = {
164
- platform: 'ios' | 'macos';
165
- appName: string;
166
- appBundleId?: string;
167
- source: 'session';
168
- surface: SessionSurface;
169
- /** iOS only — the session device's UDID. */
170
- device_udid?: string;
171
- /** iOS only — the simulator set path, or `null` when unknown. */
172
- ios_simulator_device_set?: string | null;
173
- } | {
174
- platform: 'android' | 'harmonyos';
175
- package: string;
176
- activity: string;
177
- };
178
- //#endregion
179
- //#region packages/contracts/src/target-shutdown-contract.d.ts
180
- type TargetShutdownResult = {
181
- success: boolean;
182
- exitCode: number;
183
- stdout: string;
184
- stderr: string;
185
- error?: NormalizedError;
186
- };
187
- //#endregion
188
- //#region packages/contracts/src/device.d.ts
189
- /**
190
- * Closed result of the `boot` command. Mirrors the daemon handler's only
191
- * success return EXACTLY (src/daemon/handlers/session-state.ts) — the fixed
192
- * object literal `{ platform, target, device, id, kind, booted }` plus the
193
- * additive `appleOs` discriminant, emitted only for Apple devices.
194
- */
195
- type BootCommandResult = {
196
- platform: PublicPlatform;
197
- target: DeviceTarget;
198
- /** Human-readable device name (`device.name`). */
199
- device: string;
200
- /** Stable device id (`device.id`). */
201
- id: string;
202
- kind: DeviceKind;
203
- /** Always `true` on the success path. */
204
- booted: true;
205
- /**
206
- * Additive Apple-OS discriminant (`device.appleOs`): iPhone/iPad/tvOS/visionOS/macOS.
207
- * Present only for Apple devices; absent for non-Apple platforms. `platform` stays the
208
- * leaf (`ios`/`macos`) — this is an extra field, not a replacement.
209
- */
210
- appleOs?: AppleOS;
211
- };
212
- /**
213
- * Closed result of the `shutdown` command. Mirrors the daemon handler's success
214
- * return EXACTLY (src/daemon/handlers/session-state.ts) — the fixed object
215
- * literal `{ platform, target, device, id, kind, shutdown }` plus the additive
216
- * `appleOs` discriminant (Apple devices only). The `shutdown` field is the raw
217
- * {@link TargetShutdownResult} from `shutdownDeviceTarget`.
218
- */
219
- type ShutdownCommandResult = {
220
- platform: PublicPlatform;
221
- target: DeviceTarget;
222
- /** Human-readable device name (`device.name`). */
223
- device: string;
224
- /** Stable device id (`device.id`). */
225
- id: string;
226
- kind: DeviceKind;
227
- shutdown: TargetShutdownResult;
228
- /**
229
- * Additive Apple-OS discriminant (`device.appleOs`): iPhone/iPad/tvOS/visionOS/macOS.
230
- * Present only for Apple devices; absent for non-Apple platforms. `platform` stays the
231
- * leaf (`ios`/`macos`) — this is an extra field, not a replacement.
232
- */
233
- appleOs?: AppleOS;
234
- };
235
- //#endregion
236
- //#region packages/contracts/src/perf.d.ts
237
- declare const PERF_AREA_VALUES: readonly ['metrics', 'frames', 'memory', 'cpu', 'trace'];
238
- declare const PERF_ACTION_VALUES: readonly ['sample', 'snapshot', 'start', 'stop', 'report'];
239
- declare const PERF_SUBJECT_VALUES: readonly ['profile'];
240
- declare const PERF_KIND_VALUES: readonly ['xctrace', 'simpleperf', 'perfetto', 'android-hprof', 'memgraph'];
241
- type PerfArea = (typeof PERF_AREA_VALUES)[number];
242
- type PerfAction = (typeof PERF_ACTION_VALUES)[number];
243
- type PerfSubject = (typeof PERF_SUBJECT_VALUES)[number];
244
- type PerfKind = (typeof PERF_KIND_VALUES)[number];
245
- //#endregion
246
- //#region packages/contracts/src/json.d.ts
247
- type JsonPrimitive = string | number | boolean | null;
248
- type JsonValue = JsonPrimitive | JsonObject | JsonValue[];
249
- type JsonObject = {
250
- [key: string]: JsonValue;
251
- };
252
- //#endregion
253
- //#region packages/contracts/src/logs.d.ts
254
- declare const LOG_ACTION_VALUES: readonly ['path', 'start', 'stop', 'doctor', 'mark', 'clear'];
255
- type LogAction = (typeof LOG_ACTION_VALUES)[number];
256
- //#endregion
257
- //#region packages/contracts/src/recording-scope.d.ts
258
- declare const RECORDING_SCOPE_VALUES: readonly ['app', 'device', 'system'];
259
- type RecordingScope = (typeof RECORDING_SCOPE_VALUES)[number];
260
- //#endregion
261
- //#region packages/contracts/src/recording.d.ts
262
- type RecordingAppIdentity = {
263
- bundleId: string;
264
- name?: string;
265
- };
266
- type RecordingStartCommandResult = {
267
- recording: 'started';
268
- outPath: string;
269
- sessionStateDir: string;
270
- recordingBackend?: string;
271
- recordingScope?: RecordingScope;
272
- recordOnlySession?: boolean;
273
- activeSessionApp?: RecordingAppIdentity;
274
- showTouches: boolean;
275
- };
276
- type RecordingStopCommandResult = {
277
- recording: 'stopped';
278
- outPath: string;
279
- telemetryPath?: string;
280
- artifacts: DaemonArtifact[];
281
- recordingBackend?: string;
282
- recordingScope?: RecordingScope;
283
- recordOnlySession?: boolean;
284
- activeSessionApp?: RecordingAppIdentity;
285
- durationMs: number;
286
- showTouches: boolean;
287
- warning?: string;
288
- overlayWarning?: string;
289
- chunks?: Array<{
290
- index: number;
291
- path: string;
292
- }>;
293
- };
294
- type RecordingCommandResult = RecordingStartCommandResult | RecordingStopCommandResult;
295
- type TraceCommandResult = {
296
- trace: 'started';
297
- outPath: string;
298
- } | {
299
- trace: 'stopped';
300
- outPath: string;
301
- artifacts: DaemonArtifact[];
302
- };
303
- //#endregion
304
- //#region packages/contracts/src/recording-export-quality.d.ts
305
- declare const RECORDING_EXPORT_QUALITIES: readonly ['medium', 'high'];
306
- type RecordingExportQuality = (typeof RECORDING_EXPORT_QUALITIES)[number];
307
- //#endregion
308
- //#region packages/contracts/src/prepare.d.ts
309
- type PrepareIosRunnerCacheKind = 'exact' | 'restore-key' | 'miss' | 'external';
310
- type PrepareIosRunnerArtifactState = 'valid' | 'rebuilt';
311
- type PrepareIosRunnerTiming = {
312
- totalMs: number;
313
- additiveParts: {
314
- buildMs?: number;
315
- connectAfterBuildMs: number;
316
- healthCheckMs: number;
317
- };
318
- containment: {
319
- connectMs?: ['buildMs'];
320
- healthCheckMs: [];
321
- };
322
- note: string;
323
- };
324
- /**
325
- * Public daemon result for `prepare ios-runner`. The runner-local prepare result
326
- * is projected by `prepareIosRunnerResponseData` with device identity and timing
327
- * guidance before it reaches the client.
328
- */
329
- type PrepareCommandResult = {
330
- action: 'ios-runner';
331
- platform: PublicPlatform;
332
- deviceId: string;
333
- deviceName: string;
334
- kind: DeviceKind;
335
- durationMs: number;
336
- runner: JsonObject;
337
- cache?: PrepareIosRunnerCacheKind;
338
- artifact?: PrepareIosRunnerArtifactState;
339
- buildMs?: number;
340
- connectMs: number;
341
- healthCheckMs: number;
342
- xctestrunPath?: string;
343
- recoveryReason?: string;
344
- failureReason?: string;
345
- timing: PrepareIosRunnerTiming;
346
- message: string;
347
- };
348
- //#endregion
349
- //#region packages/contracts/src/push.d.ts
350
- type PushCommandResult = {
351
- platform: 'ios';
352
- bundleId: string;
353
- message: string;
354
- } | {
355
- platform: 'android';
356
- package: string;
357
- action: string;
358
- extrasCount: number;
359
- message: string;
360
- };
361
- //#endregion
362
- //#region packages/contracts/src/client-connection.d.ts
363
- type AgentDeviceDaemonTransportContext = {
364
- authToken?: string;
365
- };
366
- type AgentDeviceDaemonTransport = (req: Omit<DaemonRequest, 'token'>, context?: AgentDeviceDaemonTransportContext) => Promise<DaemonResponse>;
367
- type AgentDeviceClientConfig = RemoteConnectionProfileFields & CloudProviderProfileFields & {
368
- session?: string;
369
- lockPolicy?: DaemonLockPolicy;
370
- lockPlatform?: PlatformSelector;
371
- requestId?: string;
372
- sessionIsolation?: SessionIsolationMode;
373
- leaseBackend?: LeaseBackend;
374
- leaseTtlMs?: number;
375
- runtime?: SessionRuntimeHints;
376
- cwd?: string;
377
- debug?: boolean;
378
- cost?: boolean;
379
- responseLevel?: ResponseLevel;
380
- iosXctestrunFile?: string;
381
- iosXctestDerivedDataPath?: string;
382
- iosXctestEnvDir?: string;
383
- };
384
- type AgentDeviceRequestOverrides = Pick<AgentDeviceClientConfig, 'session' | 'lockPolicy' | 'lockPlatform' | 'requestId' | 'daemonBaseUrl' | 'daemonAuthToken' | 'daemonTransport' | 'daemonServerMode' | 'tenant' | 'sessionIsolation' | 'runId' | 'leaseId' | 'leaseBackend' | 'leaseProvider' | 'deviceKey' | 'clientId' | 'providerApp' | 'providerOsVersion' | 'providerProject' | 'providerBuild' | 'providerSessionName' | 'providerDeviceOrientation' | 'providerGeoLocation' | 'providerTimezone' | 'providerLanguage' | 'providerLocale' | 'providerNetworkProfile' | 'providerCustomNetwork' | 'providerNoResignApp' | 'awsProjectArn' | 'awsDeviceArn' | 'awsAppArn' | 'awsRegion' | 'awsInteractionMode' | 'leaseTtlMs' | 'cwd' | 'debug' | 'cost' | 'responseLevel' | 'iosXctestrunFile' | 'iosXctestDerivedDataPath' | 'iosXctestEnvDir'>;
385
- type AgentDeviceIdentifiers = {
386
- session?: string;
387
- deviceId?: string;
388
- deviceName?: string;
389
- udid?: string;
390
- serial?: string;
391
- appId?: string;
392
- appBundleId?: string;
393
- package?: string;
394
- };
395
- type AgentDeviceSelectionOptions = {
396
- platform?: PlatformSelector;
397
- target?: DeviceTarget;
398
- device?: string;
399
- udid?: string;
400
- serial?: string;
401
- iosSimulatorDeviceSet?: string;
402
- androidDeviceAllowlist?: string;
403
- };
404
- type DeviceCommandBaseOptions = AgentDeviceRequestOverrides & AgentDeviceSelectionOptions;
405
- //#endregion
406
- //#region packages/contracts/src/client-device-view.d.ts
407
- type AgentDeviceDevice = {
408
- platform: PublicPlatform;
409
- target: DeviceTarget;
410
- kind: DeviceKind;
411
- id: string;
412
- name: string;
413
- booted?: boolean;
414
- /**
415
- * Additive Apple-OS discriminant (iPhone/iPad/tvOS/visionOS/macOS). Present only for
416
- * Apple devices; `platform` still carries the leaf (`ios`/`macos`).
417
- */
418
- appleOs?: AppleOS;
419
- identifiers: AgentDeviceIdentifiers;
420
- ios?: {
421
- udid: string;
422
- };
423
- android?: {
424
- serial: string;
425
- };
426
- harmonyos?: {
427
- serial: string;
428
- };
429
- vega?: {
430
- serial: string;
431
- };
432
- };
433
- type AgentDeviceCapabilitiesResult = {
434
- device: AgentDeviceDevice;
435
- availableCommands: string[];
436
- };
437
- type AgentDeviceSessionDevice = {
438
- platform: PublicPlatform;
439
- target: DeviceTarget;
440
- id: string;
441
- name: string;
442
- /**
443
- * Additive Apple-OS discriminant (iPhone/iPad/tvOS/visionOS/macOS). Present only for
444
- * Apple devices; `platform` still carries the leaf (`ios`/`macos`).
445
- */
446
- appleOs?: AppleOS;
447
- identifiers: AgentDeviceIdentifiers;
448
- ios?: {
449
- udid: string;
450
- simulatorSetPath?: string | null;
451
- };
452
- android?: {
453
- serial: string;
454
- };
455
- harmonyos?: {
456
- serial: string;
457
- };
458
- vega?: {
459
- serial: string;
460
- };
461
- };
462
- type AgentDeviceSession = {
463
- name: string;
464
- createdAt: number;
465
- sessionStateDir?: string;
466
- runnerLogPath?: string;
467
- device: AgentDeviceSessionDevice;
468
- identifiers: AgentDeviceIdentifiers;
469
- };
470
- type StartupPerfSample = {
471
- durationMs: number;
472
- measuredAt: string;
473
- method: string;
474
- appTarget?: string;
475
- appBundleId?: string;
476
- };
477
- type DeviceBootOptions = DeviceCommandBaseOptions & {
478
- headless?: boolean;
479
- };
480
- type DeviceShutdownOptions = DeviceCommandBaseOptions;
481
- //#endregion
482
- //#region packages/contracts/src/client-app.d.ts
483
- type AppInstallOptions = AgentDeviceRequestOverrides & AgentDeviceSelectionOptions & {
484
- app?: string;
485
- appPath: string;
486
- };
487
- type AppDeployOptions = AgentDeviceRequestOverrides & AgentDeviceSelectionOptions & {
488
- app: string;
489
- appPath: string;
490
- };
491
- type AppDeployResult = {
492
- app: string;
493
- appPath: string;
494
- platform: PublicPlatform;
495
- appId?: string;
496
- bundleId?: string;
497
- package?: string;
498
- identifiers: AgentDeviceIdentifiers;
499
- };
500
- type AppOpenOptions = AgentDeviceRequestOverrides & AgentDeviceSelectionOptions & {
501
- app?: string;
502
- url?: string;
503
- surface?: SessionSurface;
504
- activity?: string;
505
- launchConsole?: string;
506
- launchArgs?: string[];
507
- relaunch?: boolean;
508
- /**
509
- * Include the initial interactive snapshot in a fresh open response. With
510
- * no app argument, iOS can discover the sole running app on the sole booted
511
- * simulator and fails closed when that environment is ambiguous.
512
- */
513
- foreground?: boolean;
514
- saveScript?: boolean | string;
515
- /** #1258: overwrite an existing --save-script target instead of refusing. Alias: --overwrite. */
516
- force?: boolean;
517
- deviceHub?: boolean;
518
- testIme?: boolean;
519
- noRecord?: boolean;
520
- runtime?: SessionRuntimeHints;
521
- };
522
- type AppOpenResult = {
523
- session: string;
524
- warnings?: string[];
525
- sessionStateDir?: string;
526
- runnerLogPath?: string;
527
- requestLogPath?: string;
528
- eventLogPath?: string;
529
- appName?: string;
530
- appBundleId?: string;
531
- appId?: string;
532
- startup?: StartupPerfSample;
533
- runtime?: SessionRuntimeHints;
534
- device?: AgentDeviceSessionDevice;
535
- /**
536
- * Initial interactive snapshot captured immediately after an open that
537
- * requested `foreground`, composed from the same snapshot-runtime dispatch
538
- * `agent-device snapshot -i` uses. It stays loosely typed rather than reusing
539
- * `CaptureSnapshotResult` because the daemon-side composition does not attach
540
- * client-only fields like `identifiers`.
541
- */
542
- snapshot?: Record<string, unknown>;
543
- /**
544
- * open --foreground: present when the session opened successfully but the
545
- * composed initial snapshot capture failed. Carries the FULL daemon error
546
- * shape (code, message, hint, details, diagnosticId, logPath) so recovery
547
- * guidance survives to the caller; the session itself is open and usable —
548
- * a `warnings` entry says so and points at `snapshot -i`.
549
- */
550
- initialSnapshotError?: DaemonError;
551
- identifiers: AgentDeviceIdentifiers;
552
- };
553
- type AppCloseOptions = AgentDeviceRequestOverrides & {
554
- app?: string;
555
- shutdown?: boolean;
556
- saveScript?: boolean | string;
557
- /** #1258: overwrite an existing --save-script target instead of refusing. Alias: --overwrite. */
558
- force?: boolean;
559
- };
560
- type AppCloseResult = {
561
- session: string;
562
- closedApp?: string;
563
- shutdown?: TargetShutdownResult;
564
- /**
565
- * #1258: absolute path of the committed session/healed script when this close
566
- * published one (`close --save-script`, or a repair-armed session's finalize)
567
- * — so a client that requested publication learns where the file landed.
568
- */
569
- savedScript?: string;
570
- identifiers: AgentDeviceIdentifiers;
571
- };
572
- type AppInstallFromSourceOptions = AgentDeviceRequestOverrides & AgentDeviceSelectionOptions & {
573
- source: DaemonInstallSource;
574
- retainPaths?: boolean;
575
- retentionMs?: number;
576
- };
577
- type AppInstallFromSourceResult = {
578
- appName?: string;
579
- appId?: string;
580
- bundleId?: string;
581
- packageName?: string;
582
- launchTarget: string;
583
- installablePath?: string;
584
- archivePath?: string;
585
- materializationId?: string;
586
- materializationExpiresAt?: string;
587
- identifiers: AgentDeviceIdentifiers;
588
- };
589
- type AppListOptions = AgentDeviceRequestOverrides & AgentDeviceSelectionOptions & {
590
- appsFilter?: AppsFilter;
591
- };
592
- type AppPushOptions = DeviceCommandBaseOptions & {
593
- app: string;
594
- payload: string | JsonObject;
595
- };
596
- type AppTriggerEventOptions = DeviceCommandBaseOptions & {
597
- event: string;
598
- payload?: JsonObject;
599
- };
600
- type MaterializationReleaseOptions = AgentDeviceRequestOverrides & {
601
- materializationId: string;
602
- };
603
- type MaterializationReleaseResult = {
604
- released: boolean;
605
- materializationId: string;
606
- identifiers: AgentDeviceIdentifiers;
607
- };
608
- //#endregion
609
- //#region packages/contracts/src/snapshot-capture-annotations.d.ts
610
- type SnapshotCaptureAnalysis = {
611
- rawNodeCount: number;
612
- maxDepth: number;
613
- };
614
- type SnapshotCaptureFreshness = {
615
- action: string;
616
- retryCount: number;
617
- staleAfterRetries: boolean;
618
- reason?: 'empty-interactive' | 'sharp-drop' | 'stuck-route';
619
- };
620
- type SnapshotCaptureAnnotations = {
621
- analysis?: SnapshotCaptureAnalysis;
622
- androidSnapshot?: AndroidSnapshotBackendMetadata;
623
- freshness?: SnapshotCaptureFreshness;
624
- quality?: SnapshotQualityVerdict;
625
- warnings?: string[];
626
- };
627
- type PublicSnapshotCaptureAnnotations = Pick<SnapshotCaptureAnnotations, 'androidSnapshot' | 'warnings'> & {
628
- snapshotQuality?: SnapshotQualityVerdict;
629
- };
630
- //#endregion
631
- //#region packages/contracts/src/client-capture.d.ts
632
- type CaptureSnapshotOptions = AgentDeviceRequestOverrides & AgentDeviceSelectionOptions & {
633
- interactiveOnly?: boolean;
634
- depth?: number;
635
- scope?: string;
636
- raw?: boolean;
637
- /** List accessibility custom actions on merged elements (iOS simulator). */
638
- customActions?: boolean;
639
- forceFull?: boolean;
640
- timeoutMs?: number;
641
- /**
642
- * #1271 stage 2 (ADR 0012 amendment): `snapshot` is observation-only and
643
- * excluded from a repair-armed heal by default; `record` forces it
644
- * through. Mutually exclusive with `noRecord`.
645
- */
646
- noRecord?: boolean;
647
- record?: boolean;
648
- };
649
- type CaptureSnapshotResult = {
650
- nodes: SnapshotNode[];
651
- truncated: boolean;
652
- appName?: string;
653
- appBundleId?: string;
654
- visibility?: SnapshotVisibility;
655
- unchanged?: SnapshotUnchanged;
656
- snapshotDiagnostics?: SnapshotDiagnosticsSummary;
657
- identifiers: AgentDeviceIdentifiers;
658
- /**
659
- * ADR 0014: the response-level ref-frame epoch the plain node refs were minted
660
- * from. A ref-issuing snapshot carries it ONCE (nodes stay plain `@e12` for the
661
- * token budget); pair a ref with it (`@e12~s<refsGeneration>`) before a mutation.
662
- */
663
- refsGeneration?: number;
664
- /**
665
- * Digest response view only: a capped list of `{ ref, label? }` pairs taken
666
- * from the full `nodes` tree so the MCP layer can still pin refs when the
667
- * default-level `nodes` payload is intentionally omitted.
668
- */
669
- refs?: Array<{
670
- ref: string;
671
- label?: string;
672
- }>;
673
- } & PublicSnapshotCaptureAnnotations;
674
- type CaptureScreenshotOptions = AgentDeviceRequestOverrides & {
675
- path?: string;
676
- overlayRefs?: boolean;
677
- pixelDensity?: number;
678
- fullscreen?: boolean;
679
- scale?: number;
680
- stabilize?: boolean;
681
- normalizeStatusBar?: boolean;
682
- surface?: SessionSurface;
683
- };
684
- type CaptureScreenshotResult = ScreenshotResultData & {
685
- path: string;
686
- identifiers: AgentDeviceIdentifiers;
687
- };
688
- type CaptureDiffOptions = DeviceCommandBaseOptions & Pick<CaptureSnapshotOptions, 'interactiveOnly' | 'depth' | 'scope' | 'raw'> & {
689
- kind: 'snapshot';
690
- out?: string;
691
- };
692
- type SelectorSnapshotCommandOptions = Pick<CaptureSnapshotOptions, 'depth' | 'scope' | 'raw'>;
693
- type FindSnapshotCommandOptions = Pick<CaptureSnapshotOptions, 'depth' | 'raw'>;
694
- //#endregion
695
- //#region packages/contracts/src/client-target.d.ts
696
- type PointTarget = {
697
- x: number;
698
- y: number;
699
- ref?: never;
700
- selector?: never;
701
- label?: never;
702
- };
703
- type RefTarget = {
704
- ref: string;
705
- label?: string;
706
- x?: never;
707
- y?: never;
708
- selector?: never;
709
- };
710
- type SelectorTarget = {
711
- selector: string;
712
- x?: never;
713
- y?: never;
714
- ref?: never;
715
- label?: never;
716
- };
717
- type InteractionTarget = PointTarget | RefTarget | SelectorTarget;
718
- type ElementTarget = RefTarget | SelectorTarget;
719
- //#endregion
720
- //#region packages/contracts/src/client-gesture.d.ts
721
- type RepeatedPressOptions = {
722
- count?: number;
723
- intervalMs?: number;
724
- holdMs?: number;
725
- jitterPx?: number;
726
- doubleTap?: boolean;
727
- };
728
- /**
729
- * Opt-in (#1101): after the action, wait for the UI to go quiet and return the
730
- * settled diff vs the pre-action tree (`settle` on the result) in the same
731
- * response. Best-effort — never fails the action. `settleQuietMs` tunes the
732
- * quiet window (default 500ms); `timeoutMs` bounds the settle wait (default
733
- * 10s) when `settle` is true. A bare `timeoutMs` without `settle` is ignored
734
- * for compatibility; `settleQuietMs` still requires `settle`.
735
- */
736
- type SettleCommandOptions = {
737
- settle?: boolean;
738
- settleQuietMs?: number;
739
- timeoutMs?: number;
740
- };
741
- type ClickOptions = DeviceCommandBaseOptions & SelectorSnapshotCommandOptions & InteractionTarget & RepeatedPressOptions & SettleCommandOptions & {
742
- button?: ClickButton;
743
- /**
744
- * Opt-in (#1047): return cheap post-action evidence (AX digest, node counts,
745
- * changedFromBefore) in the response instead of requiring a follow-up
746
- * snapshot to confirm the action had an effect.
747
- */
748
- verify?: boolean;
749
- };
750
- type PressOptions = DeviceCommandBaseOptions & SelectorSnapshotCommandOptions & InteractionTarget & RepeatedPressOptions & SettleCommandOptions & {
751
- verify?: boolean;
752
- };
753
- type LongPressOptions = DeviceCommandBaseOptions & SelectorSnapshotCommandOptions & InteractionTarget & SettleCommandOptions & {
754
- durationMs?: number;
755
- };
756
- type SwipeOptions = DeviceCommandBaseOptions & {
757
- from: {
758
- x: number;
759
- y: number;
760
- };
761
- to: {
762
- x: number;
763
- y: number;
764
- };
765
- count?: number;
766
- pauseMs?: number;
767
- pattern?: SwipePattern;
768
- };
769
- type PanOptions = DeviceCommandBaseOptions & {
770
- x: number;
771
- y: number;
772
- dx: number;
773
- dy: number;
774
- pointerCount?: GesturePointerCount;
775
- durationMs?: number;
776
- };
777
- type DragOptions = DeviceCommandBaseOptions & {
778
- source: string;
779
- destination: string;
780
- sourceHoldMs?: number;
781
- moveMs?: number;
782
- destinationHoldMs?: number;
783
- };
784
- type FlingOptions = DeviceCommandBaseOptions & {
785
- direction: ScrollDirection;
786
- x: number;
787
- y: number;
788
- distance?: number;
789
- };
790
- type SwipeGestureOptions = DeviceCommandBaseOptions & {
791
- preset: SwipePreset;
792
- };
793
- type FocusOptions = DeviceCommandBaseOptions & {
794
- x: number;
795
- y: number;
796
- };
797
- type TypeTextOptions = DeviceCommandBaseOptions & {
798
- text: string;
799
- delayMs?: number;
800
- };
801
- type FillOptions = DeviceCommandBaseOptions & SelectorSnapshotCommandOptions & InteractionTarget & SettleCommandOptions & {
802
- text: string;
803
- delayMs?: number;
804
- /** Publish this fill value as `${VAR}` when script recording is armed. */
805
- recordAs?: string;
806
- verify?: boolean;
807
- };
808
- type PinchOptions = DeviceCommandBaseOptions & {
809
- scale: number;
810
- x?: number;
811
- y?: number;
812
- };
813
- type RotateGestureOptions = DeviceCommandBaseOptions & {
814
- degrees: number;
815
- x?: number;
816
- y?: number;
817
- };
818
- type TransformGestureOptions = DeviceCommandBaseOptions & TransformGestureParams;
819
- type ScrollOptions = DeviceCommandBaseOptions & SettleCommandOptions & {
820
- direction: ScrollInputDirection;
821
- amount?: number;
822
- pixels?: number;
823
- durationMs?: number;
824
- };
825
- //#endregion
826
- //#region packages/contracts/src/client-lease.d.ts
827
- type Lease = {
828
- leaseId: string;
829
- tenantId: string;
830
- runId: string;
831
- backend: LeaseBackend;
832
- leaseProvider?: string;
833
- deviceKey?: string;
834
- clientId?: string;
835
- createdAt?: number;
836
- heartbeatAt?: number;
837
- expiresAt?: number;
838
- };
839
- type LeaseOptions = AgentDeviceRequestOverrides & AgentDeviceSelectionOptions & {
840
- ttlMs?: number;
841
- };
842
- type LeaseAllocateOptions = LeaseOptions & {
843
- tenant: string;
844
- runId: string;
845
- leaseBackend?: LeaseBackend;
846
- leaseProvider?: string;
847
- provider?: string;
848
- deviceKey?: string;
849
- clientId?: string;
850
- };
851
- type LeaseScopedOptions = LeaseOptions & {
852
- tenant?: string;
853
- runId?: string;
854
- leaseId: string;
855
- leaseBackend?: LeaseBackend;
856
- leaseProvider?: string;
857
- provider?: string;
858
- deviceKey?: string;
859
- clientId?: string;
860
- };
861
- type CloudArtifactsOptions = AgentDeviceRequestOverrides & {
862
- provider?: string;
863
- providerSessionId?: string;
864
- };
865
- //#endregion
866
- //#region packages/contracts/src/client-observability.d.ts
867
- type PerfOptions = DeviceCommandBaseOptions & {
868
- area?: PerfArea;
869
- subject?: PerfSubject;
870
- action?: PerfAction;
871
- kind?: PerfKind;
872
- template?: string;
873
- out?: string;
874
- tracePath?: string;
875
- };
876
- type LogsOptions = AgentDeviceRequestOverrides & {
877
- action?: LogAction;
878
- message?: string;
879
- restart?: boolean;
880
- };
881
- type EventsOptions = AgentDeviceRequestOverrides & {
882
- cursor?: string;
883
- limit?: number;
884
- };
885
- type NetworkOptions = DeviceCommandBaseOptions & {
886
- action?: 'dump' | 'log';
887
- limit?: number;
888
- include?: NetworkIncludeMode;
889
- };
890
- type AudioOptions = DeviceCommandBaseOptions & {
891
- action?: 'probe';
892
- probeAction?: 'start' | 'status' | 'stop';
893
- durationMs?: number;
894
- bucketMs?: number;
895
- };
896
- type RecordOptions = AgentDeviceRequestOverrides & {
897
- action: 'start' | 'stop';
898
- path?: string;
899
- fps?: number;
900
- quality?: RecordingExportQuality;
901
- hideTouches?: boolean;
902
- recordingScope?: RecordingScope;
903
- };
904
- type TraceOptions = AgentDeviceRequestOverrides & {
905
- action: 'start' | 'stop';
906
- path?: string;
907
- };
908
- //#endregion
909
- //#region packages/contracts/src/client-replay.d.ts
910
- type ReplayRunOptions = AgentDeviceRequestOverrides & AgentDeviceSelectionOptions & {
911
- path: string;
912
- runtime?: SessionRuntimeHints;
913
- /**
914
- * @deprecated ADR 0012 migration step 6: `--update` no longer rewrites
915
- * the script. Accepted for backward compatibility; every divergence
916
- * already carries ranked selector suggestions regardless of this flag.
917
- */
918
- update?: boolean;
919
- /** @deprecated Use backend: 'maestro'. */
920
- maestro?: boolean;
921
- backend?: string;
922
- env?: string[];
923
- timeoutMs?: number;
924
- /**
925
- * ADR 0012 decision 4 / migration step 5: resume at this 1-based plan
926
- * step, skipping `1..resumeFrom-1` without executing them. Requires
927
- * `resumePlanDigest` from the divergence report that reported this
928
- * step as the failure. `replay` only — `test` has no resume fields.
929
- */
930
- resumeFrom?: number;
931
- /** The `resume.planDigest` from the divergence report `resumeFrom` came from. */
932
- resumePlanDigest?: string;
933
- /** Leave the session active by suppressing an authored terminal `close` in native `.ad`. */
934
- keepSession?: boolean;
935
- /**
936
- * ADR 0012 decision 6, R1/R6: arms agent-supervised re-record repair
937
- * from this replay attempt onward. Optional string value is the healed
938
- * `.ad`'s output path; absent one, it defaults to the `<path>` sibling
939
- * `<stem>.healed.ad` when the repair ends with `close --save-script`.
940
- */
941
- saveScript?: boolean | string;
942
- /** #1258: overwrite an existing --save-script target instead of refusing. Alias: --overwrite. */
943
- force?: boolean;
944
- };
945
- type ReplayTestOptions = AgentDeviceRequestOverrides & AgentDeviceSelectionOptions & {
946
- paths: string[];
947
- runtime?: SessionRuntimeHints;
948
- update?: boolean;
949
- /** @deprecated Use backend: 'maestro'. */
950
- maestro?: boolean;
951
- backend?: string;
952
- env?: string[];
953
- failFast?: boolean;
954
- timeoutMs?: number;
955
- retries?: number;
956
- recordVideo?: boolean;
957
- artifactsDir?: string;
958
- /** @deprecated Use the CLI --reporter junit:<path> or --report-junit <path>. */
959
- reportJunit?: string;
960
- shardAll?: number;
961
- shardSplit?: number;
962
- };
963
- type BatchStep = {
964
- command: string;
965
- input: Record<string, unknown>;
966
- runtime?: SessionRuntimeHints;
967
- };
968
- type BatchRunOptions = AgentDeviceRequestOverrides & {
969
- steps: BatchStep[];
970
- onError?: 'stop';
971
- maxSteps?: number;
972
- out?: string;
973
- };
974
- //#endregion
975
- //#region packages/contracts/src/client-request.d.ts
976
- type CommandRequestResult = DaemonResponseData;
977
- //#endregion
978
- //#region packages/contracts/src/client-selector-read.d.ts
979
- /**
980
- * #1271 stage 2 (ADR 0012 amendment): `get`/`is`/`find` are observation-only
981
- * and excluded from a repair-armed heal by default. `record` forces this
982
- * action through (the corrective-read case); `noRecord` continues to opt the
983
- * action out entirely. Mutually exclusive.
984
- */
985
- type RecordControlOptions = {
986
- noRecord?: boolean;
987
- record?: boolean;
988
- };
989
- type GetOptions = DeviceCommandBaseOptions & SelectorSnapshotCommandOptions & ElementTarget & RecordControlOptions & {
990
- format: 'text' | 'attrs';
991
- };
992
- type IsTextPredicateOptions = DeviceCommandBaseOptions & SelectorSnapshotCommandOptions & RecordControlOptions & {
993
- predicate: 'text';
994
- selector: string;
995
- value: string;
996
- };
997
- type IsStatePredicateOptions = DeviceCommandBaseOptions & SelectorSnapshotCommandOptions & RecordControlOptions & {
998
- predicate: 'visible' | 'hidden' | 'exists' | 'editable' | 'selected' | 'focused';
999
- selector: string;
1000
- value?: never;
1001
- };
1002
- type IsOptions = IsTextPredicateOptions | IsStatePredicateOptions;
1003
- type FindBaseOptions = DeviceCommandBaseOptions & FindSnapshotCommandOptions & RecordControlOptions & {
1004
- locator?: FindLocator;
1005
- query: string;
1006
- first?: boolean;
1007
- last?: boolean;
1008
- };
1009
- type FindOptions = (FindBaseOptions & {
1010
- action?: 'click' | 'focus' | 'exists' | 'getText' | 'getAttrs' | 'list';
1011
- }) | (FindBaseOptions & {
1012
- action: 'wait';
1013
- timeoutMs?: number;
1014
- }) | (FindBaseOptions & {
1015
- action: 'fill' | 'type';
1016
- value: string;
1017
- });
1018
- //#endregion
1019
- //#region packages/contracts/src/client-session.d.ts
1020
- type SessionCloseResult = {
1021
- session: string;
1022
- shutdown?: TargetShutdownResult;
1023
- provider?: CloudProviderSessionResult;
1024
- /**
1025
- * #1258: absolute path of the committed session/healed script when this close
1026
- * published one (`close --save-script`, or a repair-armed session's finalize)
1027
- * — so a client that requested publication learns where the file landed.
1028
- */
1029
- savedScript?: string;
1030
- identifiers: AgentDeviceIdentifiers;
1031
- };
1032
- type SessionSaveScriptOptions = AgentDeviceRequestOverrides & {
1033
- path?: string;
1034
- /** Atomically replace an existing target instead of refusing publication. */
1035
- force?: boolean;
1036
- };
1037
- type SessionSaveScriptResult = {
1038
- session: string;
1039
- savedScript: string;
1040
- actionCount: number;
1041
- identifiers: AgentDeviceIdentifiers;
1042
- };
1043
- //#endregion
1044
- //#region packages/contracts/src/client-settings.d.ts
1045
- type PermissionTarget = 'camera' | 'microphone' | 'photos' | 'contacts' | 'contacts-limited' | 'notifications' | 'calendar' | 'location' | 'location-always' | 'media-library' | 'motion' | 'reminders' | 'siri' | 'accessibility' | 'screen-recording' | 'input-monitoring';
1046
- type SettingsUpdateOptions = (DeviceCommandBaseOptions & {
1047
- setting: 'clear-app-state';
1048
- state: 'clear';
1049
- app?: string;
1050
- }) | (DeviceCommandBaseOptions & {
1051
- setting: 'wifi' | 'airplane' | 'location';
1052
- state: 'on' | 'off';
1053
- }) | (DeviceCommandBaseOptions & {
1054
- setting: 'location';
1055
- state: 'set';
1056
- latitude: number;
1057
- longitude: number;
1058
- }) | (DeviceCommandBaseOptions & {
1059
- setting: 'animations';
1060
- state: 'on' | 'off';
1061
- }) | (DeviceCommandBaseOptions & {
1062
- setting: 'appearance';
1063
- state: 'light' | 'dark' | 'toggle';
1064
- }) | (DeviceCommandBaseOptions & {
1065
- setting: 'faceid' | 'touchid';
1066
- state: 'match' | 'nonmatch' | 'enroll' | 'unenroll';
1067
- }) | (DeviceCommandBaseOptions & {
1068
- setting: 'fingerprint';
1069
- state: 'match' | 'nonmatch';
1070
- }) | (DeviceCommandBaseOptions & {
1071
- setting: 'permission';
1072
- state: 'grant' | 'deny' | 'reset';
1073
- permission: PermissionTarget;
1074
- mode?: 'full' | 'limited';
1075
- });
1076
- //#endregion
1077
- //#region packages/contracts/src/client-system.d.ts
1078
- type WaitCommandTarget = {
1079
- durationMs: number;
1080
- text?: never;
1081
- ref?: never;
1082
- selector?: never;
1083
- stable?: never;
1084
- quietMs?: never;
1085
- timeoutMs?: never;
1086
- } | (SelectorSnapshotCommandOptions & {
1087
- text: string;
1088
- durationMs?: never;
1089
- ref?: never;
1090
- selector?: never;
1091
- stable?: never;
1092
- quietMs?: never;
1093
- timeoutMs?: number;
1094
- }) | (SelectorSnapshotCommandOptions & {
1095
- ref: string;
1096
- durationMs?: never;
1097
- text?: never;
1098
- selector?: never;
1099
- stable?: never;
1100
- quietMs?: never;
1101
- timeoutMs?: number;
1102
- }) | (SelectorSnapshotCommandOptions & {
1103
- selector: string;
1104
- durationMs?: never;
1105
- text?: never;
1106
- ref?: never;
1107
- stable?: never;
1108
- quietMs?: never;
1109
- timeoutMs?: number;
1110
- }) | (SelectorSnapshotCommandOptions & {
1111
- stable: true;
1112
- durationMs?: never;
1113
- text?: never;
1114
- ref?: never;
1115
- selector?: never;
1116
- quietMs?: number;
1117
- timeoutMs?: number;
1118
- });
1119
- type WaitCommandOptions = DeviceCommandBaseOptions & WaitCommandTarget;
1120
- type AlertCommandOptions = DeviceCommandBaseOptions & {
1121
- action?: AlertAction;
1122
- timeoutMs?: number;
1123
- };
1124
- type AppStateCommandOptions = DeviceCommandBaseOptions;
1125
- type KeyboardCommandOptions = DeviceCommandBaseOptions & {
1126
- action?: 'status' | 'dismiss' | 'enter' | 'return';
1127
- };
1128
- type ClipboardCommandOptions = (DeviceCommandBaseOptions & {
1129
- action: 'read';
1130
- }) | (DeviceCommandBaseOptions & {
1131
- action: 'write';
1132
- text: string;
1133
- });
1134
- type ReactNativeCommandOptions = DeviceCommandBaseOptions & {
1135
- action: 'dismiss-overlay';
1136
- };
1137
- type PrepareCommandOptions = DeviceCommandBaseOptions & {
1138
- action: 'ios-runner';
1139
- timeoutMs?: number;
1140
- };
1141
- type DoctorCommandOptions = DeviceCommandBaseOptions & {
1142
- targetApp?: string;
1143
- remote?: boolean;
1144
- };
1145
- type ViewportCommandOptions = DeviceCommandBaseOptions & {
1146
- width: number;
1147
- height: number;
1148
- };
1149
- //#endregion
1150
- //#region src/commands/command-contract.d.ts
1151
- type JsonSchema = {
1152
- type?: string | readonly string[];
1153
- description?: string;
1154
- properties?: Record<string, JsonSchema>;
1155
- required?: readonly string[];
1156
- additionalProperties?: boolean | JsonSchema;
1157
- items?: JsonSchema;
1158
- prefixItems?: readonly JsonSchema[];
1159
- oneOf?: readonly JsonSchema[];
1160
- not?: JsonSchema;
1161
- enum?: readonly unknown[];
1162
- const?: unknown;
1163
- minimum?: number;
1164
- maximum?: number;
1165
- };
1166
- type ExecutableCommandProjection<ClientMethod extends string = string> = {
1167
- clientMethod: ClientMethod;
1168
- outputSchema: JsonSchema;
1169
- };
1170
- //#endregion
1171
- //#region src/commands/system/navigation-projection.d.ts
1172
- declare const navigationCommandProjectionType: unique symbol;
1173
- type NavigationCommandProjection<Options, Result, Required extends boolean, ClientMethod extends string> = ExecutableCommandProjection<ClientMethod> & {
1174
- readonly [navigationCommandProjectionType]?: {
1175
- options: Options;
1176
- result: Result;
1177
- required: Required;
1178
- };
1179
- };
1180
- declare const NAVIGATION_COMMAND_PROJECTIONS: {
1181
- readonly back: NavigationCommandProjection<{
1182
- mode?: BackMode;
1183
- } & SettleCommandOptions, BackCommandResult, false, "back">;
1184
- readonly home: NavigationCommandProjection<{}, HomeCommandResult, false, "home">;
1185
- readonly orientation: NavigationCommandProjection<{
1186
- orientation: DeviceRotation;
1187
- }, OrientationCommandResult, true, "orientation">;
1188
- readonly 'app-switcher': NavigationCommandProjection<{}, AppSwitcherCommandResult, false, "appSwitcher">;
1189
- readonly 'tv-remote': NavigationCommandProjection<{
1190
- button: TvRemoteButton;
1191
- durationMs?: number;
1192
- }, TvRemoteCommandResult, true, "tvRemote">;
1193
- };
1194
- type NavigationCommandName = keyof typeof NAVIGATION_COMMAND_PROJECTIONS;
1195
- type NavigationCommandOptions<Name extends NavigationCommandName> = (typeof NAVIGATION_COMMAND_PROJECTIONS)[Name] extends NavigationCommandProjection<infer Options, unknown, boolean, string> ? Options : never;
1196
- type ProjectedNavigationCommandMethod<BaseOptions, Projection> = Projection extends NavigationCommandProjection<infer Options, infer Result, infer Required, string> ? Required extends true ? (options: BaseOptions & Options) => Promise<Result> : (options?: BaseOptions & Options) => Promise<Result> : never;
1197
- type ProjectedNavigationCommandClient<BaseOptions> = { [Name in NavigationCommandName as (typeof NAVIGATION_COMMAND_PROJECTIONS)[Name]['clientMethod']]: ProjectedNavigationCommandMethod<BaseOptions, (typeof NAVIGATION_COMMAND_PROJECTIONS)[Name]>; };
1198
- //#endregion
1199
- //#region packages/contracts/src/debug-symbols.d.ts
1200
- type DebugSymbolsOptions = {
1201
- action?: 'symbols';
1202
- artifact: string;
1203
- dsym?: string;
1204
- searchPath?: string;
1205
- out?: string;
1206
- cwd?: string;
1207
- };
1208
- type DebugSymbolsImage = {
1209
- name: string;
1210
- uuid: string;
1211
- arch?: string;
1212
- dsymPath: string;
1213
- binaryPath: string;
1214
- };
1215
- type DebugSymbolsCrashFrame = {
1216
- index: number;
1217
- image: string;
1218
- address: string;
1219
- symbol?: string;
1220
- };
1221
- type DebugSymbolsCrashSummary = {
1222
- format: 'ips' | 'text';
1223
- appName?: string;
1224
- bundleId?: string;
1225
- version?: string;
1226
- incident?: string;
1227
- timestamp?: string;
1228
- exceptionType?: string;
1229
- exceptionCodes?: string;
1230
- terminationReason?: string;
1231
- crashedThread?: number;
1232
- topFrames: DebugSymbolsCrashFrame[];
1233
- findings: string[];
1234
- };
1235
- type DebugSymbolsResult = {
1236
- kind: 'debugSymbols';
1237
- platform: 'apple';
1238
- artifactPath: string;
1239
- outPath: string;
1240
- crash: DebugSymbolsCrashSummary;
1241
- matchedImages: DebugSymbolsImage[];
1242
- symbolicatedFrames: number;
1243
- skippedImages: number;
1244
- warnings?: string[];
1245
- message: string;
1246
- };
1247
- //#endregion
1248
- //#region packages/contracts/src/doctor.d.ts
1249
- type DoctorStatus = 'pass' | 'warn' | 'fail' | 'info';
1250
- type DoctorKind = 'auto' | 'react-native' | 'expo' | 'repack';
1251
- type DoctorCheck = {
1252
- id: string;
1253
- status: DoctorStatus;
1254
- summary: string;
1255
- hint?: string;
1256
- command?: string;
1257
- evidence?: Record<string, unknown>;
1258
- };
1259
- type DoctorCommandResult = {
1260
- status: DoctorStatus;
1261
- summary: string;
1262
- kind: DoctorKind;
1263
- platform?: PlatformSelector;
1264
- target?: DeviceTarget;
1265
- targetApp?: string;
1266
- metro?: {
1267
- host: string;
1268
- port: number;
1269
- };
1270
- checks: DoctorCheck[];
1271
- };
1272
- //#endregion
1273
- //#region packages/contracts/src/diff.d.ts
1274
- type SnapshotDiffLine = {
1275
- kind: 'added' | 'removed' | 'unchanged';
1276
- text: string;
1277
- /**
1278
- * Plain ref body (`e12`) of the current-tree node behind an added line.
1279
- * Only populated with `withRefs`; removed and unchanged lines never carry it.
1280
- */
1281
- ref?: string;
1282
- };
1283
- type SnapshotDiffSummary = {
1284
- additions: number;
1285
- removals: number;
1286
- unchanged: number;
1287
- };
1288
- type DiffSnapshotCommandResult = {
1289
- mode: 'snapshot';
1290
- baselineInitialized: boolean;
1291
- summary: SnapshotDiffSummary;
1292
- lines: SnapshotDiffLine[];
1293
- warnings?: string[];
1294
- };
1295
- //#endregion
1296
- //#region packages/contracts/src/viewport.d.ts
1297
- /**
1298
- * Closed result of the `viewport` command. Mirrors the dispatch handler's return
1299
- * EXACTLY (src/core/dispatch.ts `handleViewportCommand`) — `{ width, height }`
1300
- * plus the always-present `successText` message. The generic dispatch path
1301
- * returns this object unchanged (viewport has no Android dialog guard, so no
1302
- * `warning` is ever appended), so the shape is intentionally closed.
1303
- */
1304
- type ViewportCommandResult = {
1305
- width: number;
1306
- height: number;
1307
- message: string;
1308
- };
1309
- //#endregion
1310
- //#region packages/contracts/src/replay.d.ts
1311
- type ReplayCommandResult = {
1312
- replayed: number;
1313
- healed: number;
1314
- session: string;
1315
- /**
1316
- * True iff `session` still exists in the daemon's session store when the
1317
- * response is built. This remains true when replay suppresses an authored
1318
- * terminal `close` for an explicit live-session handoff. The client uses
1319
- * this, not script parsing, to decide whether an owned one-shot daemon must
1320
- * stay alive so the caller can keep addressing this session.
1321
- */
1322
- sessionActive: boolean;
1323
- artifactPaths: string[];
1324
- warnings?: string[];
1325
- snapshotDiagnostics?: SnapshotDiagnosticsSummary;
1326
- message: string;
1327
- };
1328
- type ReplaySuiteTestSkipReason = 'skipped-by-filter';
1329
- type ReplaySuiteAttemptFailure = {
1330
- attempt: number;
1331
- message: string;
1332
- durationMs?: number;
1333
- };
1334
- type ReplaySuiteTestPassed = {
1335
- file: string;
1336
- title?: string;
1337
- session: string;
1338
- status: 'passed';
1339
- durationMs: number;
1340
- finalAttemptDurationMs?: number;
1341
- attempts: number;
1342
- artifactsDir?: string;
1343
- replayed: number;
1344
- healed: number;
1345
- warnings?: string[];
1346
- attemptFailures?: ReplaySuiteAttemptFailure[];
1347
- shardIndex?: number;
1348
- shardCount?: number;
1349
- deviceId?: string;
1350
- deviceName?: string;
1351
- snapshotDiagnostics?: SnapshotDiagnosticsSummary;
1352
- };
1353
- type ReplaySuiteTestFailed = {
1354
- file: string;
1355
- title?: string;
1356
- session: string;
1357
- status: 'failed';
1358
- durationMs: number;
1359
- attempts: number;
1360
- artifactsDir?: string;
1361
- error: DaemonError;
1362
- shardIndex?: number;
1363
- shardCount?: number;
1364
- deviceId?: string;
1365
- deviceName?: string;
1366
- snapshotDiagnostics?: SnapshotDiagnosticsSummary;
1367
- };
1368
- type ReplaySuiteTestSkipped = {
1369
- file: string;
1370
- title?: string;
1371
- status: 'skipped';
1372
- durationMs: 0;
1373
- reason: ReplaySuiteTestSkipReason;
1374
- message: string;
1375
- };
1376
- type ReplaySuiteTestResult = ReplaySuiteTestPassed | ReplaySuiteTestFailed | ReplaySuiteTestSkipped;
1377
- type ReplaySuiteResult = {
1378
- total: number;
1379
- executed: number;
1380
- passed: number;
1381
- failed: number;
1382
- skipped: number;
1383
- notRun: number;
1384
- durationMs: number;
1385
- failures: ReplaySuiteTestFailed[];
1386
- tests: ReplaySuiteTestResult[];
1387
- snapshotDiagnostics?: SnapshotDiagnosticsSummary;
1388
- };
1389
- //#endregion
1390
- //#region src/core/command-descriptor/command-result.d.ts
1391
- /**
1392
- * The additive typed-result spine (ADR-0008, Phase 1 step 6).
1393
- *
1394
- * Maps a command name to the per-command result type from `@agent-device/contracts`. It
1395
- * is SEEDED, not exhaustive: a command is listed here only once its accurate,
1396
- * closed result shape lives in the contracts layer. Commands whose daemon
1397
- * handler spreads dynamic/Record data (screenshot overlays, gesture
1398
- * visualization, perf, logs, …) are deliberately omitted rather than given an
1399
- * invented shape.
1400
- *
1401
- * Batches 1-2 wired `boot` / `shutdown` / `viewport` and the navigation/action
1402
- * commands `home` / `back` / `orientation` / `app-switcher` alongside the seed
1403
- * interaction quartet. Batch 3 adds `clipboard` (a closed `read`/`write` union) and
1404
- * `appstate` (a closed `platform` union — Apple session state with the iOS-only
1405
- * device locators, or Android package/activity). Batch 4 adds `keyboard` (a
1406
- * closed flat shape). Batch 5 adds the compact daemon projections for `wait`,
1407
- * `prepare`, `push`, and `trigger-app-event`. Each entry is grounded in a
1408
- * re-read of the handler's literal return; see the per-type docstrings.
1409
- */
1410
- interface CommandResultMap {
1411
- press: PressCommandResponseData;
1412
- click: ClickCommandResponseData;
1413
- fill: FillCommandResponseData;
1414
- longpress: LongPressCommandResponseData;
1415
- find: FindCommandResponseData;
1416
- boot: BootCommandResult;
1417
- shutdown: ShutdownCommandResult;
1418
- viewport: ViewportCommandResult;
1419
- home: HomeCommandResult;
1420
- back: BackCommandResult;
1421
- orientation: OrientationCommandResult;
1422
- 'app-switcher': AppSwitcherCommandResult;
1423
- clipboard: ClipboardCommandResult;
1424
- appstate: AppStateCommandResult;
1425
- keyboard: KeyboardCommandResult;
1426
- 'tv-remote': TvRemoteCommandResult;
1427
- wait: WaitCommandResult;
1428
- prepare: PrepareCommandResult;
1429
- push: PushCommandResult;
1430
- 'trigger-app-event': TriggerAppEventCommandResult;
1431
- doctor: DoctorCommandResult;
1432
- diff: DiffSnapshotCommandResult;
1433
- replay: ReplayCommandResult;
1434
- test: ReplaySuiteResult;
1435
- record: RecordingCommandResult;
1436
- trace: TraceCommandResult;
1437
- }
1438
- /**
1439
- * The typed result for a command named `N`. Seeded commands resolve to their
1440
- * contract result type from {@link CommandResultMap}; every other (unmigrated)
1441
- * command falls back to the untyped `Record<string, unknown>` bag. That default
1442
- * branch is what keeps the mapping total over every command name, so consumers
1443
- * can switch to `CommandResult<Name>` without first migrating every command.
1444
- */
1445
- type CommandResult<N extends string> = N extends keyof CommandResultMap ? CommandResultMap[N] : Record<string, unknown>;
1446
- //#endregion
1447
- //#region src/client/client-types.d.ts
1448
- type OrientationCommandOptions = DeviceCommandBaseOptions & NavigationCommandOptions<'orientation'>;
1449
- /** @deprecated Renamed to `OrientationCommandOptions`. Retained until the next major. */
1450
- type RotateCommandOptions = OrientationCommandOptions;
1451
- type NonNavigationCommandClient = {
1452
- wait: (options: WaitCommandOptions) => Promise<CommandResult<'wait'>>;
1453
- alert: (options?: AlertCommandOptions) => Promise<CommandRequestResult>;
1454
- appState: (options?: AppStateCommandOptions) => Promise<CommandResult<'appstate'>>;
1455
- keyboard: (options?: KeyboardCommandOptions) => Promise<CommandResult<'keyboard'>>;
1456
- clipboard: (options: ClipboardCommandOptions) => Promise<CommandResult<'clipboard'>>;
1457
- reactNative: (options: ReactNativeCommandOptions) => Promise<CommandRequestResult>;
1458
- doctor: (options?: DoctorCommandOptions) => Promise<CommandResult<'doctor'>>;
1459
- /**
1460
- * JSON prepare results include timing.additiveParts for additive wall-clock phases.
1461
- * Top-level buildMs/connectMs/healthCheckMs are diagnostics and may overlap.
1462
- */
1463
- prepare: (options: PrepareCommandOptions) => Promise<CommandResult<'prepare'>>;
1464
- viewport: (options: ViewportCommandOptions) => Promise<CommandResult<'viewport'>>;
1465
- };
1466
- type AgentDeviceCommandClient = ProjectedNavigationCommandClient<DeviceCommandBaseOptions> & NonNavigationCommandClient & DeprecatedCommandClient;
1467
- /** Renamed command methods retained for existing consumers until the next major. */
1468
- type DeprecatedCommandClient = {
1469
- /**
1470
- * @deprecated Renamed to `orientation`. Delegates to it and returns the legacy
1471
- * `action: 'rotate'` response contract. Retained until the next major version.
1472
- */
1473
- rotate: (options: RotateCommandOptions) => Promise<RotateCommandResult>;
1474
- };
1475
- type AgentDeviceClient = {
1476
- command: AgentDeviceCommandClient;
1477
- devices: {
1478
- list: (options?: AgentDeviceRequestOverrides & AgentDeviceSelectionOptions) => Promise<AgentDeviceDevice[]>;
1479
- capabilities: (options?: AgentDeviceRequestOverrides & AgentDeviceSelectionOptions) => Promise<AgentDeviceCapabilitiesResult>;
1480
- boot: (options?: DeviceBootOptions) => Promise<CommandResult<'boot'>>;
1481
- shutdown: (options?: DeviceShutdownOptions) => Promise<CommandResult<'shutdown'>>;
1482
- };
1483
- sessions: {
1484
- list: (options?: AgentDeviceRequestOverrides) => Promise<AgentDeviceSession[]>;
1485
- stateDir: (options?: AgentDeviceRequestOverrides & Pick<AgentDeviceClientConfig, 'stateDir'>) => Promise<string>;
1486
- close: (options?: AgentDeviceRequestOverrides & {
1487
- shutdown?: boolean;
1488
- saveScript?: boolean | string;
1489
- /** #1258: overwrite an existing --save-script target instead of refusing. Alias: --overwrite. */
1490
- force?: boolean;
1491
- }) => Promise<SessionCloseResult>;
1492
- saveScript: (options?: SessionSaveScriptOptions) => Promise<SessionSaveScriptResult>;
1493
- artifacts: (options?: CloudArtifactsOptions) => Promise<AgentArtifactsResult>;
1494
- };
1495
- apps: {
1496
- install: (options: AppInstallOptions) => Promise<AppDeployResult>;
1497
- reinstall: (options: AppDeployOptions) => Promise<AppDeployResult>;
1498
- installFromSource: (options: AppInstallFromSourceOptions) => Promise<AppInstallFromSourceResult>;
1499
- list: (options?: AppListOptions) => Promise<string[]>;
1500
- open: (options: AppOpenOptions) => Promise<AppOpenResult>;
1501
- close: (options?: AppCloseOptions) => Promise<AppCloseResult>;
1502
- push: (options: AppPushOptions) => Promise<CommandResult<'push'>>;
1503
- triggerEvent: (options: AppTriggerEventOptions) => Promise<CommandResult<'trigger-app-event'>>;
1504
- };
1505
- materializations: {
1506
- release: (options: MaterializationReleaseOptions) => Promise<MaterializationReleaseResult>;
1507
- };
1508
- leases: {
1509
- allocate: (options: LeaseAllocateOptions) => Promise<Lease>;
1510
- heartbeat: (options: LeaseScopedOptions) => Promise<Lease>;
1511
- release: (options: LeaseScopedOptions) => Promise<{
1512
- released: boolean;
1513
- provider?: CloudProviderSessionResult;
1514
- }>;
1515
- };
1516
- metro: {
1517
- prepare: (options: MetroPrepareOptions) => Promise<MetroPrepareResult>;
1518
- reload: (options?: MetroReloadOptions) => Promise<MetroReloadResult>;
1519
- };
1520
- capture: {
1521
- snapshot: (options?: CaptureSnapshotOptions) => Promise<CaptureSnapshotResult>;
1522
- screenshot: (options?: CaptureScreenshotOptions) => Promise<CaptureScreenshotResult>;
1523
- diff: (options: CaptureDiffOptions) => Promise<CommandResult<'diff'>>;
1524
- };
1525
- interactions: {
1526
- click: (options: ClickOptions) => Promise<CommandResult<'click'>>;
1527
- press: (options: PressOptions) => Promise<CommandResult<'press'>>;
1528
- longPress: (options: LongPressOptions) => Promise<CommandResult<'longpress'>>;
1529
- swipe: (options: SwipeOptions) => Promise<CommandRequestResult>;
1530
- pan: (options: PanOptions) => Promise<CommandRequestResult>;
1531
- drag: (options: DragOptions) => Promise<CommandRequestResult>;
1532
- fling: (options: FlingOptions) => Promise<CommandRequestResult>;
1533
- swipeGesture: (options: SwipeGestureOptions) => Promise<CommandRequestResult>;
1534
- focus: (options: FocusOptions) => Promise<CommandRequestResult>;
1535
- type: (options: TypeTextOptions) => Promise<CommandRequestResult>;
1536
- fill: (options: FillOptions) => Promise<CommandResult<'fill'>>;
1537
- scroll: (options: ScrollOptions) => Promise<CommandRequestResult>;
1538
- pinch: (options: PinchOptions) => Promise<CommandRequestResult>;
1539
- rotateGesture: (options: RotateGestureOptions) => Promise<CommandRequestResult>;
1540
- transformGesture: (options: TransformGestureOptions) => Promise<CommandRequestResult>;
1541
- get: (options: GetOptions) => Promise<CommandRequestResult>;
1542
- is: (options: IsOptions) => Promise<CommandRequestResult>;
1543
- find: (options: FindOptions) => Promise<CommandResult<'find'>>;
1544
- };
1545
- replay: {
1546
- run: (options: ReplayRunOptions) => Promise<CommandResult<'replay'>>;
1547
- test: (options: ReplayTestOptions) => Promise<CommandResult<'test'>>;
1548
- };
1549
- batch: {
1550
- run: (options: BatchRunOptions) => Promise<BatchRunResult>;
1551
- };
1552
- observability: {
1553
- perf: (options?: PerfOptions) => Promise<CommandRequestResult>;
1554
- logs: (options?: LogsOptions) => Promise<CommandRequestResult>;
1555
- events: (options?: EventsOptions) => Promise<CommandRequestResult>;
1556
- network: (options?: NetworkOptions) => Promise<CommandRequestResult>;
1557
- audio: (options?: AudioOptions) => Promise<CommandRequestResult>;
1558
- };
1559
- debug: {
1560
- symbols: (options: DebugSymbolsOptions) => Promise<DebugSymbolsResult>;
1561
- };
1562
- recording: {
1563
- record: (options: RecordOptions) => Promise<CommandResult<'record'>>;
1564
- trace: (options: TraceOptions) => Promise<CommandResult<'trace'>>;
1565
- };
1566
- settings: {
1567
- update: (options: SettingsUpdateOptions) => Promise<CommandRequestResult>;
1568
- };
1569
- };
1570
- //#endregion
1571
4
  //#region src/agent-device-client.d.ts
1572
5
  declare function createAgentDeviceClient(config?: AgentDeviceClientConfig, deps?: {
1573
6
  transport?: AgentDeviceDaemonTransport;