agent-device 0.18.2 → 0.19.0

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 (216) hide show
  1. package/android-multitouch-helper/dist/{agent-device-android-multitouch-helper-0.18.2.apk → agent-device-android-multitouch-helper-0.19.0.apk} +0 -0
  2. package/android-multitouch-helper/dist/agent-device-android-multitouch-helper-0.19.0.apk.sha256 +1 -0
  3. package/android-multitouch-helper/dist/{agent-device-android-multitouch-helper-0.18.2.manifest.json → agent-device-android-multitouch-helper-0.19.0.manifest.json} +4 -4
  4. package/android-snapshot-helper/dist/{agent-device-android-snapshot-helper-0.18.2.apk → agent-device-android-snapshot-helper-0.19.0.apk} +0 -0
  5. package/android-snapshot-helper/dist/agent-device-android-snapshot-helper-0.19.0.apk.sha256 +1 -0
  6. package/android-snapshot-helper/dist/{agent-device-android-snapshot-helper-0.18.2.manifest.json → agent-device-android-snapshot-helper-0.19.0.manifest.json} +6 -6
  7. package/dist/apple-runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTapPointPolicy.swift +28 -0
  8. package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+AXSnapshotFallback.swift +9 -120
  9. package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+CommandExecution.swift +132 -66
  10. package/dist/apple-runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+CommandJournal.swift +155 -0
  11. package/dist/apple-runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+FlatSnapshotFiltering.swift +67 -0
  12. package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Interaction.swift +20 -74
  13. package/dist/apple-runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+ScrollGesture.swift +64 -0
  14. package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SequenceExecution.swift +0 -177
  15. package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Snapshot.swift +81 -48
  16. package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SnapshotCapturePlan.swift +102 -129
  17. package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+TextEntry.swift +208 -46
  18. package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Transport.swift +82 -11
  19. package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests.swift +72 -0
  20. package/dist/src/agent-browser-tool.js +1 -0
  21. package/dist/src/android-adb.d.ts +64 -234
  22. package/dist/src/android-adb.js +1 -1
  23. package/dist/src/android.js +1 -5
  24. package/dist/src/app-lifecycle.js +7 -0
  25. package/dist/src/apple-runner-options.js +1 -0
  26. package/dist/src/apps.js +5 -11
  27. package/dist/src/artifacts.d.ts +4 -3
  28. package/dist/src/artifacts.js +1 -1
  29. package/dist/src/audio-probe.js +1 -1
  30. package/dist/src/batch.d.ts +2 -177
  31. package/dist/src/batch.js +1 -1
  32. package/dist/src/cli-help.js +64 -38
  33. package/dist/src/cli-output.js +1 -1
  34. package/dist/src/cli-runner.js +2 -0
  35. package/dist/src/cli.js +12 -41
  36. package/dist/src/client-metro-companion.js +1 -0
  37. package/dist/src/client.js +3 -0
  38. package/dist/src/command-metadata.js +1 -0
  39. package/dist/src/command-schema.js +22 -0
  40. package/dist/src/command-surface.js +1 -1
  41. package/dist/src/contracts.d.ts +2 -213
  42. package/dist/src/contracts.js +1 -1
  43. package/dist/src/debug-symbols.js +5 -3
  44. package/dist/src/device-input-state.js +2 -0
  45. package/dist/src/device-rotation.js +14 -0
  46. package/dist/src/devices.js +1 -1
  47. package/dist/src/devices2.js +1 -0
  48. package/dist/src/devices3.js +1 -0
  49. package/dist/src/find.js +1 -1
  50. package/dist/src/finders.d.ts +2 -81
  51. package/dist/src/finders.js +1 -1
  52. package/dist/src/generic.js +1 -1
  53. package/dist/src/handler-utils.js +1 -1
  54. package/dist/src/helper.js +2 -0
  55. package/dist/src/host-process.js +2 -0
  56. package/dist/src/index.d.ts +1265 -1768
  57. package/dist/src/index.js +1 -1
  58. package/dist/src/input-actions.js +3 -1
  59. package/dist/src/input-actions2.js +1 -0
  60. package/dist/src/install-source.d.ts +13 -14
  61. package/dist/src/install-source.js +1 -1
  62. package/dist/src/install-source2.js +1 -0
  63. package/dist/src/interaction-snapshot.js +1 -0
  64. package/dist/src/interaction.js +1 -1
  65. package/dist/src/interactor.js +2 -1
  66. package/dist/src/internal/bin.d.ts +1 -1
  67. package/dist/src/internal/bin.js +2 -5
  68. package/dist/src/internal/companion-tunnel.d.ts +1 -1
  69. package/dist/src/internal/companion-tunnel.js +1 -1
  70. package/dist/src/internal/daemon.d.ts +1 -1
  71. package/dist/src/internal/daemon.js +16 -1
  72. package/dist/src/internal/png-worker.d.ts +29 -26
  73. package/dist/src/internal/png-worker.js +1 -1
  74. package/dist/src/internal/update-check-entry.d.ts +1 -1
  75. package/dist/src/internal/update-check-entry.js +1 -1
  76. package/dist/src/io.d.ts +2 -85
  77. package/dist/src/io.js +1 -1
  78. package/dist/src/lease.js +1 -1
  79. package/dist/src/linux.js +1 -1
  80. package/dist/src/logcat.js +6 -0
  81. package/dist/src/manifest.js +1 -0
  82. package/dist/src/metro.d.ts +70 -113
  83. package/dist/src/metro.js +1 -1
  84. package/dist/src/metro2.js +1 -0
  85. package/dist/src/notifications.js +1 -1
  86. package/dist/src/output-path.js +1 -0
  87. package/dist/src/path-resolution.js +1 -0
  88. package/dist/src/png-worker-contract.js +1 -0
  89. package/dist/src/points.js +4 -0
  90. package/dist/src/project-runtime.js +1 -0
  91. package/dist/src/provider.js +1 -1
  92. package/dist/src/providers.js +1 -0
  93. package/dist/src/react-native.js +1 -1
  94. package/dist/src/record-trace-recording.js +2 -5
  95. package/dist/src/record-trace.js +1 -1
  96. package/dist/src/recording-provider.js +1 -1
  97. package/dist/src/registry.js +37 -0
  98. package/dist/src/remote-config.d.ts +2 -83
  99. package/dist/src/reporting.js +9 -0
  100. package/dist/src/rolldown-runtime.js +1 -0
  101. package/dist/src/runner-client.js +1 -0
  102. package/dist/src/runner-provider.js +1 -0
  103. package/dist/src/runner-sequence.js +1 -1
  104. package/dist/src/runtime-transport.js +1 -0
  105. package/dist/src/runtime.js +3 -0
  106. package/dist/src/scoped-provider.js +1 -0
  107. package/dist/src/sdk-android-adb.d.ts +144 -0
  108. package/dist/src/sdk-android-adb.js +4 -0
  109. package/dist/src/sdk-app-inventory.d.ts +4 -0
  110. package/dist/src/sdk-app-inventory.js +1 -0
  111. package/dist/src/sdk-batch-runner.d.ts +40 -0
  112. package/dist/src/sdk-batch-runner.js +2 -0
  113. package/dist/src/sdk-batch.js +2 -0
  114. package/dist/src/sdk-contracts.d.ts +386 -0
  115. package/dist/src/sdk-contracts.js +2 -0
  116. package/dist/src/sdk-finders.d.ts +61 -0
  117. package/dist/src/sdk-finders.js +1 -0
  118. package/dist/src/sdk-io.d.ts +79 -0
  119. package/dist/src/sdk-io.js +1 -0
  120. package/dist/src/sdk-remote-config.d.ts +140 -0
  121. package/dist/src/sdk-remote-config.js +1 -0
  122. package/dist/src/sdk-selectors.js +1 -0
  123. package/dist/src/selector-runtime.js +1 -1
  124. package/dist/src/selectors.d.ts +39 -137
  125. package/dist/src/selectors.js +1 -1
  126. package/dist/src/selectors2.js +1 -0
  127. package/dist/src/server.js +3 -2
  128. package/dist/src/session.js +10 -11
  129. package/dist/src/setting-state.js +1 -0
  130. package/dist/src/simctl.js +1 -0
  131. package/dist/src/simulator.js +1 -2
  132. package/dist/src/snapshot-diagnostics.js +3 -0
  133. package/dist/src/snapshot-helper.js +5 -0
  134. package/dist/src/snapshot-quality.js +1 -0
  135. package/dist/src/snapshot.js +1 -2
  136. package/dist/src/snapshot2.js +2 -0
  137. package/dist/src/{5560.js → timeouts.js} +1 -1
  138. package/dist/src/tool-provider.js +3 -0
  139. package/dist/src/tool-provider2.js +1 -0
  140. package/dist/src/ttl-memo.js +1 -0
  141. package/dist/src/update-check.js +1 -0
  142. package/dist/src/url.js +1 -0
  143. package/dist/src/version.js +1 -0
  144. package/dist/src/web.js +1 -1
  145. package/dist/src/xml.js +2 -0
  146. package/package.json +12 -19
  147. package/server.json +2 -2
  148. package/skills/agent-device/SKILL.md +2 -0
  149. package/android-multitouch-helper/dist/agent-device-android-multitouch-helper-0.18.2.apk.sha256 +0 -1
  150. package/android-snapshot-helper/dist/agent-device-android-snapshot-helper-0.18.2.apk.sha256 +0 -1
  151. package/apple-runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+CommandJournal.swift +0 -443
  152. package/apple-runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+FlatSnapshotFiltering.swift +0 -169
  153. package/apple-runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+ScrollGesture.swift +0 -220
  154. package/dist/src/1404.js +0 -1
  155. package/dist/src/1986.js +0 -1
  156. package/dist/src/2748.js +0 -1
  157. package/dist/src/2948.js +0 -30
  158. package/dist/src/3006.js +0 -1
  159. package/dist/src/314.js +0 -1
  160. package/dist/src/3340.js +0 -8
  161. package/dist/src/4418.js +0 -1
  162. package/dist/src/4428.js +0 -3
  163. package/dist/src/485.js +0 -1
  164. package/dist/src/4917.js +0 -1
  165. package/dist/src/495.js +0 -5
  166. package/dist/src/5448.js +0 -3
  167. package/dist/src/5484.js +0 -1
  168. package/dist/src/5643.js +0 -1
  169. package/dist/src/587.js +0 -1
  170. package/dist/src/5913.js +0 -4
  171. package/dist/src/6849.js +0 -1
  172. package/dist/src/6918.js +0 -1
  173. package/dist/src/6967.js +0 -1
  174. package/dist/src/760.js +0 -1
  175. package/dist/src/7871.js +0 -1
  176. package/dist/src/8184.js +0 -1
  177. package/dist/src/8225.js +0 -1
  178. package/dist/src/8391.js +0 -1
  179. package/dist/src/8404.js +0 -2
  180. package/dist/src/8414.js +0 -2
  181. package/dist/src/8875.js +0 -4
  182. package/dist/src/893.js +0 -1
  183. package/dist/src/8936.js +0 -1
  184. package/dist/src/9414.js +0 -1
  185. package/dist/src/9581.js +0 -22
  186. package/dist/src/9612.js +0 -1
  187. package/dist/src/9624.js +0 -1
  188. package/dist/src/9722.js +0 -38
  189. package/dist/src/devices~1.js +0 -1
  190. package/dist/src/devices~2.js +0 -1
  191. package/dist/src/input-actions~1.js +0 -1
  192. package/dist/src/rslib-runtime.js +0 -1
  193. /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunner/AgentDeviceRunnerApp.m +0 -0
  194. /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunner.xcodeproj/project.pbxproj +0 -0
  195. /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunner.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -0
  196. /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunner.xcodeproj/xcshareddata/xcschemes/AgentDeviceRunner.xcscheme +0 -0
  197. /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/AgentDeviceRunnerUITests-Bridging-Header.h +0 -0
  198. /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/AgentDeviceRunnerUITests.entitlements +0 -0
  199. /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerAXSnapshotBridge.h +0 -0
  200. /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerAXSnapshotBridge.m +0 -0
  201. /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerObjCExceptionCatcher.h +0 -0
  202. /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerObjCExceptionCatcher.m +0 -0
  203. /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerSynthesizedGesture.h +0 -0
  204. /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerSynthesizedGesture.m +0 -0
  205. /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Alert.swift +0 -0
  206. /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Environment.swift +0 -0
  207. /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Exceptions.swift +0 -0
  208. /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Lifecycle.swift +0 -0
  209. /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Models.swift +0 -0
  210. /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+ScreenRecorder.swift +0 -0
  211. /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SystemModal.swift +0 -0
  212. /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+TvRemote.swift +0 -0
  213. /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests.xctestplan +0 -0
  214. /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/RecordingScripts/recording-overlay.swift +0 -0
  215. /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/RecordingScripts/recording-resize.swift +0 -0
  216. /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/RecordingScripts/recording-trim.swift +0 -0
@@ -1,1768 +1,1265 @@
1
- declare type AgentDeviceClient = {
2
- command: AgentDeviceCommandClient;
3
- devices: {
4
- list: (options?: AgentDeviceRequestOverrides & AgentDeviceSelectionOptions) => Promise<AgentDeviceDevice[]>;
5
- boot: (options?: DeviceBootOptions) => Promise<CommandResult<'boot'>>;
6
- shutdown: (options?: DeviceShutdownOptions) => Promise<CommandResult<'shutdown'>>;
7
- };
8
- sessions: {
9
- list: (options?: AgentDeviceRequestOverrides) => Promise<AgentDeviceSession[]>;
10
- stateDir: (options?: AgentDeviceRequestOverrides & Pick<AgentDeviceClientConfig, 'stateDir'>) => Promise<string>;
11
- close: (options?: AgentDeviceRequestOverrides & {
12
- shutdown?: boolean;
13
- }) => Promise<SessionCloseResult>;
14
- artifacts: (options?: CloudArtifactsOptions) => Promise<CloudArtifactsResult>;
15
- };
16
- apps: {
17
- install: (options: AppInstallOptions) => Promise<AppDeployResult>;
18
- reinstall: (options: AppDeployOptions) => Promise<AppDeployResult>;
19
- installFromSource: (options: AppInstallFromSourceOptions) => Promise<AppInstallFromSourceResult>;
20
- list: (options?: AppListOptions) => Promise<string[]>;
21
- open: (options: AppOpenOptions) => Promise<AppOpenResult>;
22
- close: (options?: AppCloseOptions) => Promise<AppCloseResult>;
23
- push: (options: AppPushOptions) => Promise<CommandRequestResult>;
24
- triggerEvent: (options: AppTriggerEventOptions) => Promise<CommandRequestResult>;
25
- };
26
- materializations: {
27
- release: (options: MaterializationReleaseOptions) => Promise<MaterializationReleaseResult>;
28
- };
29
- leases: {
30
- allocate: (options: LeaseAllocateOptions) => Promise<Lease>;
31
- heartbeat: (options: LeaseScopedOptions) => Promise<Lease>;
32
- release: (options: LeaseScopedOptions) => Promise<{
33
- released: boolean;
34
- provider?: CloudProviderSessionResult;
35
- }>;
36
- };
37
- metro: {
38
- prepare: (options: MetroPrepareOptions) => Promise<MetroPrepareResult>;
39
- reload: (options?: MetroReloadOptions) => Promise<MetroReloadResult>;
40
- };
41
- capture: {
42
- snapshot: (options?: CaptureSnapshotOptions) => Promise<CaptureSnapshotResult>;
43
- screenshot: (options?: CaptureScreenshotOptions) => Promise<CaptureScreenshotResult>;
44
- diff: (options: CaptureDiffOptions) => Promise<CommandRequestResult>;
45
- };
46
- interactions: {
47
- click: (options: ClickOptions) => Promise<CommandRequestResult>;
48
- press: (options: PressOptions) => Promise<CommandRequestResult>;
49
- longPress: (options: LongPressOptions) => Promise<CommandRequestResult>;
50
- swipe: (options: SwipeOptions) => Promise<CommandRequestResult>;
51
- pan: (options: PanOptions) => Promise<CommandRequestResult>;
52
- fling: (options: FlingOptions) => Promise<CommandRequestResult>;
53
- swipeGesture: (options: SwipeGestureOptions) => Promise<CommandRequestResult>;
54
- focus: (options: FocusOptions_2) => Promise<CommandRequestResult>;
55
- type: (options: TypeTextOptions) => Promise<CommandRequestResult>;
56
- fill: (options: FillOptions) => Promise<CommandRequestResult>;
57
- scroll: (options: ScrollOptions_2) => Promise<CommandRequestResult>;
58
- pinch: (options: PinchOptions) => Promise<CommandRequestResult>;
59
- rotateGesture: (options: RotateGestureOptions) => Promise<CommandRequestResult>;
60
- transformGesture: (options: TransformGestureOptions) => Promise<CommandRequestResult>;
61
- get: (options: GetOptions) => Promise<CommandRequestResult>;
62
- is: (options: IsOptions) => Promise<CommandRequestResult>;
63
- find: (options: FindOptions) => Promise<CommandRequestResult>;
64
- };
65
- replay: {
66
- run: (options: ReplayRunOptions) => Promise<CommandRequestResult>;
67
- test: (options: ReplayTestOptions) => Promise<CommandRequestResult>;
68
- };
69
- batch: {
70
- run: (options: BatchRunOptions) => Promise<BatchRunResult>;
71
- };
72
- observability: {
73
- perf: (options?: PerfOptions) => Promise<CommandRequestResult>;
74
- logs: (options?: LogsOptions) => Promise<CommandRequestResult>;
75
- network: (options?: NetworkOptions) => Promise<CommandRequestResult>;
76
- audio: (options?: AudioOptions) => Promise<CommandRequestResult>;
77
- };
78
- debug: {
79
- symbols: (options: DebugSymbolsOptions) => Promise<DebugSymbolsResult>;
80
- };
81
- recording: {
82
- record: (options: RecordOptions) => Promise<CommandRequestResult>;
83
- trace: (options: TraceOptions) => Promise<CommandRequestResult>;
84
- };
85
- settings: {
86
- update: (options: SettingsUpdateOptions) => Promise<CommandRequestResult>;
87
- };
88
- };
89
-
90
- declare type AgentDeviceClientConfig = RemoteConnectionProfileFields & CloudProviderProfileFields & {
91
- session?: string;
92
- lockPolicy?: DaemonLockPolicy;
93
- lockPlatform?: PlatformSelector;
94
- requestId?: string;
95
- sessionIsolation?: SessionIsolationMode;
96
- leaseBackend?: LeaseBackend;
97
- leaseTtlMs?: number;
98
- runtime?: SessionRuntimeHints;
99
- cwd?: string;
100
- debug?: boolean;
101
- cost?: boolean;
102
- responseLevel?: ResponseLevel;
103
- iosXctestrunFile?: string;
104
- iosXctestDerivedDataPath?: string;
105
- iosXctestEnvDir?: string;
106
- };
107
-
108
- declare type AgentDeviceCommandClient = {
109
- wait: (options: WaitCommandOptions) => Promise<CommandRequestResult>;
110
- alert: (options?: AlertCommandOptions) => Promise<CommandRequestResult>;
111
- appState: (options?: AppStateCommandOptions) => Promise<CommandResult<'appstate'>>;
112
- back: (options?: BackCommandOptions) => Promise<CommandResult<'back'>>;
113
- home: (options?: HomeCommandOptions) => Promise<CommandResult<'home'>>;
114
- rotate: (options: RotateCommandOptions) => Promise<CommandResult<'rotate'>>;
115
- appSwitcher: (options?: AppSwitcherCommandOptions) => Promise<CommandResult<'app-switcher'>>;
116
- keyboard: (options?: KeyboardCommandOptions) => Promise<CommandResult<'keyboard'>>;
117
- clipboard: (options: ClipboardCommandOptions) => Promise<CommandResult<'clipboard'>>;
118
- reactNative: (options: ReactNativeCommandOptions) => Promise<CommandRequestResult>;
119
- doctor: (options?: DoctorCommandOptions) => Promise<CommandRequestResult>;
120
- prepare: (options: PrepareCommandOptions) => Promise<CommandRequestResult>;
121
- viewport: (options: ViewportCommandOptions) => Promise<CommandResult<'viewport'>>;
122
- };
123
-
124
- declare type AgentDeviceDaemonTransport = (req: Omit<DaemonRequest, 'token'>) => Promise<DaemonResponse>;
125
-
126
- declare type AgentDeviceDevice = {
127
- platform: PublicPlatform;
128
- target: DeviceTarget;
129
- kind: DeviceKind;
130
- id: string;
131
- name: string;
132
- booted?: boolean;
133
- /**
134
- * Additive Apple-OS discriminant (iPhone/iPad/tvOS/visionOS/macOS). Present only for
135
- * Apple devices; `platform` still carries the leaf (`ios`/`macos`).
136
- */
137
- appleOs?: AppleOS;
138
- identifiers: AgentDeviceIdentifiers;
139
- ios?: {
140
- udid: string;
141
- };
142
- android?: {
143
- serial: string;
144
- };
145
- };
146
-
147
- declare type AgentDeviceIdentifiers = {
148
- session?: string;
149
- deviceId?: string;
150
- deviceName?: string;
151
- udid?: string;
152
- serial?: string;
153
- appId?: string;
154
- appBundleId?: string;
155
- package?: string;
156
- };
157
-
158
- declare 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' | 'awsProjectArn' | 'awsDeviceArn' | 'awsAppArn' | 'awsRegion' | 'awsInteractionMode' | 'leaseTtlMs' | 'cwd' | 'debug' | 'cost' | 'responseLevel' | 'iosXctestrunFile' | 'iosXctestDerivedDataPath' | 'iosXctestEnvDir'>;
159
-
160
- declare type AgentDeviceSelectionOptions = {
161
- platform?: PlatformSelector;
162
- target?: DeviceTarget;
163
- device?: string;
164
- udid?: string;
165
- serial?: string;
166
- iosSimulatorDeviceSet?: string;
167
- androidDeviceAllowlist?: string;
168
- };
169
-
170
- declare type AgentDeviceSession = {
171
- name: string;
172
- createdAt: number;
173
- sessionStateDir?: string;
174
- runnerLogPath?: string;
175
- device: AgentDeviceSessionDevice;
176
- identifiers: AgentDeviceIdentifiers;
177
- };
178
-
179
- declare type AgentDeviceSessionDevice = {
180
- platform: PublicPlatform;
181
- target: DeviceTarget;
182
- id: string;
183
- name: string;
184
- /**
185
- * Additive Apple-OS discriminant (iPhone/iPad/tvOS/visionOS/macOS). Present only for
186
- * Apple devices; `platform` still carries the leaf (`ios`/`macos`).
187
- */
188
- appleOs?: AppleOS;
189
- identifiers: AgentDeviceIdentifiers;
190
- ios?: {
191
- udid: string;
192
- simulatorSetPath?: string | null;
193
- };
194
- android?: {
195
- serial: string;
196
- };
197
- };
198
-
199
- declare const ALERT_ACTIONS: readonly ['get', 'accept', 'dismiss', 'wait'];
200
-
201
- declare type AlertAction = (typeof ALERT_ACTIONS)[number];
202
-
203
- declare type AlertCommandOptions = DeviceCommandBaseOptions & {
204
- action?: AlertAction;
205
- timeoutMs?: number;
206
- };
207
-
208
- declare type AndroidSnapshotBackendMetadata = {
209
- backend: 'android-helper' | 'uiautomator-dump';
210
- helperVersion?: string;
211
- helperApiVersion?: string;
212
- helperTransport?: AndroidSnapshotHelperTransport;
213
- helperSessionReused?: boolean;
214
- fallbackReason?: string;
215
- installReason?: AndroidSnapshotHelperInstallReason;
216
- waitForIdleTimeoutMs?: number;
217
- waitForIdleQuietMs?: number;
218
- timeoutMs?: number;
219
- maxDepth?: number;
220
- maxNodes?: number;
221
- rootPresent?: boolean;
222
- captureMode?: AndroidSnapshotCaptureMode;
223
- windowCount?: number;
224
- nodeCount?: number;
225
- helperTruncated?: boolean;
226
- elapsedMs?: number;
227
- };
228
-
229
- declare type AndroidSnapshotCaptureMode = 'interactive-windows' | 'active-window';
230
-
231
- declare type AndroidSnapshotHelperInstallReason = 'missing' | 'outdated' | 'forced' | 'current' | 'skipped';
232
-
233
- declare type AndroidSnapshotHelperTransport = 'instrumentation' | 'persistent-session';
234
-
235
- declare type AppCloseOptions = AgentDeviceRequestOverrides & {
236
- app?: string;
237
- shutdown?: boolean;
238
- };
239
-
240
- declare type AppCloseResult = {
241
- session: string;
242
- closedApp?: string;
243
- shutdown?: TargetShutdownResult;
244
- identifiers: AgentDeviceIdentifiers;
245
- };
246
-
247
- declare type AppDeployOptions = AgentDeviceRequestOverrides & AgentDeviceSelectionOptions & {
248
- app: string;
249
- appPath: string;
250
- };
251
-
252
- declare type AppDeployResult = {
253
- app: string;
254
- appPath: string;
255
- platform: PublicPlatform;
256
- appId?: string;
257
- bundleId?: string;
258
- package?: string;
259
- identifiers: AgentDeviceIdentifiers;
260
- };
261
-
262
- export declare class AppError extends Error {
263
- code: AppErrorCode;
264
- details?: AppErrorDetails;
265
- cause?: unknown;
266
- constructor(code: AppErrorCode, message: string, details?: AppErrorDetails, cause?: unknown);
267
- }
268
-
269
- declare type AppErrorCode = KnownAppErrorCode | (string & {});
270
-
271
- declare type AppErrorDetails = Record<string, unknown> & {
272
- hint?: string;
273
- diagnosticId?: string;
274
- logPath?: string;
275
- };
276
-
277
- declare type AppInstallFromSourceOptions = AgentDeviceRequestOverrides & AgentDeviceSelectionOptions & {
278
- source: DaemonInstallSource;
279
- retainPaths?: boolean;
280
- retentionMs?: number;
281
- };
282
-
283
- declare type AppInstallFromSourceResult = {
284
- appName?: string;
285
- appId?: string;
286
- bundleId?: string;
287
- packageName?: string;
288
- launchTarget: string;
289
- installablePath?: string;
290
- archivePath?: string;
291
- materializationId?: string;
292
- materializationExpiresAt?: string;
293
- identifiers: AgentDeviceIdentifiers;
294
- };
295
-
296
- declare type AppInstallOptions = AgentDeviceRequestOverrides & AgentDeviceSelectionOptions & {
297
- app?: string;
298
- appPath: string;
299
- };
300
-
301
- declare const APPLE_OS_VALUES: readonly ['ios', 'ipados', 'tvos', 'watchos', 'visionos', 'macos'];
302
-
303
- declare type AppleOS = (typeof APPLE_OS_VALUES)[number];
304
-
305
- declare type AppListOptions = AgentDeviceRequestOverrides & AgentDeviceSelectionOptions & {
306
- appsFilter?: AppsFilter;
307
- };
308
-
309
- declare type AppOpenOptions = AgentDeviceRequestOverrides & AgentDeviceSelectionOptions & {
310
- app?: string;
311
- url?: string;
312
- surface?: SessionSurface;
313
- activity?: string;
314
- launchConsole?: string;
315
- launchArgs?: string[];
316
- relaunch?: boolean;
317
- saveScript?: boolean | string;
318
- deviceHub?: boolean;
319
- noRecord?: boolean;
320
- runtime?: SessionRuntimeHints;
321
- };
322
-
323
- declare type AppOpenResult = {
324
- session: string;
325
- sessionStateDir?: string;
326
- runnerLogPath?: string;
327
- requestLogPath?: string;
328
- appName?: string;
329
- appBundleId?: string;
330
- appId?: string;
331
- startup?: StartupPerfSample;
332
- runtime?: SessionRuntimeHints;
333
- device?: AgentDeviceSessionDevice;
334
- identifiers: AgentDeviceIdentifiers;
335
- };
336
-
337
- declare type AppPushOptions = DeviceCommandBaseOptions & {
338
- app: string;
339
- payload: string | Record<string, unknown>;
340
- };
341
-
342
- declare type AppsFilter = 'user-installed' | 'all';
343
-
344
- declare type AppStateCommandOptions = DeviceCommandBaseOptions;
345
-
346
- /**
347
- * Closed result of the `appstate` command, grounded in the daemon handler's
348
- * success returns (src/daemon/handlers/session-state.ts `handleAppStateCommand`).
349
- * A discriminated union on `platform`:
350
- * - Apple (`ios` / `macos`) session state, with iOS-only device locators that
351
- * the previous hand-written mirror omitted; and
352
- * - Android foreground `package` / `activity`.
353
- *
354
- * The handler returns one of these fixed objects (errors take the `ok: false`
355
- * path), so each branch is closed.
356
- */
357
- declare type AppStateCommandResult = {
358
- platform: 'ios' | 'macos';
359
- appName: string;
360
- appBundleId?: string;
361
- source: 'session';
362
- surface: SessionSurface;
363
- /** iOS only — the session device's UDID. */
364
- device_udid?: string;
365
- /** iOS only — the simulator set path, or `null` when unknown. */
366
- ios_simulator_device_set?: string | null;
367
- } | {
368
- platform: 'android';
369
- package: string;
370
- activity: string;
371
- };
372
-
373
- declare type AppSwitcherCommandOptions = DeviceCommandBaseOptions;
374
-
375
- /** `app-switcher` `{ action: 'app-switcher', message: 'Opened app switcher' }`. */
376
- declare type AppSwitcherCommandResult = {
377
- action: 'app-switcher';
378
- message: string;
379
- };
380
-
381
- declare type AppTriggerEventOptions = DeviceCommandBaseOptions & {
382
- event: string;
383
- payload?: Record<string, unknown>;
384
- };
385
-
386
- declare type ArtifactAdapter = {
387
- resolveInput(ref: FileInputRef, options: ResolveInputOptions): Promise<ResolvedInputFile>;
388
- reserveOutput(ref: FileOutputRef | undefined, options: ReserveOutputOptions): Promise<ReservedOutputFile>;
389
- createTempFile(options: CreateTempFileOptions): Promise<TemporaryFile>;
390
- };
391
-
392
- declare type ArtifactDescriptor = {
393
- kind: 'localPath';
394
- field: string;
395
- path: string;
396
- fileName?: string;
397
- metadata?: Record<string, unknown>;
398
- } | {
399
- kind: 'artifact';
400
- field: string;
401
- artifactId: string;
402
- fileName?: string;
403
- url?: string;
404
- clientPath?: string;
405
- metadata?: Record<string, unknown>;
406
- };
407
-
408
- declare type AudioOptions = AgentDeviceRequestOverrides & {
409
- action?: 'probe';
410
- probeAction?: 'start' | 'status' | 'stop';
411
- durationMs?: number;
412
- bucketMs?: number;
413
- };
414
-
415
- declare const BACK_MODES: readonly ['in-app', 'system'];
416
-
417
- declare type BackCommandOptions = DeviceCommandBaseOptions & {
418
- mode?: BackMode;
419
- };
420
-
421
- /** `back` — `{ action: 'back', mode, message: 'Back' }`; `mode` defaults to `'in-app'`. */
422
- declare type BackCommandResult = {
423
- action: 'back';
424
- mode: BackMode;
425
- message: string;
426
- };
427
-
428
- declare type BackMode = (typeof BACK_MODES)[number];
429
-
430
- declare type BatchRunOptions = AgentDeviceRequestOverrides & {
431
- steps: BatchStep[];
432
- onError?: 'stop';
433
- maxSteps?: number;
434
- out?: string;
435
- };
436
-
437
- declare type BatchRunResult = Record<string, unknown> & {
438
- total: number;
439
- executed: number;
440
- totalDurationMs: number;
441
- results: BatchStepResult[];
442
- };
443
-
444
- declare type BatchStep = {
445
- command: string;
446
- input: Record<string, unknown>;
447
- runtime?: SessionRuntimeHints;
448
- };
449
-
450
- declare type BatchStepResult = {
451
- step: number;
452
- command: string;
453
- ok: true;
454
- data: Record<string, unknown>;
455
- durationMs: number;
456
- };
457
-
458
- /**
459
- * Closed result of the `boot` command. Mirrors the daemon handler's only
460
- * success return EXACTLY (src/daemon/handlers/session-state.ts) — the fixed
461
- * object literal `{ platform, target, device, id, kind, booted }` plus the
462
- * additive `appleOs` discriminant, emitted only for Apple devices.
463
- */
464
- declare type BootCommandResult = {
465
- platform: PublicPlatform;
466
- target: DeviceTarget;
467
- /** Human-readable device name (`device.name`). */
468
- device: string;
469
- /** Stable device id (`device.id`). */
470
- id: string;
471
- kind: DeviceKind;
472
- /** Always `true` on the success path. */
473
- booted: true;
474
- /**
475
- * Additive Apple-OS discriminant (`device.appleOs`): iPhone/iPad/tvOS/visionOS/macOS.
476
- * Present only for Apple devices; absent for non-Apple platforms. `platform` stays the
477
- * leaf (`ios`/`macos`) — this is an extra field, not a replacement.
478
- */
479
- appleOs?: AppleOS;
480
- };
481
-
482
- declare type CaptureDiffOptions = DeviceCommandBaseOptions & Pick<CaptureSnapshotOptions, 'interactiveOnly' | 'depth' | 'scope' | 'raw'> & {
483
- kind: 'snapshot';
484
- out?: string;
485
- };
486
-
487
- declare type CaptureScreenshotOptions = AgentDeviceRequestOverrides & {
488
- path?: string;
489
- overlayRefs?: boolean;
490
- fullscreen?: boolean;
491
- maxSize?: number;
492
- stabilize?: boolean;
493
- normalizeStatusBar?: boolean;
494
- surface?: SessionSurface;
495
- };
496
-
497
- declare type CaptureScreenshotResult = ScreenshotResultData & {
498
- path: string;
499
- identifiers: AgentDeviceIdentifiers;
500
- };
501
-
502
- declare type CaptureSnapshotOptions = AgentDeviceRequestOverrides & AgentDeviceSelectionOptions & {
503
- interactiveOnly?: boolean;
504
- depth?: number;
505
- scope?: string;
506
- raw?: boolean;
507
- forceFull?: boolean;
508
- timeoutMs?: number;
509
- };
510
-
511
- declare type CaptureSnapshotResult = {
512
- nodes: SnapshotNode[];
513
- truncated: boolean;
514
- appName?: string;
515
- appBundleId?: string;
516
- visibility?: SnapshotVisibility;
517
- unchanged?: SnapshotUnchanged;
518
- snapshotDiagnostics?: SnapshotDiagnosticsSummary;
519
- identifiers: AgentDeviceIdentifiers;
520
- } & PublicSnapshotCaptureAnnotations;
521
-
522
- export declare function centerOfRect(rect: Rect): Point;
523
-
524
- declare const CLICK_BUTTONS: readonly ['primary', 'secondary', 'middle'];
525
-
526
- declare type ClickButton = (typeof CLICK_BUTTONS)[number];
527
-
528
- declare type ClickOptions = DeviceCommandBaseOptions & SelectorSnapshotCommandOptions & InteractionTarget & RepeatedPressOptions & {
529
- button?: ClickButton;
530
- };
531
-
532
- declare type ClipboardCommandOptions = (DeviceCommandBaseOptions & {
533
- action: 'read';
534
- }) | (DeviceCommandBaseOptions & {
535
- action: 'write';
536
- text: string;
537
- });
538
-
539
- /**
540
- * Closed result of the `clipboard` command. Mirrors the dispatch handler's
541
- * literal return EXACTLY (src/core/dispatch.ts `handleClipboardCommand`): a
542
- * discriminated union on `action`. `read` returns the clipboard `text`; `write`
543
- * reports the written `textLength` plus the `successText` message. The handler
544
- * spreads nothing else, so each branch is closed.
545
- */
546
- declare type ClipboardCommandResult = {
547
- action: 'read';
548
- text: string;
549
- } | {
550
- action: 'write';
551
- textLength: number;
552
- message: string;
553
- };
554
-
555
- declare const CLOUD_ARTIFACT_KINDS: readonly ['video', 'appium-log', 'device-log', 'automation-log', 'provider-session', 'raw'];
556
-
557
- declare type CloudArtifact = {
558
- provider: string;
559
- kind: CloudArtifactKind;
560
- name: string;
561
- url?: string;
562
- providerSessionId?: string;
563
- providerArtifactId?: string;
564
- contentType?: string;
565
- extension?: string;
566
- availability?: CloudArtifactAvailability;
567
- metadata?: Record<string, unknown>;
568
- };
569
-
570
- declare type CloudArtifactAvailability = 'ready' | 'pending' | 'unavailable' | 'expired';
571
-
572
- declare type CloudArtifactKind = (typeof CLOUD_ARTIFACT_KINDS)[number];
573
-
574
- declare type CloudArtifactsOptions = AgentDeviceRequestOverrides & {
575
- provider?: string;
576
- providerSessionId?: string;
577
- };
578
-
579
- declare type CloudArtifactsResult = {
580
- provider: string;
581
- status: CloudArtifactsStatus;
582
- cloudArtifacts: CloudArtifact[];
583
- providerSessionId?: string;
584
- message?: string;
585
- };
586
-
587
- declare type CloudArtifactsStatus = 'ready' | 'pending' | 'unavailable';
588
-
589
- declare type CloudProviderProfileFields = {
590
- providerApp?: string;
591
- providerOsVersion?: string;
592
- providerProject?: string;
593
- providerBuild?: string;
594
- providerSessionName?: string;
595
- awsProjectArn?: string;
596
- awsDeviceArn?: string;
597
- awsAppArn?: string;
598
- awsRegion?: string;
599
- awsInteractionMode?: 'INTERACTIVE' | 'NO_VIDEO' | 'VIDEO_ONLY';
600
- };
601
-
602
- declare type CloudProviderSessionResult = {
603
- provider?: string;
604
- providerSessionId?: string;
605
- cloudArtifacts?: CloudArtifactsResult;
606
- } & Record<string, unknown>;
607
-
608
- declare type CommandRequestResult = DaemonResponseData;
609
-
610
- /**
611
- * The typed result for a command named `N`. Seeded commands resolve to their
612
- * contract result type from {@link CommandResultMap}; every other (unmigrated)
613
- * command falls back to the untyped `Record<string, unknown>` bag. That default
614
- * branch is what keeps the mapping total over every command name, so consumers
615
- * can switch to `CommandResult<Name>` without first migrating every command.
616
- */
617
- declare type CommandResult<N extends string> = N extends keyof CommandResultMap ? CommandResultMap[N] : Record<string, unknown>;
618
-
619
- /**
620
- * The additive typed-result spine (ADR-0008, Phase 1 step 6).
621
- *
622
- * Maps a command name to the per-command result type from `src/contracts/*`. It
623
- * is SEEDED, not exhaustive: a command is listed here only once its accurate,
624
- * closed result shape lives in the contracts layer. Commands whose daemon
625
- * handler spreads dynamic/Record data (screenshot overlays, gesture
626
- * visualization, perf, logs, …) are deliberately omitted rather than given an
627
- * invented shape.
628
- *
629
- * Batches 1-2 wired `boot` / `shutdown` / `viewport` and the navigation/action
630
- * commands `home` / `back` / `rotate` / `app-switcher` alongside the seed
631
- * interaction trio. Batch 3 adds `clipboard` (a closed `read`/`write` union) and
632
- * `appstate` (a closed `platform` union — Apple session state with the iOS-only
633
- * device locators, or Android package/activity). Batch 4 adds `keyboard` (a
634
- * closed flat shape). Each entry is grounded in a
635
- * re-read of the handler's literal return; see the per-type docstrings.
636
- */
637
- declare interface CommandResultMap {
638
- press: PressCommandResult;
639
- fill: FillCommandResult;
640
- longpress: LongPressCommandResult;
641
- boot: BootCommandResult;
642
- shutdown: ShutdownCommandResult;
643
- viewport: ViewportCommandResult;
644
- home: HomeCommandResult;
645
- back: BackCommandResult;
646
- rotate: RotateCommandResult;
647
- 'app-switcher': AppSwitcherCommandResult;
648
- clipboard: ClipboardCommandResult;
649
- appstate: AppStateCommandResult;
650
- keyboard: KeyboardCommandResult;
651
- }
652
-
653
- declare type CompanionTunnelScope = {
654
- tenantId: string;
655
- runId: string;
656
- leaseId: string;
657
- };
658
-
659
- export declare function createAgentDeviceClient(config?: AgentDeviceClientConfig, deps?: {
660
- transport?: AgentDeviceDaemonTransport;
661
- }): AgentDeviceClient;
662
-
663
- export declare function createLocalArtifactAdapter(options?: LocalArtifactAdapterOptions): ArtifactAdapter;
664
-
665
- declare type CreateTempFileOptions = {
666
- prefix: string;
667
- ext: string;
668
- };
669
-
670
- declare const DAEMON_LOCK_POLICIES: readonly ['reject', 'strip'];
671
-
672
- declare const DAEMON_SERVER_MODES: readonly ['socket', 'http', 'dual'];
673
-
674
- declare const DAEMON_TRANSPORT_PREFERENCES: readonly ['auto', 'socket', 'http'];
675
-
676
- declare type DaemonArtifact = {
677
- field: string;
678
- artifactId?: string;
679
- fileName?: string;
680
- localPath?: string;
681
- path?: string;
682
- };
683
-
684
- declare type DaemonError = {
685
- code: string;
686
- message: string;
687
- hint?: string;
688
- diagnosticId?: string;
689
- logPath?: string;
690
- details?: Record<string, unknown>;
691
- /**
692
- * Machine-readable typed-error signals (Phase 2). Additive: present only when
693
- * derivable, so the default error wire shape is unchanged.
694
- *
695
- * `retriable` flags a transient failure an agent should retry (vs. a
696
- * deterministic one where a retry is wasted). `supportedOn` lists the platform
697
- * families that DO support the command (derived from the capability matrix),
698
- * surfaced on platform-mismatch errors so an agent self-corrects without a
699
- * wasted round-trip.
700
- */
701
- retriable?: boolean;
702
- supportedOn?: string;
703
- };
704
-
705
- declare type DaemonInstallSource = {
706
- kind: 'url';
707
- url: string;
708
- headers?: Record<string, string>;
709
- } | {
710
- kind: 'path';
711
- path: string;
712
- } | ({
713
- kind: 'github-actions-artifact';
714
- owner: string;
715
- repo: string;
716
- } & ({
717
- artifactId: number;
718
- } | {
719
- runId: number;
720
- artifactName: string;
721
- } | {
722
- artifactName: string;
723
- }));
724
-
725
- declare type DaemonLockPolicy = (typeof DAEMON_LOCK_POLICIES)[number];
726
-
727
- declare type DaemonRequest = {
728
- token?: string;
729
- session?: string;
730
- command: string;
731
- positionals: string[];
732
- flags?: Record<string, unknown>;
733
- runtime?: SessionRuntimeHints;
734
- meta?: DaemonRequestMeta;
735
- };
736
-
737
- declare type DaemonRequestMeta = {
738
- requestId?: string;
739
- debug?: boolean;
740
- includeCost?: boolean;
741
- responseLevel?: ResponseLevel;
742
- cwd?: string;
743
- sessionExplicit?: boolean;
744
- tenantId?: string;
745
- runId?: string;
746
- leaseId?: string;
747
- leaseTtlMs?: number;
748
- leaseBackend?: LeaseBackend;
749
- leaseProvider?: string;
750
- deviceKey?: string;
751
- clientId?: string;
752
- sessionIsolation?: SessionIsolationMode;
753
- uploadedArtifactId?: string;
754
- clientArtifactPaths?: Record<string, string>;
755
- installSource?: DaemonInstallSource;
756
- retainMaterializedPaths?: boolean;
757
- materializedPathRetentionMs?: number;
758
- materializationId?: string;
759
- lockPolicy?: DaemonLockPolicy;
760
- lockPlatform?: PlatformSelector;
761
- requestProgress?: 'replay-test' | 'command';
762
- };
763
-
764
- declare type DaemonResponse = {
765
- ok: true;
766
- data?: DaemonResponseData;
767
- } | {
768
- ok: false;
769
- error: DaemonError;
770
- };
771
-
772
- declare type DaemonResponseData = Record<string, unknown> & {
773
- artifacts?: DaemonArtifact[];
774
- cost?: ResponseCost;
775
- };
776
-
777
- declare type DaemonServerMode = (typeof DAEMON_SERVER_MODES)[number];
778
-
779
- declare type DaemonTransportPreference = (typeof DAEMON_TRANSPORT_PREFERENCES)[number];
780
-
781
- declare type DebugSymbolsCrashFrame = {
782
- index: number;
783
- image: string;
784
- address: string;
785
- symbol?: string;
786
- };
787
-
788
- declare type DebugSymbolsCrashSummary = {
789
- format: 'ips' | 'text';
790
- appName?: string;
791
- bundleId?: string;
792
- version?: string;
793
- incident?: string;
794
- timestamp?: string;
795
- exceptionType?: string;
796
- exceptionCodes?: string;
797
- terminationReason?: string;
798
- crashedThread?: number;
799
- topFrames: DebugSymbolsCrashFrame[];
800
- findings: string[];
801
- };
802
-
803
- declare type DebugSymbolsImage = {
804
- name: string;
805
- uuid: string;
806
- arch?: string;
807
- dsymPath: string;
808
- binaryPath: string;
809
- };
810
-
811
- declare type DebugSymbolsOptions = {
812
- action?: 'symbols';
813
- artifact: string;
814
- dsym?: string;
815
- searchPath?: string;
816
- out?: string;
817
- cwd?: string;
818
- };
819
-
820
- declare type DebugSymbolsResult = {
821
- kind: 'debugSymbols';
822
- platform: 'apple';
823
- artifactPath: string;
824
- outPath: string;
825
- crash: DebugSymbolsCrashSummary;
826
- matchedImages: DebugSymbolsImage[];
827
- symbolicatedFrames: number;
828
- skippedImages: number;
829
- warnings?: string[];
830
- message: string;
831
- };
832
-
833
- declare const DEVICE_KINDS: readonly ['simulator', 'emulator', 'device'];
834
-
835
- declare const DEVICE_ROTATIONS: readonly ['portrait', 'portrait-upside-down', 'landscape-left', 'landscape-right'];
836
-
837
- declare const DEVICE_TARGETS: readonly ['mobile', 'tv', 'desktop'];
838
-
839
- declare type DeviceBootOptions = DeviceCommandBaseOptions & {
840
- headless?: boolean;
841
- };
842
-
843
- declare type DeviceCommandBaseOptions = AgentDeviceRequestOverrides & AgentDeviceSelectionOptions;
844
-
845
- declare type DeviceKind = (typeof DEVICE_KINDS)[number];
846
-
847
- declare type DeviceRotation = (typeof DEVICE_ROTATIONS)[number];
848
-
849
- declare type DeviceShutdownOptions = DeviceCommandBaseOptions;
850
-
851
- declare type DeviceTarget = (typeof DEVICE_TARGETS)[number];
852
-
853
- declare type DoctorCommandOptions = DeviceCommandBaseOptions & {
854
- targetApp?: string;
855
- remote?: boolean;
856
- };
857
-
858
- declare type ElementTarget = RefTarget | SelectorTarget;
859
-
860
- declare type FileInputRef = {
861
- kind: 'path';
862
- path: string;
863
- } | {
864
- kind: 'uploadedArtifact';
865
- id: string;
866
- };
867
-
868
- declare type FileOutputRef = {
869
- kind: 'path';
870
- path: string;
871
- } | {
872
- kind: 'downloadableArtifact';
873
- clientPath?: string;
874
- fileName?: string;
875
- };
876
-
877
- declare type FillCommandResult = ResolvedInteractionTarget & {
878
- text: string;
879
- warning?: string;
880
- backendResult?: Record<string, unknown>;
881
- message?: string;
882
- };
883
-
884
- declare type FillOptions = DeviceCommandBaseOptions & SelectorSnapshotCommandOptions & InteractionTarget & {
885
- text: string;
886
- delayMs?: number;
887
- };
888
-
889
- declare const FIND_LOCATORS: readonly ['any', 'text', 'label', 'value', 'role', 'id'];
890
-
891
- declare type FindBaseOptions = DeviceCommandBaseOptions & FindSnapshotCommandOptions & {
892
- locator?: FindLocator;
893
- query: string;
894
- first?: boolean;
895
- last?: boolean;
896
- };
897
-
898
- declare type FindLocator = (typeof FIND_LOCATORS)[number];
899
-
900
- declare type FindOptions = (FindBaseOptions & {
901
- action?: 'click' | 'focus' | 'exists' | 'getText' | 'getAttrs';
902
- }) | (FindBaseOptions & {
903
- action: 'wait';
904
- timeoutMs?: number;
905
- }) | (FindBaseOptions & {
906
- action: 'fill' | 'type';
907
- value: string;
908
- });
909
-
910
- declare type FindSnapshotCommandOptions = Pick<CaptureSnapshotOptions, 'depth' | 'raw'>;
911
-
912
- declare type FlingOptions = DeviceCommandBaseOptions & {
913
- direction: ScrollDirection;
914
- x: number;
915
- y: number;
916
- distance?: number;
917
- durationMs?: number;
918
- };
919
-
920
- declare type FocusOptions_2 = DeviceCommandBaseOptions & {
921
- x: number;
922
- y: number;
923
- };
924
-
925
- declare type GetOptions = DeviceCommandBaseOptions & SelectorSnapshotCommandOptions & ElementTarget & {
926
- format: 'text' | 'attrs';
927
- };
928
-
929
- declare type HomeCommandOptions = DeviceCommandBaseOptions;
930
-
931
- /**
932
- * Closed results of the navigation/global action commands. Each mirrors the
933
- * dispatch handler's literal return EXACTLY (src/core/dispatch.ts
934
- * `DISPATCH_HANDLERS`): a fixed `action` discriminant plus the always-present
935
- * `successText` message (the handlers always pass a non-empty message, so it is
936
- * required here). The handlers spread nothing else, so the shapes are closed —
937
- * consistent with the `viewport` contract, the generic-dispatch Android
938
- * dialog-recovery `warning` annotation is intentionally not part of the contract.
939
- */
940
- /** `home` — `{ action: 'home', message: 'Home' }`. */
941
- declare type HomeCommandResult = {
942
- action: 'home';
943
- message: string;
944
- };
945
-
946
- declare type InteractionTarget = PointTarget | RefTarget | SelectorTarget;
947
-
948
- export declare function isAgentDeviceError(err: unknown): err is AppError;
949
-
950
- declare type IsOptions = IsTextPredicateOptions | IsStatePredicateOptions;
951
-
952
- declare type IsStatePredicateOptions = DeviceCommandBaseOptions & SelectorSnapshotCommandOptions & {
953
- predicate: 'visible' | 'hidden' | 'exists' | 'editable' | 'selected';
954
- selector: string;
955
- value?: never;
956
- };
957
-
958
- declare type IsTextPredicateOptions = DeviceCommandBaseOptions & SelectorSnapshotCommandOptions & {
959
- predicate: 'text';
960
- selector: string;
961
- value: string;
962
- };
963
-
964
- declare type KeyboardCommandOptions = DeviceCommandBaseOptions & {
965
- action?: 'status' | 'dismiss' | 'enter' | 'return';
966
- };
967
-
968
- /**
969
- * Closed result of the `keyboard` command, grounded in the dispatch handlers'
970
- * literal returns (src/core/dispatch.ts `handleAndroidKeyboardCommand` /
971
- * `handleIosKeyboardCommand`).
972
- *
973
- * `platform` and `action` are always present; the remaining fields appear per
974
- * branch (Android `status`/`dismiss` carry the keyboard-state fields; `enter`
975
- * and iOS `dismiss` carry a `message`). It is kept as a flat closed shape rather
976
- * than a five-way `platform`×`action` union because the per-branch field sets
977
- * overlap heavily and the underlying Android keyboard-state types live in the
978
- * platform layer (below the public contract). The `Record` index signature of
979
- * the previous hand-written mirror is dropped, and the spurious `| null`s are
980
- * removed (the handler never returns `null` for these).
981
- */
982
- declare type KeyboardCommandResult = {
983
- platform: 'android' | 'ios';
984
- action: 'status' | 'dismiss' | 'enter';
985
- visible?: boolean;
986
- wasVisible?: boolean;
987
- dismissed?: boolean;
988
- attempts?: number;
989
- inputType?: string;
990
- type?: 'text' | 'number' | 'email' | 'phone' | 'password' | 'datetime' | 'unknown';
991
- inputMethodPackage?: string;
992
- focusedPackage?: string;
993
- focusedResourceId?: string;
994
- inputOwner?: 'app' | 'ime' | 'unknown';
995
- message?: string;
996
- };
997
-
998
- declare type KnownAppErrorCode = 'INVALID_ARGS' | 'DEVICE_NOT_FOUND' | 'DEVICE_IN_USE' | 'TOOL_MISSING' | 'APP_NOT_INSTALLED' | 'UNSUPPORTED_PLATFORM' | 'UNSUPPORTED_OPERATION' | 'NOT_IMPLEMENTED' | 'COMMAND_FAILED' | 'SESSION_NOT_FOUND' | 'UNAUTHORIZED' | 'AMBIGUOUS_MATCH' | 'UNKNOWN';
999
-
1000
- declare type Lease = {
1001
- leaseId: string;
1002
- tenantId: string;
1003
- runId: string;
1004
- backend: LeaseBackend;
1005
- leaseProvider?: string;
1006
- deviceKey?: string;
1007
- clientId?: string;
1008
- createdAt?: number;
1009
- heartbeatAt?: number;
1010
- expiresAt?: number;
1011
- };
1012
-
1013
- declare const LEASE_BACKENDS: readonly ['ios-simulator', 'ios-instance', 'android-instance'];
1014
-
1015
- declare type LeaseAllocateOptions = LeaseOptions & {
1016
- tenant: string;
1017
- runId: string;
1018
- leaseBackend?: LeaseBackend;
1019
- leaseProvider?: string;
1020
- provider?: string;
1021
- deviceKey?: string;
1022
- clientId?: string;
1023
- };
1024
-
1025
- declare type LeaseBackend = (typeof LEASE_BACKENDS)[number];
1026
-
1027
- declare type LeaseOptions = AgentDeviceRequestOverrides & AgentDeviceSelectionOptions & {
1028
- ttlMs?: number;
1029
- };
1030
-
1031
- declare type LeaseScopedOptions = LeaseOptions & {
1032
- tenant?: string;
1033
- runId?: string;
1034
- leaseId: string;
1035
- leaseBackend?: LeaseBackend;
1036
- leaseProvider?: string;
1037
- provider?: string;
1038
- deviceKey?: string;
1039
- clientId?: string;
1040
- };
1041
-
1042
- declare type LocalArtifactAdapterOptions = {
1043
- cwd?: string;
1044
- tempDir?: string;
1045
- rootDir?: string;
1046
- };
1047
-
1048
- declare const LOG_ACTION_VALUES: readonly ['path', 'start', 'stop', 'doctor', 'mark', 'clear'];
1049
-
1050
- declare type LogAction = (typeof LOG_ACTION_VALUES)[number];
1051
-
1052
- declare type LogsOptions = AgentDeviceRequestOverrides & {
1053
- action?: LogAction;
1054
- message?: string;
1055
- restart?: boolean;
1056
- };
1057
-
1058
- declare type LongPressCommandResult = ResolvedInteractionTarget & {
1059
- durationMs?: number;
1060
- backendResult?: Record<string, unknown>;
1061
- message?: string;
1062
- };
1063
-
1064
- declare type LongPressOptions = DeviceCommandBaseOptions & SelectorSnapshotCommandOptions & InteractionTarget & {
1065
- durationMs?: number;
1066
- };
1067
-
1068
- declare type MaterializationReleaseOptions = AgentDeviceRequestOverrides & {
1069
- materializationId: string;
1070
- };
1071
-
1072
- declare type MaterializationReleaseResult = {
1073
- released: boolean;
1074
- materializationId: string;
1075
- identifiers: AgentDeviceIdentifiers;
1076
- };
1077
-
1078
- declare type MetroBridgeResult = {
1079
- enabled: boolean;
1080
- baseUrl: string;
1081
- statusUrl: string;
1082
- bundleUrl: string;
1083
- iosRuntime: MetroRuntimeHints;
1084
- androidRuntime: MetroRuntimeHints;
1085
- upstream: {
1086
- bundleUrl: string;
1087
- host: string;
1088
- port: number;
1089
- statusUrl: string;
1090
- };
1091
- probe: {
1092
- reachable: boolean;
1093
- statusCode: number;
1094
- latencyMs: number;
1095
- detail: string;
1096
- };
1097
- };
1098
-
1099
- declare type MetroBridgeScope = CompanionTunnelScope;
1100
-
1101
- declare type MetroPrepareKind = 'auto' | 'react-native' | 'expo';
1102
-
1103
- declare type MetroPrepareOptions = {
1104
- projectRoot?: string;
1105
- kind?: MetroPrepareKind;
1106
- publicBaseUrl?: string;
1107
- proxyBaseUrl?: string;
1108
- bearerToken?: string;
1109
- bridgeScope?: MetroBridgeScope;
1110
- launchUrl?: string;
1111
- companionProfileKey?: string;
1112
- companionConsumerKey?: string;
1113
- port?: number;
1114
- listenHost?: string;
1115
- statusHost?: string;
1116
- startupTimeoutMs?: number;
1117
- probeTimeoutMs?: number;
1118
- reuseExisting?: boolean;
1119
- installDependenciesIfNeeded?: boolean;
1120
- runtimeFilePath?: string;
1121
- logPath?: string;
1122
- };
1123
-
1124
- declare type MetroPrepareResult = PrepareMetroRuntimeResult;
1125
-
1126
- declare type MetroReloadOptions = {
1127
- metroHost?: string;
1128
- metroPort?: number;
1129
- bundleUrl?: string;
1130
- timeoutMs?: number;
1131
- };
1132
-
1133
- declare type MetroReloadResult = ReloadMetroResult;
1134
-
1135
- /** Re-export of {@link SessionRuntimeHints} under the Metro-specific alias used by public API consumers. */
1136
- declare type MetroRuntimeHints = SessionRuntimeHints;
1137
-
1138
- declare const NETWORK_INCLUDE_MODES: readonly ['summary', 'headers', 'body', 'all'];
1139
-
1140
- declare type NetworkIncludeMode = (typeof NETWORK_INCLUDE_MODES)[number];
1141
-
1142
- declare type NetworkOptions = AgentDeviceRequestOverrides & {
1143
- action?: 'dump' | 'log';
1144
- limit?: number;
1145
- include?: NetworkIncludeMode;
1146
- };
1147
-
1148
- export declare function normalizeAgentDeviceError(err: unknown, context?: {
1149
- diagnosticId?: string;
1150
- logPath?: string;
1151
- }): NormalizedError;
1152
-
1153
- declare type NormalizedError = {
1154
- code: string;
1155
- message: string;
1156
- hint?: string;
1157
- diagnosticId?: string;
1158
- logPath?: string;
1159
- details?: Record<string, unknown>;
1160
- };
1161
-
1162
- declare type OutputVisibility = 'client-visible' | 'internal';
1163
-
1164
- declare type PanOptions = DeviceCommandBaseOptions & {
1165
- x: number;
1166
- y: number;
1167
- dx: number;
1168
- dy: number;
1169
- durationMs?: number;
1170
- };
1171
-
1172
- declare const PERF_ACTION_VALUES: readonly ['sample', 'snapshot', 'start', 'stop', 'report'];
1173
-
1174
- declare const PERF_AREA_VALUES: readonly ['metrics', 'frames', 'memory', 'cpu', 'trace'];
1175
-
1176
- declare const PERF_KIND_VALUES: readonly ['xctrace', 'simpleperf', 'perfetto', 'android-hprof', 'memgraph'];
1177
-
1178
- declare const PERF_SUBJECT_VALUES: readonly ['profile'];
1179
-
1180
- declare type PerfAction = (typeof PERF_ACTION_VALUES)[number];
1181
-
1182
- declare type PerfArea = (typeof PERF_AREA_VALUES)[number];
1183
-
1184
- declare type PerfKind = (typeof PERF_KIND_VALUES)[number];
1185
-
1186
- declare type PerfOptions = DeviceCommandBaseOptions & {
1187
- area?: PerfArea;
1188
- subject?: PerfSubject;
1189
- action?: PerfAction;
1190
- kind?: PerfKind;
1191
- template?: string;
1192
- out?: string;
1193
- tracePath?: string;
1194
- };
1195
-
1196
- declare type PerfSubject = (typeof PERF_SUBJECT_VALUES)[number];
1197
-
1198
- declare type PermissionTarget = 'camera' | 'microphone' | 'photos' | 'contacts' | 'contacts-limited' | 'notifications' | 'calendar' | 'location' | 'location-always' | 'media-library' | 'motion' | 'reminders' | 'siri' | 'accessibility' | 'screen-recording' | 'input-monitoring';
1199
-
1200
- declare type PinchOptions = DeviceCommandBaseOptions & {
1201
- scale: number;
1202
- x?: number;
1203
- y?: number;
1204
- };
1205
-
1206
- declare const PLATFORM_SELECTORS: readonly ["apple", "android", "linux", "web", "ios", "macos"];
1207
-
1208
- declare type PlatformSelector = (typeof PLATFORM_SELECTORS)[number];
1209
-
1210
- declare type Point = {
1211
- x: number;
1212
- y: number;
1213
- };
1214
-
1215
- declare type PointTarget = {
1216
- x: number;
1217
- y: number;
1218
- ref?: never;
1219
- selector?: never;
1220
- label?: never;
1221
- };
1222
-
1223
- declare type PrepareCommandOptions = DeviceCommandBaseOptions & {
1224
- action: 'ios-runner';
1225
- timeoutMs?: number;
1226
- };
1227
-
1228
- declare type PrepareMetroRuntimeResult = {
1229
- projectRoot: string;
1230
- kind: ResolvedMetroKind;
1231
- dependenciesInstalled: boolean;
1232
- packageManager: string | null;
1233
- started: boolean;
1234
- reused: boolean;
1235
- pid: number;
1236
- logPath: string;
1237
- statusUrl: string;
1238
- runtimeFilePath: string | null;
1239
- iosRuntime: MetroRuntimeHints;
1240
- androidRuntime: MetroRuntimeHints;
1241
- bridge: MetroBridgeResult | null;
1242
- };
1243
-
1244
- declare type PressCommandResult = ResolvedInteractionTarget & {
1245
- backendResult?: Record<string, unknown>;
1246
- message?: string;
1247
- };
1248
-
1249
- declare type PressOptions = DeviceCommandBaseOptions & SelectorSnapshotCommandOptions & InteractionTarget & RepeatedPressOptions;
1250
-
1251
- declare const PUBLIC_PLATFORMS: readonly ['ios', 'macos', 'android', 'linux', 'web'];
1252
-
1253
- declare type PublicPlatform = (typeof PUBLIC_PLATFORMS)[number];
1254
-
1255
- declare type PublicSnapshotCaptureAnnotations = Pick<SnapshotCaptureAnnotations, 'androidSnapshot' | 'warnings'> & {
1256
- snapshotQuality?: SnapshotQualityVerdict;
1257
- };
1258
-
1259
- declare type RawSnapshotNode = {
1260
- index: number;
1261
- type?: string;
1262
- role?: string;
1263
- subrole?: string;
1264
- label?: string;
1265
- value?: string;
1266
- identifier?: string;
1267
- rect?: Rect;
1268
- enabled?: boolean;
1269
- selected?: boolean;
1270
- focused?: boolean;
1271
- visibleToUser?: boolean;
1272
- hittable?: boolean;
1273
- depth?: number;
1274
- parentIndex?: number;
1275
- pid?: number;
1276
- bundleId?: string;
1277
- appName?: string;
1278
- windowTitle?: string;
1279
- surface?: string;
1280
- hiddenContentAbove?: boolean;
1281
- hiddenContentBelow?: boolean;
1282
- interactionBlocked?: 'covered';
1283
- presentationHints?: string[];
1284
- };
1285
-
1286
- declare type ReactNativeCommandOptions = DeviceCommandBaseOptions & {
1287
- action: 'dismiss-overlay';
1288
- };
1289
-
1290
- declare const RECORDING_EXPORT_QUALITIES: readonly ['medium', 'high'];
1291
-
1292
- declare type RecordingExportQuality = (typeof RECORDING_EXPORT_QUALITIES)[number];
1293
-
1294
- declare type RecordOptions = AgentDeviceRequestOverrides & {
1295
- action: 'start' | 'stop';
1296
- path?: string;
1297
- fps?: number;
1298
- maxSize?: number;
1299
- quality?: RecordingExportQuality;
1300
- hideTouches?: boolean;
1301
- };
1302
-
1303
- declare type Rect = {
1304
- x: number;
1305
- y: number;
1306
- width: number;
1307
- height: number;
1308
- };
1309
-
1310
- declare type RefTarget = {
1311
- ref: string;
1312
- label?: string;
1313
- x?: never;
1314
- y?: never;
1315
- selector?: never;
1316
- };
1317
-
1318
- declare type ReloadMetroResult = {
1319
- reloaded: true;
1320
- reloadUrl: string;
1321
- status: number;
1322
- body: string;
1323
- };
1324
-
1325
- declare type RemoteConnectionProfileFields = {
1326
- stateDir?: string;
1327
- daemonBaseUrl?: string;
1328
- daemonAuthToken?: string;
1329
- daemonTransport?: DaemonTransportPreference;
1330
- daemonServerMode?: DaemonServerMode;
1331
- tenant?: string;
1332
- sessionIsolation?: SessionIsolationMode;
1333
- runId?: string;
1334
- leaseId?: string;
1335
- leaseBackend?: LeaseBackend;
1336
- leaseProvider?: string;
1337
- deviceKey?: string;
1338
- clientId?: string;
1339
- };
1340
-
1341
- declare type RepeatedPressOptions = {
1342
- count?: number;
1343
- intervalMs?: number;
1344
- holdMs?: number;
1345
- jitterPx?: number;
1346
- doubleTap?: boolean;
1347
- };
1348
-
1349
- declare type ReplayRunOptions = AgentDeviceRequestOverrides & AgentDeviceSelectionOptions & {
1350
- path: string;
1351
- update?: boolean;
1352
- /** @deprecated Use backend: 'maestro'. */
1353
- maestro?: boolean;
1354
- backend?: string;
1355
- env?: string[];
1356
- timeoutMs?: number;
1357
- };
1358
-
1359
- declare type ReplayTestOptions = AgentDeviceRequestOverrides & AgentDeviceSelectionOptions & {
1360
- paths: string[];
1361
- update?: boolean;
1362
- /** @deprecated Use backend: 'maestro'. */
1363
- maestro?: boolean;
1364
- backend?: string;
1365
- env?: string[];
1366
- failFast?: boolean;
1367
- timeoutMs?: number;
1368
- retries?: number;
1369
- recordVideo?: boolean;
1370
- artifactsDir?: string;
1371
- /** @deprecated Use the CLI --reporter junit:<path> or --report-junit <path>. */
1372
- reportJunit?: string;
1373
- shardAll?: number;
1374
- shardSplit?: number;
1375
- };
1376
-
1377
- declare type ReservedOutputFile = {
1378
- path: string;
1379
- visibility: OutputVisibility;
1380
- publish: () => Promise<ArtifactDescriptor | undefined>;
1381
- cleanup?: () => Promise<void>;
1382
- };
1383
-
1384
- declare type ReserveOutputOptions = {
1385
- field: string;
1386
- ext: string;
1387
- requestedClientPath?: string;
1388
- visibility?: OutputVisibility;
1389
- };
1390
-
1391
- declare type ResolvedInputFile = {
1392
- path: string;
1393
- cleanup?: () => Promise<void>;
1394
- };
1395
-
1396
- declare type ResolvedInteractionTarget = {
1397
- kind: 'point';
1398
- point: Point;
1399
- } | {
1400
- kind: 'ref';
1401
- point?: Point;
1402
- target: Extract<ResolvedTarget, {
1403
- kind: 'ref';
1404
- }>;
1405
- node?: SnapshotNode;
1406
- selectorChain?: string[];
1407
- refLabel?: string;
1408
- } | {
1409
- kind: 'selector';
1410
- point: Point;
1411
- target: Extract<ResolvedTarget, {
1412
- kind: 'selector';
1413
- }>;
1414
- node: SnapshotNode;
1415
- selectorChain: string[];
1416
- refLabel?: string;
1417
- };
1418
-
1419
- declare type ResolvedMetroKind = Exclude<MetroPrepareKind, 'auto'>;
1420
-
1421
- declare type ResolvedTarget = {
1422
- kind: 'selector';
1423
- selector: string;
1424
- } | {
1425
- kind: 'ref';
1426
- ref: string;
1427
- };
1428
-
1429
- declare type ResolveInputOptions = {
1430
- usage: string;
1431
- field?: string;
1432
- };
1433
-
1434
- declare const RESPONSE_LEVELS: readonly ['digest', 'default', 'full'];
1435
-
1436
- declare type ResponseCost = {
1437
- wallClockMs: number;
1438
- runnerRoundTrips: number;
1439
- nodeCount?: number;
1440
- };
1441
-
1442
- declare type ResponseLevel = (typeof RESPONSE_LEVELS)[number];
1443
-
1444
- declare type RotateCommandOptions = DeviceCommandBaseOptions & {
1445
- orientation: DeviceRotation;
1446
- };
1447
-
1448
- /** `rotate` — `{ action: 'rotate', orientation, message: 'Rotated to <orientation>' }`. */
1449
- declare type RotateCommandResult = {
1450
- action: 'rotate';
1451
- orientation: DeviceRotation;
1452
- message: string;
1453
- };
1454
-
1455
- declare type RotateGestureOptions = DeviceCommandBaseOptions & {
1456
- degrees: number;
1457
- x?: number;
1458
- y?: number;
1459
- velocity?: number;
1460
- };
1461
-
1462
- declare type ScreenshotOverlayRef = {
1463
- ref: string;
1464
- label?: string;
1465
- rect: Rect;
1466
- overlayRect: Rect;
1467
- center: Point;
1468
- };
1469
-
1470
- declare type ScreenshotResultData = {
1471
- path?: string;
1472
- overlayRefs?: ScreenshotOverlayRef[];
1473
- };
1474
-
1475
- declare const SCROLL_DIRECTIONS: readonly ['up', 'down', 'left', 'right'];
1476
-
1477
- declare const SCROLL_INPUT_DIRECTIONS: readonly ['up', 'down', 'left', 'right', 'top', 'bottom'];
1478
-
1479
- declare type ScrollDirection = (typeof SCROLL_DIRECTIONS)[number];
1480
-
1481
- declare type ScrollInputDirection = (typeof SCROLL_INPUT_DIRECTIONS)[number];
1482
-
1483
- declare type ScrollOptions_2 = DeviceCommandBaseOptions & {
1484
- direction: ScrollInputDirection;
1485
- amount?: number;
1486
- pixels?: number;
1487
- durationMs?: number;
1488
- };
1489
-
1490
- declare type SelectorSnapshotCommandOptions = Pick<CaptureSnapshotOptions, 'depth' | 'scope' | 'raw'>;
1491
-
1492
- declare type SelectorTarget = {
1493
- selector: string;
1494
- x?: never;
1495
- y?: never;
1496
- ref?: never;
1497
- label?: never;
1498
- };
1499
-
1500
- declare const SESSION_ISOLATION_MODES: readonly ['none', 'tenant'];
1501
-
1502
- declare const SESSION_SURFACES: readonly ['app', 'frontmost-app', 'desktop', 'menubar'];
1503
-
1504
- declare type SessionCloseResult = {
1505
- session: string;
1506
- shutdown?: TargetShutdownResult;
1507
- provider?: CloudProviderSessionResult;
1508
- identifiers: AgentDeviceIdentifiers;
1509
- };
1510
-
1511
- declare type SessionIsolationMode = (typeof SESSION_ISOLATION_MODES)[number];
1512
-
1513
- declare type SessionRuntimeHints = {
1514
- platform?: 'ios' | 'android';
1515
- metroHost?: string;
1516
- metroPort?: number;
1517
- bundleUrl?: string;
1518
- launchUrl?: string;
1519
- };
1520
-
1521
- declare type SessionSurface = (typeof SESSION_SURFACES)[number];
1522
-
1523
- declare type SettingsUpdateOptions = (DeviceCommandBaseOptions & {
1524
- setting: 'clear-app-state';
1525
- state: 'clear';
1526
- app?: string;
1527
- }) | (DeviceCommandBaseOptions & {
1528
- setting: 'wifi' | 'airplane' | 'location';
1529
- state: 'on' | 'off';
1530
- }) | (DeviceCommandBaseOptions & {
1531
- setting: 'location';
1532
- state: 'set';
1533
- latitude: number;
1534
- longitude: number;
1535
- }) | (DeviceCommandBaseOptions & {
1536
- setting: 'animations';
1537
- state: 'on' | 'off';
1538
- }) | (DeviceCommandBaseOptions & {
1539
- setting: 'appearance';
1540
- state: 'light' | 'dark' | 'toggle';
1541
- }) | (DeviceCommandBaseOptions & {
1542
- setting: 'faceid' | 'touchid';
1543
- state: 'match' | 'nonmatch' | 'enroll' | 'unenroll';
1544
- }) | (DeviceCommandBaseOptions & {
1545
- setting: 'fingerprint';
1546
- state: 'match' | 'nonmatch';
1547
- }) | (DeviceCommandBaseOptions & {
1548
- setting: 'permission';
1549
- state: 'grant' | 'deny' | 'reset';
1550
- permission: PermissionTarget;
1551
- mode?: 'full' | 'limited';
1552
- });
1553
-
1554
- /**
1555
- * Closed result of the `shutdown` command. Mirrors the daemon handler's success
1556
- * return EXACTLY (src/daemon/handlers/session-state.ts) — the fixed object
1557
- * literal `{ platform, target, device, id, kind, shutdown }` plus the additive
1558
- * `appleOs` discriminant (Apple devices only). The `shutdown` field is the raw
1559
- * {@link TargetShutdownResult} from `shutdownDeviceTarget`.
1560
- */
1561
- declare type ShutdownCommandResult = {
1562
- platform: PublicPlatform;
1563
- target: DeviceTarget;
1564
- /** Human-readable device name (`device.name`). */
1565
- device: string;
1566
- /** Stable device id (`device.id`). */
1567
- id: string;
1568
- kind: DeviceKind;
1569
- shutdown: TargetShutdownResult;
1570
- /**
1571
- * Additive Apple-OS discriminant (`device.appleOs`): iPhone/iPad/tvOS/visionOS/macOS.
1572
- * Present only for Apple devices; absent for non-Apple platforms. `platform` stays the
1573
- * leaf (`ios`/`macos`) — this is an extra field, not a replacement.
1574
- */
1575
- appleOs?: AppleOS;
1576
- };
1577
-
1578
- declare type SnapshotCaptureAnalysis = {
1579
- rawNodeCount: number;
1580
- maxDepth: number;
1581
- };
1582
-
1583
- declare type SnapshotCaptureAnnotations = {
1584
- analysis?: SnapshotCaptureAnalysis;
1585
- androidSnapshot?: AndroidSnapshotBackendMetadata;
1586
- freshness?: SnapshotCaptureFreshness;
1587
- quality?: SnapshotQualityVerdict;
1588
- warnings?: string[];
1589
- };
1590
-
1591
- declare type SnapshotCaptureFreshness = {
1592
- action: string;
1593
- retryCount: number;
1594
- staleAfterRetries: boolean;
1595
- reason?: 'empty-interactive' | 'sharp-drop' | 'stuck-route';
1596
- };
1597
-
1598
- declare type SnapshotDiagnosticsSummary = {
1599
- stats: SnapshotTimingStats;
1600
- warning?: string;
1601
- };
1602
-
1603
- declare type SnapshotNode = RawSnapshotNode & {
1604
- ref: string;
1605
- };
1606
-
1607
- /**
1608
- * Structured quality verdict computed once by the iOS runner's snapshot capture plan.
1609
- * The daemon renders it; it never re-derives degradation from node shapes.
1610
- *
1611
- * Defined here (the foundational snapshot type module) rather than in
1612
- * snapshot-quality.ts so SnapshotNode can reference it without a cyclic import;
1613
- * snapshot-quality.ts (the validation logic) re-exports it for existing callers.
1614
- */
1615
- declare type SnapshotQualityVerdict = {
1616
- state: 'healthy' | 'recovered' | 'sparse';
1617
- backend: 'tree' | 'queries' | 'private-ax';
1618
- reason?: string;
1619
- reasonCode?: 'ax-rejected' | 'sparse-tree' | 'budget' | 'no-nodes' | 'capture-failed';
1620
- effectiveDepth?: number;
1621
- collapsedLeafIndexes?: number[];
1622
- };
1623
-
1624
- declare type SnapshotTimingStats = {
1625
- count: number;
1626
- p50Ms: number;
1627
- p95Ms: number;
1628
- maxMs: number;
1629
- slowThresholdMs: number;
1630
- platform?: PublicPlatform;
1631
- backends?: Record<string, number>;
1632
- };
1633
-
1634
- declare type SnapshotUnchanged = {
1635
- ageMs: number;
1636
- nodeCount: number;
1637
- interactiveOnly?: boolean;
1638
- scope?: string;
1639
- };
1640
-
1641
- declare type SnapshotVisibility = {
1642
- partial: boolean;
1643
- visibleNodeCount: number;
1644
- totalNodeCount: number;
1645
- reasons: SnapshotVisibilityReason[];
1646
- };
1647
-
1648
- declare type SnapshotVisibilityReason = 'offscreen-nodes' | 'scroll-hidden-above' | 'scroll-hidden-below';
1649
-
1650
- declare type StartupPerfSample = {
1651
- durationMs: number;
1652
- measuredAt: string;
1653
- method: string;
1654
- appTarget?: string;
1655
- appBundleId?: string;
1656
- };
1657
-
1658
- declare const SWIPE_PATTERNS: readonly ['one-way', 'ping-pong'];
1659
-
1660
- declare const SWIPE_PRESETS: readonly ['left', 'right', 'left-edge', 'right-edge'];
1661
-
1662
- declare type SwipeGestureOptions = DeviceCommandBaseOptions & {
1663
- preset: SwipePreset;
1664
- durationMs?: number;
1665
- };
1666
-
1667
- declare type SwipeOptions = DeviceCommandBaseOptions & {
1668
- from: {
1669
- x: number;
1670
- y: number;
1671
- };
1672
- to: {
1673
- x: number;
1674
- y: number;
1675
- };
1676
- durationMs?: number;
1677
- count?: number;
1678
- pauseMs?: number;
1679
- pattern?: SwipePattern;
1680
- };
1681
-
1682
- declare type SwipePattern = (typeof SWIPE_PATTERNS)[number];
1683
-
1684
- declare type SwipePreset = (typeof SWIPE_PRESETS)[number];
1685
-
1686
- declare type TargetShutdownResult = {
1687
- success: boolean;
1688
- exitCode: number;
1689
- stdout: string;
1690
- stderr: string;
1691
- error?: NormalizedError;
1692
- };
1693
-
1694
- declare type TemporaryFile = {
1695
- path: string;
1696
- visibility: 'internal';
1697
- cleanup: () => Promise<void>;
1698
- };
1699
-
1700
- declare type TraceOptions = AgentDeviceRequestOverrides & {
1701
- action: 'start' | 'stop';
1702
- path?: string;
1703
- };
1704
-
1705
- declare type TransformGestureOptions = DeviceCommandBaseOptions & TransformGestureParams;
1706
-
1707
- declare type TransformGestureParams = {
1708
- x: number;
1709
- y: number;
1710
- dx: number;
1711
- dy: number;
1712
- scale: number;
1713
- degrees: number;
1714
- durationMs?: number;
1715
- };
1716
-
1717
- declare type TypeTextOptions = DeviceCommandBaseOptions & {
1718
- text: string;
1719
- delayMs?: number;
1720
- };
1721
-
1722
- declare type ViewportCommandOptions = DeviceCommandBaseOptions & {
1723
- width: number;
1724
- height: number;
1725
- };
1726
-
1727
- /**
1728
- * Closed result of the `viewport` command. Mirrors the dispatch handler's return
1729
- * EXACTLY (src/core/dispatch.ts `handleViewportCommand`) — `{ width, height }`
1730
- * plus the always-present `successText` message. The generic dispatch path
1731
- * returns this object unchanged (viewport has no Android dialog guard, so no
1732
- * `warning` is ever appended), so the shape is intentionally closed.
1733
- */
1734
- declare type ViewportCommandResult = {
1735
- width: number;
1736
- height: number;
1737
- message: string;
1738
- };
1739
-
1740
- declare type WaitCommandOptions = DeviceCommandBaseOptions & WaitCommandTarget;
1741
-
1742
- declare type WaitCommandTarget = {
1743
- durationMs: number;
1744
- text?: never;
1745
- ref?: never;
1746
- selector?: never;
1747
- timeoutMs?: never;
1748
- } | (SelectorSnapshotCommandOptions & {
1749
- text: string;
1750
- durationMs?: never;
1751
- ref?: never;
1752
- selector?: never;
1753
- timeoutMs?: number;
1754
- }) | (SelectorSnapshotCommandOptions & {
1755
- ref: string;
1756
- durationMs?: never;
1757
- text?: never;
1758
- selector?: never;
1759
- timeoutMs?: number;
1760
- }) | (SelectorSnapshotCommandOptions & {
1761
- selector: string;
1762
- durationMs?: never;
1763
- text?: never;
1764
- ref?: never;
1765
- timeoutMs?: number;
1766
- });
1767
-
1768
- export { }
1
+ import { A as AppError, B as PlatformSelector, C as SnapshotQualityVerdict, D as centerOfRect, E as SnapshotVisibility, I as AppleOS, L as DeviceKind, N as isAgentDeviceError, O as DebugSymbolsOptions, P as normalizeAgentDeviceError, R as DeviceTarget, S as SnapshotNode, T as SnapshotUnchanged, V as PublicPlatform, _ as ResponseLevel, a as DaemonRequest, b as Point, g as NetworkIncludeMode, i as DaemonLockPolicy, j as NormalizedError, k as DebugSymbolsResult, o as DaemonResponse, p as LeaseBackend, r as DaemonInstallSource, s as DaemonResponseData, t as DaemonArtifactType, v as SessionIsolationMode, x as ScreenshotOverlayRef, y as SessionRuntimeHints } from "./sdk-contracts.js";
2
+ import { t as AppsFilter } from "./sdk-app-inventory.js";
3
+ import { t as BatchRunResult } from "./sdk-batch-runner.js";
4
+ import { r as FindLocator } from "./sdk-finders.js";
5
+ import { p as createLocalArtifactAdapter } from "./sdk-io.js";
6
+ import { a as PrepareMetroRuntimeResult, c as MetroBridgeScope, i as MetroPrepareKind, o as ReloadMetroResult, r as RemoteConnectionProfileFields, t as CloudProviderProfileFields } from "./sdk-remote-config.js";
7
+
8
+ //#region src/platforms/android/snapshot-helper-types.d.ts
9
+ type AndroidSnapshotHelperTransport = 'instrumentation' | 'persistent-session';
10
+ type AndroidSnapshotCaptureMode = 'interactive-windows' | 'active-window';
11
+ type AndroidSnapshotHelperInstallReason = 'missing' | 'outdated' | 'forced' | 'current' | 'skipped';
12
+ //#endregion
13
+ //#region src/platforms/android/snapshot-types.d.ts
14
+ type AndroidSnapshotBackendMetadata = {
15
+ backend: 'android-helper' | 'uiautomator-dump';
16
+ helperVersion?: string;
17
+ helperApiVersion?: string;
18
+ helperTransport?: AndroidSnapshotHelperTransport;
19
+ helperSessionReused?: boolean;
20
+ fallbackReason?: string;
21
+ installReason?: AndroidSnapshotHelperInstallReason;
22
+ waitForIdleTimeoutMs?: number;
23
+ waitForIdleQuietMs?: number;
24
+ timeoutMs?: number;
25
+ maxDepth?: number;
26
+ maxNodes?: number;
27
+ rootPresent?: boolean;
28
+ captureMode?: AndroidSnapshotCaptureMode;
29
+ windowCount?: number;
30
+ nodeCount?: number;
31
+ helperTruncated?: boolean;
32
+ elapsedMs?: number;
33
+ };
34
+ //#endregion
35
+ //#region src/snapshot-capture-annotations.d.ts
36
+ type SnapshotCaptureAnalysis = {
37
+ rawNodeCount: number;
38
+ maxDepth: number;
39
+ };
40
+ type SnapshotCaptureFreshness = {
41
+ action: string;
42
+ retryCount: number;
43
+ staleAfterRetries: boolean;
44
+ reason?: 'empty-interactive' | 'sharp-drop' | 'stuck-route';
45
+ };
46
+ type SnapshotCaptureAnnotations = {
47
+ analysis?: SnapshotCaptureAnalysis;
48
+ androidSnapshot?: AndroidSnapshotBackendMetadata;
49
+ freshness?: SnapshotCaptureFreshness;
50
+ quality?: SnapshotQualityVerdict;
51
+ warnings?: string[];
52
+ };
53
+ type PublicSnapshotCaptureAnnotations = Pick<SnapshotCaptureAnnotations, 'androidSnapshot' | 'warnings'> & {
54
+ snapshotQuality?: SnapshotQualityVerdict;
55
+ };
56
+ //#endregion
57
+ //#region src/snapshot-diagnostics.d.ts
58
+ type SnapshotTimingStats = {
59
+ count: number;
60
+ p50Ms: number;
61
+ p95Ms: number;
62
+ maxMs: number;
63
+ slowThresholdMs: number;
64
+ platform?: PublicPlatform;
65
+ backends?: Record<string, number>;
66
+ };
67
+ type SnapshotDiagnosticsSummary = {
68
+ stats: SnapshotTimingStats;
69
+ warning?: string;
70
+ };
71
+ //#endregion
72
+ //#region src/core/back-mode.d.ts
73
+ declare const BACK_MODES: readonly ['in-app', 'system'];
74
+ type BackMode = (typeof BACK_MODES)[number];
75
+ //#endregion
76
+ //#region src/core/click-button.d.ts
77
+ declare const CLICK_BUTTONS: readonly ['primary', 'secondary', 'middle'];
78
+ type ClickButton = (typeof CLICK_BUTTONS)[number];
79
+ //#endregion
80
+ //#region src/core/recording-export-quality.d.ts
81
+ declare const RECORDING_EXPORT_QUALITIES: readonly ['medium', 'high'];
82
+ type RecordingExportQuality = (typeof RECORDING_EXPORT_QUALITIES)[number];
83
+ //#endregion
84
+ //#region src/core/device-rotation.d.ts
85
+ declare const DEVICE_ROTATIONS: readonly ['portrait', 'portrait-upside-down', 'landscape-left', 'landscape-right'];
86
+ type DeviceRotation = (typeof DEVICE_ROTATIONS)[number];
87
+ //#endregion
88
+ //#region src/core/scroll-gesture.d.ts
89
+ declare const SCROLL_DIRECTIONS: readonly ['up', 'down', 'left', 'right'];
90
+ type ScrollDirection = (typeof SCROLL_DIRECTIONS)[number];
91
+ declare const SWIPE_PRESETS: readonly ['left', 'right', 'left-edge', 'right-edge'];
92
+ type SwipePreset = (typeof SWIPE_PRESETS)[number];
93
+ declare const SWIPE_PATTERNS: readonly ['one-way', 'ping-pong'];
94
+ type SwipePattern = (typeof SWIPE_PATTERNS)[number];
95
+ type TransformGestureParams = {
96
+ x: number;
97
+ y: number;
98
+ dx: number;
99
+ dy: number;
100
+ scale: number;
101
+ degrees: number;
102
+ durationMs?: number;
103
+ };
104
+ //#endregion
105
+ //#region src/alert-contract.d.ts
106
+ declare const ALERT_ACTIONS: readonly ['get', 'accept', 'dismiss', 'wait'];
107
+ type AlertAction = (typeof ALERT_ACTIONS)[number];
108
+ //#endregion
109
+ //#region src/core/session-surface.d.ts
110
+ declare const SESSION_SURFACES: readonly ['app', 'frontmost-app', 'desktop', 'menubar'];
111
+ type SessionSurface = (typeof SESSION_SURFACES)[number];
112
+ //#endregion
113
+ //#region src/utils/screenshot-result.d.ts
114
+ type ScreenshotResultData = {
115
+ path?: string;
116
+ overlayRefs?: ScreenshotOverlayRef[];
117
+ };
118
+ //#endregion
119
+ //#region src/contracts/interaction.d.ts
120
+ type ResolvedTarget = {
121
+ kind: 'selector';
122
+ selector: string;
123
+ } | {
124
+ kind: 'ref';
125
+ ref: string;
126
+ };
127
+ type ResolvedInteractionTarget = {
128
+ kind: 'point';
129
+ point: Point;
130
+ preActionNodes?: SnapshotNode[];
131
+ } | {
132
+ kind: 'ref';
133
+ point?: Point;
134
+ target: Extract<ResolvedTarget, {
135
+ kind: 'ref';
136
+ }>;
137
+ node?: SnapshotNode;
138
+ selectorChain?: string[];
139
+ refLabel?: string;
140
+ targetHittable?: boolean;
141
+ hint?: string;
142
+ preActionNodes?: SnapshotNode[];
143
+ } | {
144
+ kind: 'selector';
145
+ point: Point;
146
+ target: Extract<ResolvedTarget, {
147
+ kind: 'selector';
148
+ }>;
149
+ node: SnapshotNode;
150
+ selectorChain: string[];
151
+ refLabel?: string;
152
+ targetHittable?: boolean;
153
+ hint?: string;
154
+ preActionNodes?: SnapshotNode[];
155
+ };
156
+ /**
157
+ * Opt-in (`--verify`) cheap post-condition evidence for mutating interaction
158
+ * commands (#1047). `digest`/`nodeCount`/`interactiveNodeCount` describe a single
159
+ * interactive-only capture taken right after the action; `changedFromBefore`
160
+ * compares that digest against the pre-action capture the resolution path already
161
+ * held, so no extra device round trip is spent beyond the one verify capture.
162
+ * `changedFromBefore: false` is evidence, not failure — the command still
163
+ * succeeded.
164
+ */
165
+ type InteractionEvidence = {
166
+ foregroundApp?: string;
167
+ nodeCount: number;
168
+ interactiveNodeCount: number;
169
+ digest: string;
170
+ changedFromBefore: boolean;
171
+ };
172
+ type SettleDiffLine = {
173
+ kind: 'added' | 'removed';
174
+ text: string;
175
+ /**
176
+ * Plain ref body (`e12`) for ADDED lines: minted from the settled tree that
177
+ * became the stored session snapshot, so it is immediately actionable and
178
+ * lets the MCP layer pin it at `refsGeneration`. Removed lines never carry
179
+ * one their refs name nodes of the replaced tree.
180
+ */
181
+ ref?: string;
182
+ };
183
+ type SettleObservation = {
184
+ settled: boolean;
185
+ waitedMs: number;
186
+ captures: number;
187
+ quietMs: number;
188
+ timeoutMs: number;
189
+ /**
190
+ * The session's snapshot generation after the settled tree became the stored
191
+ * snapshot (#1076 versioned refs). Attached by the daemon response layer
192
+ * when `diff` is present: added lines carry refs minted from that tree, so
193
+ * the response is ref-issuing — the MCP layer merges per-ref pins from it
194
+ * exactly like snapshot/find responses.
195
+ */
196
+ refsGeneration?: number;
197
+ /**
198
+ * Digest response view only: capped added-line refs preserved without the
199
+ * verbose diff line text, so MCP can still pin refs when `diff.lines` is
200
+ * intentionally omitted.
201
+ */
202
+ refs?: Array<{
203
+ ref: string;
204
+ }>;
205
+ diff?: {
206
+ summary: {
207
+ additions: number;
208
+ removals: number;
209
+ unchanged: number;
210
+ };
211
+ lines: SettleDiffLine[]; /** Present (true) when lines were capped to the response bound. */
212
+ truncated?: boolean;
213
+ };
214
+ hint?: string;
215
+ };
216
+ type PressCommandResult = ResolvedInteractionTarget & {
217
+ backendResult?: Record<string, unknown>;
218
+ message?: string;
219
+ warning?: string;
220
+ evidence?: InteractionEvidence;
221
+ settle?: SettleObservation;
222
+ };
223
+ type FillCommandResult = ResolvedInteractionTarget & {
224
+ text: string;
225
+ warning?: string;
226
+ backendResult?: Record<string, unknown>;
227
+ message?: string;
228
+ evidence?: InteractionEvidence;
229
+ settle?: SettleObservation;
230
+ };
231
+ type LongPressCommandResult = ResolvedInteractionTarget & {
232
+ durationMs?: number;
233
+ backendResult?: Record<string, unknown>;
234
+ message?: string;
235
+ warning?: string;
236
+ settle?: SettleObservation;
237
+ };
238
+ //#endregion
239
+ //#region src/commands/interaction/runtime/gestures.d.ts
240
+ declare const SCROLL_INPUT_DIRECTIONS: readonly ['up', 'down', 'left', 'right', 'top', 'bottom'];
241
+ type ScrollInputDirection = (typeof SCROLL_INPUT_DIRECTIONS)[number];
242
+ //#endregion
243
+ //#region src/contracts/logs.d.ts
244
+ declare const LOG_ACTION_VALUES: readonly ['path', 'start', 'stop', 'doctor', 'mark', 'clear'];
245
+ type LogAction = (typeof LOG_ACTION_VALUES)[number];
246
+ //#endregion
247
+ //#region src/target-shutdown-contract.d.ts
248
+ type TargetShutdownResult = {
249
+ success: boolean;
250
+ exitCode: number;
251
+ stdout: string;
252
+ stderr: string;
253
+ error?: NormalizedError;
254
+ };
255
+ //#endregion
256
+ //#region src/contracts/perf.d.ts
257
+ declare const PERF_AREA_VALUES: readonly ['metrics', 'frames', 'memory', 'cpu', 'trace'];
258
+ declare const PERF_ACTION_VALUES: readonly ['sample', 'snapshot', 'start', 'stop', 'report'];
259
+ declare const PERF_SUBJECT_VALUES: readonly ['profile'];
260
+ declare const PERF_KIND_VALUES: readonly ['xctrace', 'simpleperf', 'perfetto', 'android-hprof', 'memgraph'];
261
+ type PerfArea = (typeof PERF_AREA_VALUES)[number];
262
+ type PerfAction = (typeof PERF_ACTION_VALUES)[number];
263
+ type PerfSubject = (typeof PERF_SUBJECT_VALUES)[number];
264
+ type PerfKind = (typeof PERF_KIND_VALUES)[number];
265
+ //#endregion
266
+ //#region src/contracts/device.d.ts
267
+ /**
268
+ * Closed result of the `boot` command. Mirrors the daemon handler's only
269
+ * success return EXACTLY (src/daemon/handlers/session-state.ts) the fixed
270
+ * object literal `{ platform, target, device, id, kind, booted }` plus the
271
+ * additive `appleOs` discriminant, emitted only for Apple devices.
272
+ */
273
+ type BootCommandResult = {
274
+ platform: PublicPlatform;
275
+ target: DeviceTarget; /** Human-readable device name (`device.name`). */
276
+ device: string; /** Stable device id (`device.id`). */
277
+ id: string;
278
+ kind: DeviceKind; /** Always `true` on the success path. */
279
+ booted: true;
280
+ /**
281
+ * Additive Apple-OS discriminant (`device.appleOs`): iPhone/iPad/tvOS/visionOS/macOS.
282
+ * Present only for Apple devices; absent for non-Apple platforms. `platform` stays the
283
+ * leaf (`ios`/`macos`) this is an extra field, not a replacement.
284
+ */
285
+ appleOs?: AppleOS;
286
+ };
287
+ /**
288
+ * Closed result of the `shutdown` command. Mirrors the daemon handler's success
289
+ * return EXACTLY (src/daemon/handlers/session-state.ts) — the fixed object
290
+ * literal `{ platform, target, device, id, kind, shutdown }` plus the additive
291
+ * `appleOs` discriminant (Apple devices only). The `shutdown` field is the raw
292
+ * {@link TargetShutdownResult} from `shutdownDeviceTarget`.
293
+ */
294
+ type ShutdownCommandResult = {
295
+ platform: PublicPlatform;
296
+ target: DeviceTarget; /** Human-readable device name (`device.name`). */
297
+ device: string; /** Stable device id (`device.id`). */
298
+ id: string;
299
+ kind: DeviceKind;
300
+ shutdown: TargetShutdownResult;
301
+ /**
302
+ * Additive Apple-OS discriminant (`device.appleOs`): iPhone/iPad/tvOS/visionOS/macOS.
303
+ * Present only for Apple devices; absent for non-Apple platforms. `platform` stays the
304
+ * leaf (`ios`/`macos`) — this is an extra field, not a replacement.
305
+ */
306
+ appleOs?: AppleOS;
307
+ };
308
+ //#endregion
309
+ //#region src/contracts/viewport.d.ts
310
+ /**
311
+ * Closed result of the `viewport` command. Mirrors the dispatch handler's return
312
+ * EXACTLY (src/core/dispatch.ts `handleViewportCommand`) — `{ width, height }`
313
+ * plus the always-present `successText` message. The generic dispatch path
314
+ * returns this object unchanged (viewport has no Android dialog guard, so no
315
+ * `warning` is ever appended), so the shape is intentionally closed.
316
+ */
317
+ type ViewportCommandResult = {
318
+ width: number;
319
+ height: number;
320
+ message: string;
321
+ };
322
+ //#endregion
323
+ //#region src/contracts/navigation.d.ts
324
+ /**
325
+ * Closed results of the navigation/global action commands. Each mirrors the
326
+ * dispatch handler's literal return EXACTLY (src/core/dispatch.ts
327
+ * `DISPATCH_HANDLERS`): a fixed `action` discriminant plus the always-present
328
+ * `successText` message (the handlers always pass a non-empty message, so it is
329
+ * required here). The handlers spread nothing else, so the shapes are closed —
330
+ * consistent with the `viewport` contract, the generic-dispatch Android
331
+ * dialog-recovery `warning` annotation is intentionally not part of the contract.
332
+ */
333
+ /** `home` — `{ action: 'home', message: 'Home' }`. */
334
+ type HomeCommandResult = {
335
+ action: 'home';
336
+ message: string;
337
+ };
338
+ /** `back` — `{ action: 'back', mode, message: 'Back' }`; `mode` defaults to `'in-app'`. */
339
+ type BackCommandResult = {
340
+ action: 'back';
341
+ mode: BackMode;
342
+ message: string;
343
+ };
344
+ /** `rotate` `{ action: 'rotate', orientation, message: 'Rotated to <orientation>' }`. */
345
+ type RotateCommandResult = {
346
+ action: 'rotate';
347
+ orientation: DeviceRotation;
348
+ message: string;
349
+ };
350
+ /** `app-switcher` `{ action: 'app-switcher', message: 'Opened app switcher' }`. */
351
+ type AppSwitcherCommandResult = {
352
+ action: 'app-switcher';
353
+ message: string;
354
+ };
355
+ //#endregion
356
+ //#region src/contracts/clipboard.d.ts
357
+ /**
358
+ * Closed result of the `clipboard` command. Mirrors the dispatch handler's
359
+ * literal return EXACTLY (src/core/dispatch.ts `handleClipboardCommand`): a
360
+ * discriminated union on `action`. `read` returns the clipboard `text`; `write`
361
+ * reports the written `textLength` plus the `successText` message. The handler
362
+ * spreads nothing else, so each branch is closed.
363
+ */
364
+ type ClipboardCommandResult = {
365
+ action: 'read';
366
+ text: string;
367
+ } | {
368
+ action: 'write';
369
+ textLength: number;
370
+ message: string;
371
+ };
372
+ //#endregion
373
+ //#region src/contracts/app-state.d.ts
374
+ /**
375
+ * Closed result of the `appstate` command, grounded in the daemon handler's
376
+ * success returns (src/daemon/handlers/session-state.ts `handleAppStateCommand`).
377
+ * A discriminated union on `platform`:
378
+ * - Apple (`ios` / `macos`) session state, with iOS-only device locators that
379
+ * the previous hand-written mirror omitted; and
380
+ * - Android foreground `package` / `activity`.
381
+ *
382
+ * The handler returns one of these fixed objects (errors take the `ok: false`
383
+ * path), so each branch is closed.
384
+ */
385
+ type AppStateCommandResult = {
386
+ platform: 'ios' | 'macos';
387
+ appName: string;
388
+ appBundleId?: string;
389
+ source: 'session';
390
+ surface: SessionSurface; /** iOS only — the session device's UDID. */
391
+ device_udid?: string; /** iOS only — the simulator set path, or `null` when unknown. */
392
+ ios_simulator_device_set?: string | null;
393
+ } | {
394
+ platform: 'android';
395
+ package: string;
396
+ activity: string;
397
+ };
398
+ //#endregion
399
+ //#region src/contracts/keyboard.d.ts
400
+ /**
401
+ * Closed result of the `keyboard` command, grounded in the dispatch handlers'
402
+ * literal returns (src/core/dispatch.ts `handleAndroidKeyboardCommand` /
403
+ * `handleIosKeyboardCommand`).
404
+ *
405
+ * `platform` and `action` are always present; the remaining fields appear per
406
+ * branch (Android `status`/`dismiss` carry the keyboard-state fields; `enter`
407
+ * and iOS `dismiss` carry a `message`). It is kept as a flat closed shape rather
408
+ * than a five-way `platform`×`action` union because the per-branch field sets
409
+ * overlap heavily and the underlying Android keyboard-state types live in the
410
+ * platform layer (below the public contract). The `Record` index signature of
411
+ * the previous hand-written mirror is dropped, and the spurious `| null`s are
412
+ * removed (the handler never returns `null` for these).
413
+ */
414
+ type KeyboardCommandResult = {
415
+ platform: 'android' | 'ios';
416
+ action: 'status' | 'dismiss' | 'enter';
417
+ visible?: boolean;
418
+ wasVisible?: boolean;
419
+ dismissed?: boolean;
420
+ attempts?: number;
421
+ inputType?: string;
422
+ type?: 'text' | 'number' | 'email' | 'phone' | 'password' | 'datetime' | 'unknown';
423
+ inputMethodPackage?: string;
424
+ focusedPackage?: string;
425
+ focusedResourceId?: string;
426
+ inputOwner?: 'app' | 'ime' | 'unknown';
427
+ message?: string;
428
+ };
429
+ //#endregion
430
+ //#region src/core/command-descriptor/command-result.d.ts
431
+ /**
432
+ * The additive typed-result spine (ADR-0008, Phase 1 step 6).
433
+ *
434
+ * Maps a command name to the per-command result type from `src/contracts/*`. It
435
+ * is SEEDED, not exhaustive: a command is listed here only once its accurate,
436
+ * closed result shape lives in the contracts layer. Commands whose daemon
437
+ * handler spreads dynamic/Record data (screenshot overlays, gesture
438
+ * visualization, perf, logs, …) are deliberately omitted rather than given an
439
+ * invented shape.
440
+ *
441
+ * Batches 1-2 wired `boot` / `shutdown` / `viewport` and the navigation/action
442
+ * commands `home` / `back` / `rotate` / `app-switcher` alongside the seed
443
+ * interaction trio. Batch 3 adds `clipboard` (a closed `read`/`write` union) and
444
+ * `appstate` (a closed `platform` union — Apple session state with the iOS-only
445
+ * device locators, or Android package/activity). Batch 4 adds `keyboard` (a
446
+ * closed flat shape). Each entry is grounded in a
447
+ * re-read of the handler's literal return; see the per-type docstrings.
448
+ */
449
+ interface CommandResultMap {
450
+ press: PressCommandResult;
451
+ fill: FillCommandResult;
452
+ longpress: LongPressCommandResult;
453
+ boot: BootCommandResult;
454
+ shutdown: ShutdownCommandResult;
455
+ viewport: ViewportCommandResult;
456
+ home: HomeCommandResult;
457
+ back: BackCommandResult;
458
+ rotate: RotateCommandResult;
459
+ 'app-switcher': AppSwitcherCommandResult;
460
+ clipboard: ClipboardCommandResult;
461
+ appstate: AppStateCommandResult;
462
+ keyboard: KeyboardCommandResult;
463
+ }
464
+ /**
465
+ * The typed result for a command named `N`. Seeded commands resolve to their
466
+ * contract result type from {@link CommandResultMap}; every other (unmigrated)
467
+ * command falls back to the untyped `Record<string, unknown>` bag. That default
468
+ * branch is what keeps the mapping total over every command name, so consumers
469
+ * can switch to `CommandResult<Name>` without first migrating every command.
470
+ */
471
+ type CommandResult<N extends string> = N extends keyof CommandResultMap ? CommandResultMap[N] : Record<string, unknown>;
472
+ //#endregion
473
+ //#region src/cloud-artifacts.d.ts
474
+ declare const CLOUD_ARTIFACT_KINDS: readonly ['video', 'appium-log', 'device-log', 'automation-log', 'provider-session', 'raw'];
475
+ type CloudArtifactKind = (typeof CLOUD_ARTIFACT_KINDS)[number];
476
+ type CloudArtifactAvailability = 'ready' | 'pending' | 'unavailable' | 'expired';
477
+ type CloudArtifact = {
478
+ provider: string;
479
+ kind: CloudArtifactKind;
480
+ name: string;
481
+ url?: string;
482
+ providerSessionId?: string;
483
+ providerArtifactId?: string;
484
+ contentType?: string;
485
+ extension?: string;
486
+ availability?: CloudArtifactAvailability;
487
+ metadata?: Record<string, unknown>;
488
+ };
489
+ type CloudArtifactsStatus = 'ready' | 'pending' | 'unavailable';
490
+ type CloudArtifactsResult = {
491
+ provider: string;
492
+ status: CloudArtifactsStatus;
493
+ cloudArtifacts: CloudArtifact[];
494
+ providerSessionId?: string;
495
+ message?: string;
496
+ };
497
+ type DaemonArtifactInventoryEntry = {
498
+ id: string;
499
+ artifactType?: DaemonArtifactType;
500
+ filename: string;
501
+ mimeType: string;
502
+ sizeBytes: number;
503
+ createdAt: string;
504
+ expiresAt: string;
505
+ };
506
+ type DaemonArtifactsResult = {
507
+ source: 'daemon';
508
+ status: 'ready';
509
+ artifacts: DaemonArtifactInventoryEntry[];
510
+ message?: string;
511
+ };
512
+ type AgentArtifactsResult = CloudArtifactsResult | DaemonArtifactsResult;
513
+ type CloudProviderSessionResult = {
514
+ provider?: string;
515
+ providerSessionId?: string;
516
+ cloudArtifacts?: CloudArtifactsResult;
517
+ } & Record<string, unknown>;
518
+ //#endregion
519
+ //#region src/client/client-types.d.ts
520
+ type AgentDeviceDaemonTransport = (req: Omit<DaemonRequest, 'token'>) => Promise<DaemonResponse>;
521
+ type AgentDeviceClientConfig = RemoteConnectionProfileFields & CloudProviderProfileFields & {
522
+ session?: string;
523
+ lockPolicy?: DaemonLockPolicy;
524
+ lockPlatform?: PlatformSelector;
525
+ requestId?: string;
526
+ sessionIsolation?: SessionIsolationMode;
527
+ leaseBackend?: LeaseBackend;
528
+ leaseTtlMs?: number;
529
+ runtime?: SessionRuntimeHints;
530
+ cwd?: string;
531
+ debug?: boolean;
532
+ cost?: boolean;
533
+ responseLevel?: ResponseLevel;
534
+ iosXctestrunFile?: string;
535
+ iosXctestDerivedDataPath?: string;
536
+ iosXctestEnvDir?: string;
537
+ };
538
+ 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' | 'awsProjectArn' | 'awsDeviceArn' | 'awsAppArn' | 'awsRegion' | 'awsInteractionMode' | 'leaseTtlMs' | 'cwd' | 'debug' | 'cost' | 'responseLevel' | 'iosXctestrunFile' | 'iosXctestDerivedDataPath' | 'iosXctestEnvDir'>;
539
+ type AgentDeviceIdentifiers = {
540
+ session?: string;
541
+ deviceId?: string;
542
+ deviceName?: string;
543
+ udid?: string;
544
+ serial?: string;
545
+ appId?: string;
546
+ appBundleId?: string;
547
+ package?: string;
548
+ };
549
+ type AgentDeviceSelectionOptions = {
550
+ platform?: PlatformSelector;
551
+ target?: DeviceTarget;
552
+ device?: string;
553
+ udid?: string;
554
+ serial?: string;
555
+ iosSimulatorDeviceSet?: string;
556
+ androidDeviceAllowlist?: string;
557
+ };
558
+ type AgentDeviceDevice = {
559
+ platform: PublicPlatform;
560
+ target: DeviceTarget;
561
+ kind: DeviceKind;
562
+ id: string;
563
+ name: string;
564
+ booted?: boolean;
565
+ /**
566
+ * Additive Apple-OS discriminant (iPhone/iPad/tvOS/visionOS/macOS). Present only for
567
+ * Apple devices; `platform` still carries the leaf (`ios`/`macos`).
568
+ */
569
+ appleOs?: AppleOS;
570
+ identifiers: AgentDeviceIdentifiers;
571
+ ios?: {
572
+ udid: string;
573
+ };
574
+ android?: {
575
+ serial: string;
576
+ };
577
+ };
578
+ type AgentDeviceCapabilitiesResult = {
579
+ device: AgentDeviceDevice;
580
+ availableCommands: string[];
581
+ };
582
+ type AgentDeviceSessionDevice = {
583
+ platform: PublicPlatform;
584
+ target: DeviceTarget;
585
+ id: string;
586
+ name: string;
587
+ /**
588
+ * Additive Apple-OS discriminant (iPhone/iPad/tvOS/visionOS/macOS). Present only for
589
+ * Apple devices; `platform` still carries the leaf (`ios`/`macos`).
590
+ */
591
+ appleOs?: AppleOS;
592
+ identifiers: AgentDeviceIdentifiers;
593
+ ios?: {
594
+ udid: string;
595
+ simulatorSetPath?: string | null;
596
+ };
597
+ android?: {
598
+ serial: string;
599
+ };
600
+ };
601
+ type AgentDeviceSession = {
602
+ name: string;
603
+ createdAt: number;
604
+ sessionStateDir?: string;
605
+ runnerLogPath?: string;
606
+ device: AgentDeviceSessionDevice;
607
+ identifiers: AgentDeviceIdentifiers;
608
+ };
609
+ type StartupPerfSample = {
610
+ durationMs: number;
611
+ measuredAt: string;
612
+ method: string;
613
+ appTarget?: string;
614
+ appBundleId?: string;
615
+ };
616
+ type SessionCloseResult = {
617
+ session: string;
618
+ shutdown?: TargetShutdownResult;
619
+ provider?: CloudProviderSessionResult;
620
+ identifiers: AgentDeviceIdentifiers;
621
+ };
622
+ type CloudArtifactsOptions = AgentDeviceRequestOverrides & {
623
+ provider?: string;
624
+ providerSessionId?: string;
625
+ };
626
+ type AppInstallOptions = AgentDeviceRequestOverrides & AgentDeviceSelectionOptions & {
627
+ app?: string;
628
+ appPath: string;
629
+ };
630
+ type AppDeployOptions = AgentDeviceRequestOverrides & AgentDeviceSelectionOptions & {
631
+ app: string;
632
+ appPath: string;
633
+ };
634
+ type AppDeployResult = {
635
+ app: string;
636
+ appPath: string;
637
+ platform: PublicPlatform;
638
+ appId?: string;
639
+ bundleId?: string;
640
+ package?: string;
641
+ identifiers: AgentDeviceIdentifiers;
642
+ };
643
+ type AppOpenOptions = AgentDeviceRequestOverrides & AgentDeviceSelectionOptions & {
644
+ app?: string;
645
+ url?: string;
646
+ surface?: SessionSurface;
647
+ activity?: string;
648
+ launchConsole?: string;
649
+ launchArgs?: string[];
650
+ relaunch?: boolean;
651
+ saveScript?: boolean | string;
652
+ deviceHub?: boolean;
653
+ noRecord?: boolean;
654
+ runtime?: SessionRuntimeHints;
655
+ };
656
+ type AppOpenResult = {
657
+ session: string;
658
+ sessionStateDir?: string;
659
+ runnerLogPath?: string;
660
+ requestLogPath?: string;
661
+ appName?: string;
662
+ appBundleId?: string;
663
+ appId?: string;
664
+ startup?: StartupPerfSample;
665
+ runtime?: SessionRuntimeHints;
666
+ device?: AgentDeviceSessionDevice;
667
+ identifiers: AgentDeviceIdentifiers;
668
+ };
669
+ type AppCloseOptions = AgentDeviceRequestOverrides & {
670
+ app?: string;
671
+ shutdown?: boolean;
672
+ };
673
+ type AppCloseResult = {
674
+ session: string;
675
+ closedApp?: string;
676
+ shutdown?: TargetShutdownResult;
677
+ identifiers: AgentDeviceIdentifiers;
678
+ };
679
+ type AppInstallFromSourceOptions = AgentDeviceRequestOverrides & AgentDeviceSelectionOptions & {
680
+ source: DaemonInstallSource;
681
+ retainPaths?: boolean;
682
+ retentionMs?: number;
683
+ };
684
+ type AppInstallFromSourceResult = {
685
+ appName?: string;
686
+ appId?: string;
687
+ bundleId?: string;
688
+ packageName?: string;
689
+ launchTarget: string;
690
+ installablePath?: string;
691
+ archivePath?: string;
692
+ materializationId?: string;
693
+ materializationExpiresAt?: string;
694
+ identifiers: AgentDeviceIdentifiers;
695
+ };
696
+ type AppListOptions = AgentDeviceRequestOverrides & AgentDeviceSelectionOptions & {
697
+ appsFilter?: AppsFilter;
698
+ };
699
+ type MaterializationReleaseOptions = AgentDeviceRequestOverrides & {
700
+ materializationId: string;
701
+ };
702
+ type MaterializationReleaseResult = {
703
+ released: boolean;
704
+ materializationId: string;
705
+ identifiers: AgentDeviceIdentifiers;
706
+ };
707
+ type Lease = {
708
+ leaseId: string;
709
+ tenantId: string;
710
+ runId: string;
711
+ backend: LeaseBackend;
712
+ leaseProvider?: string;
713
+ deviceKey?: string;
714
+ clientId?: string;
715
+ createdAt?: number;
716
+ heartbeatAt?: number;
717
+ expiresAt?: number;
718
+ };
719
+ type LeaseOptions = AgentDeviceRequestOverrides & AgentDeviceSelectionOptions & {
720
+ ttlMs?: number;
721
+ };
722
+ type LeaseAllocateOptions = LeaseOptions & {
723
+ tenant: string;
724
+ runId: string;
725
+ leaseBackend?: LeaseBackend;
726
+ leaseProvider?: string;
727
+ provider?: string;
728
+ deviceKey?: string;
729
+ clientId?: string;
730
+ };
731
+ type LeaseScopedOptions = LeaseOptions & {
732
+ tenant?: string;
733
+ runId?: string;
734
+ leaseId: string;
735
+ leaseBackend?: LeaseBackend;
736
+ leaseProvider?: string;
737
+ provider?: string;
738
+ deviceKey?: string;
739
+ clientId?: string;
740
+ };
741
+ type MetroPrepareOptions = {
742
+ projectRoot?: string;
743
+ kind?: MetroPrepareKind;
744
+ publicBaseUrl?: string;
745
+ proxyBaseUrl?: string;
746
+ bearerToken?: string;
747
+ bridgeScope?: MetroBridgeScope;
748
+ launchUrl?: string;
749
+ companionProfileKey?: string;
750
+ companionConsumerKey?: string;
751
+ port?: number;
752
+ listenHost?: string;
753
+ statusHost?: string;
754
+ startupTimeoutMs?: number;
755
+ probeTimeoutMs?: number;
756
+ reuseExisting?: boolean;
757
+ installDependenciesIfNeeded?: boolean;
758
+ runtimeFilePath?: string;
759
+ logPath?: string;
760
+ };
761
+ type MetroPrepareResult = PrepareMetroRuntimeResult;
762
+ type MetroReloadOptions = {
763
+ metroHost?: string;
764
+ metroPort?: number;
765
+ bundleUrl?: string;
766
+ timeoutMs?: number;
767
+ };
768
+ type MetroReloadResult = ReloadMetroResult;
769
+ type CaptureSnapshotOptions = AgentDeviceRequestOverrides & AgentDeviceSelectionOptions & {
770
+ interactiveOnly?: boolean;
771
+ depth?: number;
772
+ scope?: string;
773
+ raw?: boolean;
774
+ forceFull?: boolean;
775
+ timeoutMs?: number;
776
+ };
777
+ type CaptureSnapshotResult = {
778
+ nodes: SnapshotNode[];
779
+ truncated: boolean;
780
+ appName?: string;
781
+ appBundleId?: string;
782
+ visibility?: SnapshotVisibility;
783
+ unchanged?: SnapshotUnchanged;
784
+ snapshotDiagnostics?: SnapshotDiagnosticsSummary;
785
+ identifiers: AgentDeviceIdentifiers;
786
+ } & PublicSnapshotCaptureAnnotations;
787
+ type CaptureScreenshotOptions = AgentDeviceRequestOverrides & {
788
+ path?: string;
789
+ overlayRefs?: boolean;
790
+ fullscreen?: boolean;
791
+ maxSize?: number;
792
+ stabilize?: boolean;
793
+ normalizeStatusBar?: boolean;
794
+ surface?: SessionSurface;
795
+ };
796
+ type CaptureScreenshotResult = ScreenshotResultData & {
797
+ path: string;
798
+ identifiers: AgentDeviceIdentifiers;
799
+ };
800
+ type DeviceCommandBaseOptions = AgentDeviceRequestOverrides & AgentDeviceSelectionOptions;
801
+ type WaitCommandTarget = {
802
+ durationMs: number;
803
+ text?: never;
804
+ ref?: never;
805
+ selector?: never;
806
+ stable?: never;
807
+ quietMs?: never;
808
+ timeoutMs?: never;
809
+ } | (SelectorSnapshotCommandOptions & {
810
+ text: string;
811
+ durationMs?: never;
812
+ ref?: never;
813
+ selector?: never;
814
+ stable?: never;
815
+ quietMs?: never;
816
+ timeoutMs?: number;
817
+ }) | (SelectorSnapshotCommandOptions & {
818
+ ref: string;
819
+ durationMs?: never;
820
+ text?: never;
821
+ selector?: never;
822
+ stable?: never;
823
+ quietMs?: never;
824
+ timeoutMs?: number;
825
+ }) | (SelectorSnapshotCommandOptions & {
826
+ selector: string;
827
+ durationMs?: never;
828
+ text?: never;
829
+ ref?: never;
830
+ stable?: never;
831
+ quietMs?: never;
832
+ timeoutMs?: number;
833
+ }) | (SelectorSnapshotCommandOptions & {
834
+ stable: true;
835
+ durationMs?: never;
836
+ text?: never;
837
+ ref?: never;
838
+ selector?: never;
839
+ quietMs?: number;
840
+ timeoutMs?: number;
841
+ });
842
+ type WaitCommandOptions = DeviceCommandBaseOptions & WaitCommandTarget;
843
+ type AlertCommandOptions = DeviceCommandBaseOptions & {
844
+ action?: AlertAction;
845
+ timeoutMs?: number;
846
+ };
847
+ type AppStateCommandOptions = DeviceCommandBaseOptions;
848
+ type BackCommandOptions = DeviceCommandBaseOptions & {
849
+ mode?: BackMode;
850
+ };
851
+ type HomeCommandOptions = DeviceCommandBaseOptions;
852
+ type RotateCommandOptions = DeviceCommandBaseOptions & {
853
+ orientation: DeviceRotation;
854
+ };
855
+ type AppSwitcherCommandOptions = DeviceCommandBaseOptions;
856
+ type KeyboardCommandOptions = DeviceCommandBaseOptions & {
857
+ action?: 'status' | 'dismiss' | 'enter' | 'return';
858
+ };
859
+ type ClipboardCommandOptions = (DeviceCommandBaseOptions & {
860
+ action: 'read';
861
+ }) | (DeviceCommandBaseOptions & {
862
+ action: 'write';
863
+ text: string;
864
+ });
865
+ type ReactNativeCommandOptions = DeviceCommandBaseOptions & {
866
+ action: 'dismiss-overlay';
867
+ };
868
+ type PrepareCommandOptions = DeviceCommandBaseOptions & {
869
+ action: 'ios-runner';
870
+ timeoutMs?: number;
871
+ };
872
+ type DoctorCommandOptions = DeviceCommandBaseOptions & {
873
+ targetApp?: string;
874
+ remote?: boolean;
875
+ };
876
+ type ViewportCommandOptions = DeviceCommandBaseOptions & {
877
+ width: number;
878
+ height: number;
879
+ };
880
+ type AgentDeviceCommandClient = {
881
+ wait: (options: WaitCommandOptions) => Promise<CommandRequestResult>;
882
+ alert: (options?: AlertCommandOptions) => Promise<CommandRequestResult>;
883
+ appState: (options?: AppStateCommandOptions) => Promise<CommandResult<'appstate'>>;
884
+ back: (options?: BackCommandOptions) => Promise<CommandResult<'back'>>;
885
+ home: (options?: HomeCommandOptions) => Promise<CommandResult<'home'>>;
886
+ rotate: (options: RotateCommandOptions) => Promise<CommandResult<'rotate'>>;
887
+ appSwitcher: (options?: AppSwitcherCommandOptions) => Promise<CommandResult<'app-switcher'>>;
888
+ keyboard: (options?: KeyboardCommandOptions) => Promise<CommandResult<'keyboard'>>;
889
+ clipboard: (options: ClipboardCommandOptions) => Promise<CommandResult<'clipboard'>>;
890
+ reactNative: (options: ReactNativeCommandOptions) => Promise<CommandRequestResult>;
891
+ doctor: (options?: DoctorCommandOptions) => Promise<CommandRequestResult>;
892
+ /**
893
+ * JSON prepare results include timing.additiveParts for additive wall-clock phases.
894
+ * Top-level buildMs/connectMs/healthCheckMs are diagnostics and may overlap.
895
+ */
896
+ prepare: (options: PrepareCommandOptions) => Promise<CommandRequestResult>;
897
+ viewport: (options: ViewportCommandOptions) => Promise<CommandResult<'viewport'>>;
898
+ };
899
+ type SelectorSnapshotCommandOptions = Pick<CaptureSnapshotOptions, 'depth' | 'scope' | 'raw'>;
900
+ type FindSnapshotCommandOptions = Pick<CaptureSnapshotOptions, 'depth' | 'raw'>;
901
+ type PointTarget = {
902
+ x: number;
903
+ y: number;
904
+ ref?: never;
905
+ selector?: never;
906
+ label?: never;
907
+ };
908
+ type RefTarget = {
909
+ ref: string;
910
+ label?: string;
911
+ x?: never;
912
+ y?: never;
913
+ selector?: never;
914
+ };
915
+ type SelectorTarget = {
916
+ selector: string;
917
+ x?: never;
918
+ y?: never;
919
+ ref?: never;
920
+ label?: never;
921
+ };
922
+ type InteractionTarget = PointTarget | RefTarget | SelectorTarget;
923
+ type ElementTarget = RefTarget | SelectorTarget;
924
+ type RepeatedPressOptions = {
925
+ count?: number;
926
+ intervalMs?: number;
927
+ holdMs?: number;
928
+ jitterPx?: number;
929
+ doubleTap?: boolean;
930
+ };
931
+ type DeviceBootOptions = DeviceCommandBaseOptions & {
932
+ headless?: boolean;
933
+ };
934
+ type DeviceShutdownOptions = DeviceCommandBaseOptions;
935
+ type AppPushOptions = DeviceCommandBaseOptions & {
936
+ app: string;
937
+ payload: string | Record<string, unknown>;
938
+ };
939
+ type AppTriggerEventOptions = DeviceCommandBaseOptions & {
940
+ event: string;
941
+ payload?: Record<string, unknown>;
942
+ };
943
+ type CaptureDiffOptions = DeviceCommandBaseOptions & Pick<CaptureSnapshotOptions, 'interactiveOnly' | 'depth' | 'scope' | 'raw'> & {
944
+ kind: 'snapshot';
945
+ out?: string;
946
+ };
947
+ /**
948
+ * Opt-in (#1101): after the action, wait for the UI to go quiet and return the
949
+ * settled diff vs the pre-action tree (`settle` on the result) in the same
950
+ * response. Best-effort never fails the action. `settleQuietMs` tunes the
951
+ * quiet window (default 500ms); `timeoutMs` bounds the settle wait (default
952
+ * 10s) when `settle` is true. A bare `timeoutMs` without `settle` is ignored
953
+ * for compatibility; `settleQuietMs` still requires `settle`.
954
+ */
955
+ type SettleCommandOptions = {
956
+ settle?: boolean;
957
+ settleQuietMs?: number;
958
+ timeoutMs?: number;
959
+ };
960
+ type ClickOptions = DeviceCommandBaseOptions & SelectorSnapshotCommandOptions & InteractionTarget & RepeatedPressOptions & SettleCommandOptions & {
961
+ button?: ClickButton;
962
+ /**
963
+ * Opt-in (#1047): return cheap post-action evidence (AX digest, node counts,
964
+ * changedFromBefore) in the response instead of requiring a follow-up
965
+ * snapshot to confirm the action had an effect.
966
+ */
967
+ verify?: boolean;
968
+ };
969
+ type PressOptions = DeviceCommandBaseOptions & SelectorSnapshotCommandOptions & InteractionTarget & RepeatedPressOptions & SettleCommandOptions & {
970
+ verify?: boolean;
971
+ };
972
+ type LongPressOptions = DeviceCommandBaseOptions & SelectorSnapshotCommandOptions & InteractionTarget & SettleCommandOptions & {
973
+ durationMs?: number;
974
+ };
975
+ type SwipeOptions = DeviceCommandBaseOptions & {
976
+ from: {
977
+ x: number;
978
+ y: number;
979
+ };
980
+ to: {
981
+ x: number;
982
+ y: number;
983
+ };
984
+ durationMs?: number;
985
+ count?: number;
986
+ pauseMs?: number;
987
+ pattern?: SwipePattern;
988
+ };
989
+ type PanOptions = DeviceCommandBaseOptions & {
990
+ x: number;
991
+ y: number;
992
+ dx: number;
993
+ dy: number;
994
+ durationMs?: number;
995
+ };
996
+ type FlingOptions = DeviceCommandBaseOptions & {
997
+ direction: ScrollDirection;
998
+ x: number;
999
+ y: number;
1000
+ distance?: number;
1001
+ durationMs?: number;
1002
+ };
1003
+ type SwipeGestureOptions = DeviceCommandBaseOptions & {
1004
+ preset: SwipePreset;
1005
+ durationMs?: number;
1006
+ };
1007
+ type FocusOptions = DeviceCommandBaseOptions & {
1008
+ x: number;
1009
+ y: number;
1010
+ };
1011
+ type TypeTextOptions = DeviceCommandBaseOptions & {
1012
+ text: string;
1013
+ delayMs?: number;
1014
+ };
1015
+ type FillOptions = DeviceCommandBaseOptions & SelectorSnapshotCommandOptions & InteractionTarget & SettleCommandOptions & {
1016
+ text: string;
1017
+ delayMs?: number;
1018
+ verify?: boolean;
1019
+ };
1020
+ type ScrollOptions = DeviceCommandBaseOptions & {
1021
+ direction: ScrollInputDirection;
1022
+ amount?: number;
1023
+ pixels?: number;
1024
+ durationMs?: number;
1025
+ };
1026
+ type PinchOptions = DeviceCommandBaseOptions & {
1027
+ scale: number;
1028
+ x?: number;
1029
+ y?: number;
1030
+ };
1031
+ type RotateGestureOptions = DeviceCommandBaseOptions & {
1032
+ degrees: number;
1033
+ x?: number;
1034
+ y?: number;
1035
+ velocity?: number;
1036
+ };
1037
+ type TransformGestureOptions = DeviceCommandBaseOptions & TransformGestureParams;
1038
+ type GetOptions = DeviceCommandBaseOptions & SelectorSnapshotCommandOptions & ElementTarget & {
1039
+ format: 'text' | 'attrs';
1040
+ };
1041
+ type IsTextPredicateOptions = DeviceCommandBaseOptions & SelectorSnapshotCommandOptions & {
1042
+ predicate: 'text';
1043
+ selector: string;
1044
+ value: string;
1045
+ };
1046
+ type IsStatePredicateOptions = DeviceCommandBaseOptions & SelectorSnapshotCommandOptions & {
1047
+ predicate: 'visible' | 'hidden' | 'exists' | 'editable' | 'selected';
1048
+ selector: string;
1049
+ value?: never;
1050
+ };
1051
+ type IsOptions = IsTextPredicateOptions | IsStatePredicateOptions;
1052
+ type FindBaseOptions = DeviceCommandBaseOptions & FindSnapshotCommandOptions & {
1053
+ locator?: FindLocator;
1054
+ query: string;
1055
+ first?: boolean;
1056
+ last?: boolean;
1057
+ };
1058
+ type FindOptions = (FindBaseOptions & {
1059
+ action?: 'click' | 'focus' | 'exists' | 'getText' | 'getAttrs';
1060
+ }) | (FindBaseOptions & {
1061
+ action: 'wait';
1062
+ timeoutMs?: number;
1063
+ }) | (FindBaseOptions & {
1064
+ action: 'fill' | 'type';
1065
+ value: string;
1066
+ });
1067
+ type ReplayRunOptions = AgentDeviceRequestOverrides & AgentDeviceSelectionOptions & {
1068
+ path: string;
1069
+ update?: boolean; /** @deprecated Use backend: 'maestro'. */
1070
+ maestro?: boolean;
1071
+ backend?: string;
1072
+ env?: string[];
1073
+ timeoutMs?: number;
1074
+ };
1075
+ type ReplayTestOptions = AgentDeviceRequestOverrides & AgentDeviceSelectionOptions & {
1076
+ paths: string[];
1077
+ update?: boolean; /** @deprecated Use backend: 'maestro'. */
1078
+ maestro?: boolean;
1079
+ backend?: string;
1080
+ env?: string[];
1081
+ failFast?: boolean;
1082
+ timeoutMs?: number;
1083
+ retries?: number;
1084
+ recordVideo?: boolean;
1085
+ artifactsDir?: string; /** @deprecated Use the CLI --reporter junit:<path> or --report-junit <path>. */
1086
+ reportJunit?: string;
1087
+ shardAll?: number;
1088
+ shardSplit?: number;
1089
+ };
1090
+ type BatchStep = {
1091
+ command: string;
1092
+ input: Record<string, unknown>;
1093
+ runtime?: SessionRuntimeHints;
1094
+ };
1095
+ type BatchRunOptions = AgentDeviceRequestOverrides & {
1096
+ steps: BatchStep[];
1097
+ onError?: 'stop';
1098
+ maxSteps?: number;
1099
+ out?: string;
1100
+ };
1101
+ type PerfOptions = DeviceCommandBaseOptions & {
1102
+ area?: PerfArea;
1103
+ subject?: PerfSubject;
1104
+ action?: PerfAction;
1105
+ kind?: PerfKind;
1106
+ template?: string;
1107
+ out?: string;
1108
+ tracePath?: string;
1109
+ };
1110
+ type LogsOptions = AgentDeviceRequestOverrides & {
1111
+ action?: LogAction;
1112
+ message?: string;
1113
+ restart?: boolean;
1114
+ };
1115
+ type NetworkOptions = AgentDeviceRequestOverrides & {
1116
+ action?: 'dump' | 'log';
1117
+ limit?: number;
1118
+ include?: NetworkIncludeMode;
1119
+ };
1120
+ type AudioOptions = AgentDeviceRequestOverrides & {
1121
+ action?: 'probe';
1122
+ probeAction?: 'start' | 'status' | 'stop';
1123
+ durationMs?: number;
1124
+ bucketMs?: number;
1125
+ };
1126
+ type RecordOptions = AgentDeviceRequestOverrides & {
1127
+ action: 'start' | 'stop';
1128
+ path?: string;
1129
+ fps?: number;
1130
+ maxSize?: number;
1131
+ quality?: RecordingExportQuality;
1132
+ hideTouches?: boolean;
1133
+ };
1134
+ type TraceOptions = AgentDeviceRequestOverrides & {
1135
+ action: 'start' | 'stop';
1136
+ path?: string;
1137
+ };
1138
+ type PermissionTarget = 'camera' | 'microphone' | 'photos' | 'contacts' | 'contacts-limited' | 'notifications' | 'calendar' | 'location' | 'location-always' | 'media-library' | 'motion' | 'reminders' | 'siri' | 'accessibility' | 'screen-recording' | 'input-monitoring';
1139
+ type SettingsUpdateOptions = (DeviceCommandBaseOptions & {
1140
+ setting: 'clear-app-state';
1141
+ state: 'clear';
1142
+ app?: string;
1143
+ }) | (DeviceCommandBaseOptions & {
1144
+ setting: 'wifi' | 'airplane' | 'location';
1145
+ state: 'on' | 'off';
1146
+ }) | (DeviceCommandBaseOptions & {
1147
+ setting: 'location';
1148
+ state: 'set';
1149
+ latitude: number;
1150
+ longitude: number;
1151
+ }) | (DeviceCommandBaseOptions & {
1152
+ setting: 'animations';
1153
+ state: 'on' | 'off';
1154
+ }) | (DeviceCommandBaseOptions & {
1155
+ setting: 'appearance';
1156
+ state: 'light' | 'dark' | 'toggle';
1157
+ }) | (DeviceCommandBaseOptions & {
1158
+ setting: 'faceid' | 'touchid';
1159
+ state: 'match' | 'nonmatch' | 'enroll' | 'unenroll';
1160
+ }) | (DeviceCommandBaseOptions & {
1161
+ setting: 'fingerprint';
1162
+ state: 'match' | 'nonmatch';
1163
+ }) | (DeviceCommandBaseOptions & {
1164
+ setting: 'permission';
1165
+ state: 'grant' | 'deny' | 'reset';
1166
+ permission: PermissionTarget;
1167
+ mode?: 'full' | 'limited';
1168
+ });
1169
+ type CommandRequestResult = DaemonResponseData;
1170
+ type AgentDeviceClient = {
1171
+ command: AgentDeviceCommandClient;
1172
+ devices: {
1173
+ list: (options?: AgentDeviceRequestOverrides & AgentDeviceSelectionOptions) => Promise<AgentDeviceDevice[]>;
1174
+ capabilities: (options?: AgentDeviceRequestOverrides & AgentDeviceSelectionOptions) => Promise<AgentDeviceCapabilitiesResult>;
1175
+ boot: (options?: DeviceBootOptions) => Promise<CommandResult<'boot'>>;
1176
+ shutdown: (options?: DeviceShutdownOptions) => Promise<CommandResult<'shutdown'>>;
1177
+ };
1178
+ sessions: {
1179
+ list: (options?: AgentDeviceRequestOverrides) => Promise<AgentDeviceSession[]>;
1180
+ stateDir: (options?: AgentDeviceRequestOverrides & Pick<AgentDeviceClientConfig, 'stateDir'>) => Promise<string>;
1181
+ close: (options?: AgentDeviceRequestOverrides & {
1182
+ shutdown?: boolean;
1183
+ }) => Promise<SessionCloseResult>;
1184
+ artifacts: (options?: CloudArtifactsOptions) => Promise<AgentArtifactsResult>;
1185
+ };
1186
+ apps: {
1187
+ install: (options: AppInstallOptions) => Promise<AppDeployResult>;
1188
+ reinstall: (options: AppDeployOptions) => Promise<AppDeployResult>;
1189
+ installFromSource: (options: AppInstallFromSourceOptions) => Promise<AppInstallFromSourceResult>;
1190
+ list: (options?: AppListOptions) => Promise<string[]>;
1191
+ open: (options: AppOpenOptions) => Promise<AppOpenResult>;
1192
+ close: (options?: AppCloseOptions) => Promise<AppCloseResult>;
1193
+ push: (options: AppPushOptions) => Promise<CommandRequestResult>;
1194
+ triggerEvent: (options: AppTriggerEventOptions) => Promise<CommandRequestResult>;
1195
+ };
1196
+ materializations: {
1197
+ release: (options: MaterializationReleaseOptions) => Promise<MaterializationReleaseResult>;
1198
+ };
1199
+ leases: {
1200
+ allocate: (options: LeaseAllocateOptions) => Promise<Lease>;
1201
+ heartbeat: (options: LeaseScopedOptions) => Promise<Lease>;
1202
+ release: (options: LeaseScopedOptions) => Promise<{
1203
+ released: boolean;
1204
+ provider?: CloudProviderSessionResult;
1205
+ }>;
1206
+ };
1207
+ metro: {
1208
+ prepare: (options: MetroPrepareOptions) => Promise<MetroPrepareResult>;
1209
+ reload: (options?: MetroReloadOptions) => Promise<MetroReloadResult>;
1210
+ };
1211
+ capture: {
1212
+ snapshot: (options?: CaptureSnapshotOptions) => Promise<CaptureSnapshotResult>;
1213
+ screenshot: (options?: CaptureScreenshotOptions) => Promise<CaptureScreenshotResult>;
1214
+ diff: (options: CaptureDiffOptions) => Promise<CommandRequestResult>;
1215
+ };
1216
+ interactions: {
1217
+ click: (options: ClickOptions) => Promise<CommandRequestResult>;
1218
+ press: (options: PressOptions) => Promise<CommandRequestResult>;
1219
+ longPress: (options: LongPressOptions) => Promise<CommandRequestResult>;
1220
+ swipe: (options: SwipeOptions) => Promise<CommandRequestResult>;
1221
+ pan: (options: PanOptions) => Promise<CommandRequestResult>;
1222
+ fling: (options: FlingOptions) => Promise<CommandRequestResult>;
1223
+ swipeGesture: (options: SwipeGestureOptions) => Promise<CommandRequestResult>;
1224
+ focus: (options: FocusOptions) => Promise<CommandRequestResult>;
1225
+ type: (options: TypeTextOptions) => Promise<CommandRequestResult>;
1226
+ fill: (options: FillOptions) => Promise<CommandRequestResult>;
1227
+ scroll: (options: ScrollOptions) => Promise<CommandRequestResult>;
1228
+ pinch: (options: PinchOptions) => Promise<CommandRequestResult>;
1229
+ rotateGesture: (options: RotateGestureOptions) => Promise<CommandRequestResult>;
1230
+ transformGesture: (options: TransformGestureOptions) => Promise<CommandRequestResult>;
1231
+ get: (options: GetOptions) => Promise<CommandRequestResult>;
1232
+ is: (options: IsOptions) => Promise<CommandRequestResult>;
1233
+ find: (options: FindOptions) => Promise<CommandRequestResult>;
1234
+ };
1235
+ replay: {
1236
+ run: (options: ReplayRunOptions) => Promise<CommandRequestResult>;
1237
+ test: (options: ReplayTestOptions) => Promise<CommandRequestResult>;
1238
+ };
1239
+ batch: {
1240
+ run: (options: BatchRunOptions) => Promise<BatchRunResult>;
1241
+ };
1242
+ observability: {
1243
+ perf: (options?: PerfOptions) => Promise<CommandRequestResult>;
1244
+ logs: (options?: LogsOptions) => Promise<CommandRequestResult>;
1245
+ network: (options?: NetworkOptions) => Promise<CommandRequestResult>;
1246
+ audio: (options?: AudioOptions) => Promise<CommandRequestResult>;
1247
+ };
1248
+ debug: {
1249
+ symbols: (options: DebugSymbolsOptions) => Promise<DebugSymbolsResult>;
1250
+ };
1251
+ recording: {
1252
+ record: (options: RecordOptions) => Promise<CommandRequestResult>;
1253
+ trace: (options: TraceOptions) => Promise<CommandRequestResult>;
1254
+ };
1255
+ settings: {
1256
+ update: (options: SettingsUpdateOptions) => Promise<CommandRequestResult>;
1257
+ };
1258
+ };
1259
+ //#endregion
1260
+ //#region src/client/client.d.ts
1261
+ declare function createAgentDeviceClient(config?: AgentDeviceClientConfig, deps?: {
1262
+ transport?: AgentDeviceDaemonTransport;
1263
+ }): AgentDeviceClient;
1264
+ //#endregion
1265
+ export { AppError, centerOfRect, createAgentDeviceClient, createLocalArtifactAdapter, isAgentDeviceError, normalizeAgentDeviceError };