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