agent-device 0.19.2 → 0.20.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 (178) hide show
  1. package/README.md +61 -70
  2. package/android/ime-helper/dist/agent-device-android-ime-helper-0.20.0.apk +0 -0
  3. package/android/ime-helper/dist/agent-device-android-ime-helper-0.20.0.apk.sha256 +1 -0
  4. package/android/ime-helper/dist/agent-device-android-ime-helper-0.20.0.manifest.json +10 -0
  5. package/android/snapshot-helper/dist/agent-device-android-snapshot-helper-0.20.0.apk +0 -0
  6. package/android/snapshot-helper/dist/agent-device-android-snapshot-helper-0.20.0.apk.sha256 +1 -0
  7. package/{android-snapshot-helper/dist/agent-device-android-snapshot-helper-0.19.2.manifest.json → android/snapshot-helper/dist/agent-device-android-snapshot-helper-0.20.0.manifest.json} +6 -6
  8. package/dist/{apple-runner → apple/runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerAXSnapshotBridge.h +2 -0
  9. package/dist/{apple-runner → apple/runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerAXSnapshotBridge.m +5 -0
  10. package/dist/{apple-runner → apple/runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerSynthesizedGesture.h +12 -10
  11. package/dist/{apple-runner → apple/runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerSynthesizedGesture.m +154 -185
  12. package/dist/{apple-runner → apple/runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Alert.swift +113 -19
  13. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+BlockingSystemModalResolution.swift +82 -0
  14. package/dist/{apple-runner → apple/runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+CommandExecution.swift +275 -113
  15. package/dist/{apple-runner → apple/runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+CommandJournal.swift +2 -2
  16. package/dist/{apple-runner → apple/runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Interaction.swift +150 -104
  17. package/dist/{apple-runner → apple/runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Lifecycle.swift +56 -2
  18. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+LifecycleCacheTests.swift +73 -0
  19. package/dist/{apple-runner → apple/runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Models.swift +44 -14
  20. package/dist/{apple-runner → apple/runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+ScrollGesture.swift +2 -2
  21. package/dist/{apple-runner → apple/runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SequenceExecution.swift +2 -106
  22. package/dist/{apple-runner → apple/runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Snapshot.swift +126 -11
  23. package/dist/{apple-runner → apple/runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SnapshotCapturePlan.swift +51 -8
  24. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SnapshotTraversalIdentityTests.swift +24 -0
  25. package/dist/{apple-runner → apple/runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SynthesizedGesturePolicy.swift +1 -1
  26. package/dist/{apple-runner → apple/runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SystemModal.swift +43 -35
  27. package/dist/{apple-runner → apple/runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests.swift +14 -0
  28. package/dist/src/agent-browser-tool.js +1 -1
  29. package/dist/src/agent-device-client.js +3 -0
  30. package/dist/src/android-adb.d.ts +1 -1
  31. package/dist/src/android-adb.js +1 -1
  32. package/dist/src/android-input-method-overlays.js +1 -0
  33. package/dist/src/android-input-ownership.js +1 -6
  34. package/dist/src/android-system-chrome.js +1 -0
  35. package/dist/src/android.js +1 -1
  36. package/dist/src/app-lifecycle.js +5 -5
  37. package/dist/src/app-log-request-scope.js +1 -0
  38. package/dist/src/app-resolution.js +1 -0
  39. package/dist/src/apple-multitouch-support.js +1 -0
  40. package/dist/src/apps.js +5 -5
  41. package/dist/src/audio-probe.js +1 -1
  42. package/dist/src/boot-diagnostics.js +2 -0
  43. package/dist/src/cli-config.js +1 -0
  44. package/dist/src/cli-help.js +64 -30
  45. package/dist/src/cli-runner.js +1 -1
  46. package/dist/src/cli.js +15 -11
  47. package/dist/src/command-schema.js +3 -3
  48. package/dist/src/config.js +1 -0
  49. package/dist/src/context.js +1 -0
  50. package/dist/src/contracts.d.ts +1 -1
  51. package/dist/src/contracts.js +1 -1
  52. package/dist/src/daemon-shutdown-report.js +1 -0
  53. package/dist/src/debug-symbols.js +1 -1
  54. package/dist/src/device-input-state.js +1 -1
  55. package/dist/src/devices2.js +1 -1
  56. package/dist/src/find.js +1 -1
  57. package/dist/src/finders.js +1 -1
  58. package/dist/src/generic.js +1 -1
  59. package/dist/src/helper.js +1 -1
  60. package/dist/src/index.d.ts +412 -289
  61. package/dist/src/index.js +1 -1
  62. package/dist/src/input-actions.js +4 -3
  63. package/dist/src/input-actions2.js +1 -1
  64. package/dist/src/install-artifact.js +1 -0
  65. package/dist/src/install-source.d.ts +5 -1
  66. package/dist/src/install-source.js +1 -1
  67. package/dist/src/install-source2.js +1 -1
  68. package/dist/src/interaction-snapshot.js +1 -1
  69. package/dist/src/interaction.d.ts +230 -0
  70. package/dist/src/interaction.js +1 -1
  71. package/dist/src/interactor.js +2 -2
  72. package/dist/src/internal/bin.js +1 -1
  73. package/dist/src/internal/daemon.js +43 -17
  74. package/dist/src/internal/png-worker.d.ts +22 -0
  75. package/dist/src/internal/png-worker.js +1 -1
  76. package/dist/src/launch-console.js +1 -0
  77. package/dist/src/lease-context.js +1 -0
  78. package/dist/src/lease.js +1 -1
  79. package/dist/src/linux.js +1 -1
  80. package/dist/src/logcat.js +5 -0
  81. package/dist/src/metro.d.ts +2 -2
  82. package/dist/src/notifications.js +1 -1
  83. package/dist/src/png-worker-contract.js +1 -1
  84. package/dist/src/process-lock.js +1 -0
  85. package/dist/src/react-native.js +1 -1
  86. package/dist/src/record-trace.js +1 -1
  87. package/dist/src/register-builtins.js +1 -0
  88. package/dist/src/registry.js +24 -24
  89. package/dist/src/reporting.js +8 -7
  90. package/dist/src/runner-client.js +1 -1
  91. package/dist/src/runner-disposal.js +2 -0
  92. package/dist/src/runner-lease.js +1 -0
  93. package/dist/src/runner-sequence.js +1 -1
  94. package/dist/src/runtime-transport.js +1 -1
  95. package/dist/src/runtime.js +3 -3
  96. package/dist/src/runtime2.js +1 -0
  97. package/dist/src/sdk-android-adb.d.ts +119 -33
  98. package/dist/src/sdk-android-adb.js +4 -4
  99. package/dist/src/sdk-app-inventory.js +1 -1
  100. package/dist/src/sdk-batch-runner.d.ts +2 -1
  101. package/dist/src/sdk-batch-runner.js +2 -2
  102. package/dist/src/sdk-batch.js +2 -2
  103. package/dist/src/sdk-contracts.d.ts +105 -98
  104. package/dist/src/sdk-contracts.js +2 -2
  105. package/dist/src/sdk-device.js +1 -0
  106. package/dist/src/sdk-finders.d.ts +3 -3
  107. package/dist/src/sdk-finders.js +1 -1
  108. package/dist/src/sdk-io.d.ts +1 -1
  109. package/dist/src/sdk-io.js +1 -1
  110. package/dist/src/sdk-remote-config.d.ts +9 -1
  111. package/dist/src/sdk-remote-config.js +1 -1
  112. package/dist/src/sdk-selectors.js +1 -1
  113. package/dist/src/selector-runtime.js +1 -1
  114. package/dist/src/selector-vocabulary.js +1 -0
  115. package/dist/src/selectors.d.ts +12 -3
  116. package/dist/src/selectors.js +1 -1
  117. package/dist/src/server.js +3 -3
  118. package/dist/src/session-target-evidence.js +1 -0
  119. package/dist/src/session.js +8 -10
  120. package/dist/src/setting-state.js +1 -1
  121. package/dist/src/simulator.js +1 -1
  122. package/dist/src/snapshot-diagnostics.js +5 -2
  123. package/dist/src/snapshot.js +1 -1
  124. package/dist/src/snapshot2.js +1 -2
  125. package/dist/src/tool-provider.js +2 -2
  126. package/dist/src/tool-provider2.js +1 -1
  127. package/dist/src/tv-remote.js +13 -12
  128. package/dist/src/url.js +1 -1
  129. package/dist/src/web.js +1 -1
  130. package/package.json +33 -20
  131. package/server.json +2 -2
  132. package/android-multitouch-helper/dist/agent-device-android-multitouch-helper-0.19.2.apk +0 -0
  133. package/android-multitouch-helper/dist/agent-device-android-multitouch-helper-0.19.2.apk.sha256 +0 -1
  134. package/android-multitouch-helper/dist/agent-device-android-multitouch-helper-0.19.2.manifest.json +0 -10
  135. package/android-snapshot-helper/dist/agent-device-android-snapshot-helper-0.19.2.apk +0 -0
  136. package/android-snapshot-helper/dist/agent-device-android-snapshot-helper-0.19.2.apk.sha256 +0 -1
  137. package/dist/src/apple-runner-options.js +0 -1
  138. package/dist/src/cli-output.js +0 -1
  139. package/dist/src/client.js +0 -3
  140. package/dist/src/handler-utils.js +0 -1
  141. package/dist/src/output-path.js +0 -1
  142. package/dist/src/points.js +0 -4
  143. package/dist/src/provider.js +0 -1
  144. package/dist/src/providers.js +0 -1
  145. package/dist/src/record-trace-recording.js +0 -23
  146. package/dist/src/recording-provider.js +0 -1
  147. package/dist/src/selectors2.js +0 -1
  148. package/dist/src/simctl.js +0 -1
  149. package/dist/src/snapshot-helper.js +0 -5
  150. package/dist/src/ttl-memo.js +0 -1
  151. package/dist/src/xml.js +0 -2
  152. /package/{macos-helper → apple/macos-helper}/Package.swift +0 -0
  153. /package/{macos-helper → apple/macos-helper}/Sources/AgentDeviceMacOSHelper/AudioProbe.swift +0 -0
  154. /package/{macos-helper → apple/macos-helper}/Sources/AgentDeviceMacOSHelper/SnapshotTraversal.swift +0 -0
  155. /package/{macos-helper → apple/macos-helper}/Sources/AgentDeviceMacOSHelper/main.swift +0 -0
  156. /package/dist/{apple-runner → apple/runner}/AgentDeviceRunner/AgentDeviceRunner/AgentDeviceRunnerApp.m +0 -0
  157. /package/dist/{apple-runner → apple/runner}/AgentDeviceRunner/AgentDeviceRunner.xcodeproj/project.pbxproj +0 -0
  158. /package/dist/{apple-runner → apple/runner}/AgentDeviceRunner/AgentDeviceRunner.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -0
  159. /package/dist/{apple-runner → apple/runner}/AgentDeviceRunner/AgentDeviceRunner.xcodeproj/xcshareddata/xcschemes/AgentDeviceRunner.xcscheme +0 -0
  160. /package/dist/{apple-runner → apple/runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/AgentDeviceRunnerUITests-Bridging-Header.h +0 -0
  161. /package/dist/{apple-runner → apple/runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/AgentDeviceRunnerUITests.entitlements +0 -0
  162. /package/dist/{apple-runner → apple/runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerObjCExceptionCatcher.h +0 -0
  163. /package/dist/{apple-runner → apple/runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerObjCExceptionCatcher.m +0 -0
  164. /package/dist/{apple-runner → apple/runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTapPointPolicy.swift +0 -0
  165. /package/dist/{apple-runner → apple/runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+AXSnapshotFallback.swift +0 -0
  166. /package/dist/{apple-runner → apple/runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Environment.swift +0 -0
  167. /package/dist/{apple-runner → apple/runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Exceptions.swift +0 -0
  168. /package/dist/{apple-runner → apple/runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+FlatSnapshotFiltering.swift +0 -0
  169. /package/dist/{apple-runner → apple/runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Navigation.swift +0 -0
  170. /package/dist/{apple-runner → apple/runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+ScreenRecorder.swift +0 -0
  171. /package/dist/{apple-runner → apple/runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+TextEntry.swift +0 -0
  172. /package/dist/{apple-runner → apple/runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Transport.swift +0 -0
  173. /package/dist/{apple-runner → apple/runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+TvRemote.swift +0 -0
  174. /package/dist/{apple-runner → apple/runner}/AgentDeviceRunner/AgentDeviceRunnerUITests.xctestplan +0 -0
  175. /package/dist/{apple-runner → apple/runner}/AgentDeviceRunner/RecordingScripts/recording-overlay.swift +0 -0
  176. /package/dist/{apple-runner → apple/runner}/AgentDeviceRunner/RecordingScripts/recording-resize.swift +0 -0
  177. /package/dist/{apple-runner → apple/runner}/AgentDeviceRunner/RecordingScripts/recording-trim.swift +0 -0
  178. /package/{src/platforms/linux → linux}/atspi-dump.py +0 -0
@@ -1,36 +1,11 @@
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";
1
+ import { B as DeviceKind, C as DebugSymbolsResult, D as isAgentDeviceError, I as SnapshotUnchanged, L as SnapshotVisibility, M as ScreenshotOverlayRef, N as SnapshotNode, O as normalizeAgentDeviceError, P as SnapshotQualityVerdict, R as centerOfRect, S as DebugSymbolsOptions, T as NormalizedError, U as PlatformSelector, V as DeviceTarget, W as PublicPlatform, _ as NetworkIncludeMode, a as DaemonLockPolicy, b as SessionIsolationMode, c as DaemonResponseData, i as DaemonInstallSource, m as LeaseBackend, n as DaemonArtifactType, o as DaemonRequest, r as DaemonError, s as DaemonResponse, t as DaemonArtifact, w as AppError, x as SessionRuntimeHints, y as ResponseLevel, z as AppleOS } from "./sdk-contracts.js";
2
+ import { a as GesturePointerCount, c as SwipePreset, l as TransformGestureParams, o as ScrollDirection, s as SwipePattern, u as AndroidSnapshotBackendMetadata } from "./sdk-android-adb.js";
2
3
  import { t as AppsFilter } from "./sdk-app-inventory.js";
3
4
  import { t as BatchRunResult } from "./sdk-batch-runner.js";
4
5
  import { r as FindLocator } from "./sdk-finders.js";
6
+ import { a as LongPressCommandResponseData, i as FindCommandResponseData, o as PressCommandResponseData, r as FillCommandResponseData, s as ClickButton, t as ClickCommandResponseData } from "./interaction.js";
5
7
  import { p as createLocalArtifactAdapter } from "./sdk-io.js";
6
8
  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
- //#region src/platforms/android/snapshot-helper-types.d.ts
8
- type AndroidSnapshotHelperTransport = 'instrumentation' | 'persistent-session';
9
- type AndroidSnapshotCaptureMode = 'interactive-windows' | 'active-window';
10
- type AndroidSnapshotHelperInstallReason = 'missing' | 'outdated' | 'forced' | 'current' | 'skipped';
11
- //#endregion
12
- //#region src/platforms/android/snapshot-types.d.ts
13
- type AndroidSnapshotBackendMetadata = {
14
- backend: 'android-helper' | 'uiautomator-dump';
15
- helperVersion?: string;
16
- helperApiVersion?: string;
17
- helperTransport?: AndroidSnapshotHelperTransport;
18
- helperSessionReused?: boolean;
19
- fallbackReason?: string;
20
- installReason?: AndroidSnapshotHelperInstallReason;
21
- waitForIdleTimeoutMs?: number;
22
- waitForIdleQuietMs?: number;
23
- timeoutMs?: number;
24
- maxDepth?: number;
25
- maxNodes?: number;
26
- rootPresent?: boolean;
27
- captureMode?: AndroidSnapshotCaptureMode;
28
- windowCount?: number;
29
- nodeCount?: number;
30
- helperTruncated?: boolean;
31
- elapsedMs?: number;
32
- };
33
- //#endregion
34
9
  //#region src/snapshot-capture-annotations.d.ts
35
10
  type SnapshotCaptureAnalysis = {
36
11
  rawNodeCount: number;
@@ -68,27 +43,15 @@ type SnapshotDiagnosticsSummary = {
68
43
  warning?: string;
69
44
  };
70
45
  //#endregion
71
- //#region src/core/back-mode.d.ts
46
+ //#region src/contracts/back-mode.d.ts
72
47
  declare const BACK_MODES: readonly ['in-app', 'system'];
73
48
  type BackMode = (typeof BACK_MODES)[number];
74
49
  //#endregion
75
- //#region src/core/click-button.d.ts
76
- declare const CLICK_BUTTONS: readonly ['primary', 'secondary', 'middle'];
77
- type ClickButton = (typeof CLICK_BUTTONS)[number];
78
- //#endregion
79
- //#region src/core/recording-export-quality.d.ts
80
- declare const RECORDING_EXPORT_QUALITIES: readonly ['medium', 'high'];
81
- type RecordingExportQuality = (typeof RECORDING_EXPORT_QUALITIES)[number];
82
- //#endregion
83
- //#region src/core/recording-scope.d.ts
84
- declare const RECORDING_SCOPE_VALUES: readonly ['app', 'device', 'system'];
85
- type RecordingScope = (typeof RECORDING_SCOPE_VALUES)[number];
86
- //#endregion
87
- //#region src/core/device-rotation.d.ts
50
+ //#region src/contracts/device-rotation.d.ts
88
51
  declare const DEVICE_ROTATIONS: readonly ['portrait', 'portrait-upside-down', 'landscape-left', 'landscape-right'];
89
52
  type DeviceRotation = (typeof DEVICE_ROTATIONS)[number];
90
53
  //#endregion
91
- //#region src/core/tv-remote.d.ts
54
+ //#region src/contracts/tv-remote.d.ts
92
55
  declare const TV_REMOTE_BUTTON_DEFINITIONS: {
93
56
  readonly up: {
94
57
  readonly aliases: readonly [];
@@ -134,23 +97,65 @@ declare const TV_REMOTE_BUTTON_DEFINITIONS: {
134
97
  declare const TV_REMOTE_BUTTONS: (keyof typeof TV_REMOTE_BUTTON_DEFINITIONS)[];
135
98
  type TvRemoteButton = (typeof TV_REMOTE_BUTTONS)[number];
136
99
  //#endregion
137
- //#region src/core/scroll-gesture.d.ts
138
- declare const SCROLL_DIRECTIONS: readonly ['up', 'down', 'left', 'right'];
139
- type ScrollDirection = (typeof SCROLL_DIRECTIONS)[number];
140
- declare const SWIPE_PRESETS: readonly ['left', 'right', 'left-edge', 'right-edge'];
141
- type SwipePreset = (typeof SWIPE_PRESETS)[number];
142
- declare const SWIPE_PATTERNS: readonly ['one-way', 'ping-pong'];
143
- type SwipePattern = (typeof SWIPE_PATTERNS)[number];
144
- type TransformGestureParams = {
145
- x: number;
146
- y: number;
147
- dx: number;
148
- dy: number;
149
- scale: number;
150
- degrees: number;
100
+ //#region src/contracts/navigation.d.ts
101
+ /**
102
+ * Closed results of the navigation/global action commands. Each mirrors the
103
+ * dispatch handler's literal return EXACTLY (src/core/dispatch.ts
104
+ * `DISPATCH_HANDLERS`): a fixed `action` discriminant plus the always-present
105
+ * `successText` message (the handlers always pass a non-empty message, so it is
106
+ * required here). The handlers spread nothing else, so the shapes are closed —
107
+ * consistent with the `viewport` contract, the generic-dispatch Android
108
+ * dialog-recovery `warning` annotation is intentionally not part of the contract.
109
+ */
110
+ /** `home` — `{ action: 'home', message: 'Home' }`. */
111
+ type HomeCommandResult = {
112
+ action: 'home';
113
+ message: string;
114
+ };
115
+ /** `back` — `{ action: 'back', mode, message: 'Back' }`; `mode` defaults to `'in-app'`. */
116
+ type BackCommandResult = {
117
+ action: 'back';
118
+ mode: BackMode;
119
+ message: string;
120
+ };
121
+ /** `orientation` — `{ action: 'orientation', orientation, message: 'Rotated to <orientation>' }`. */
122
+ type OrientationCommandResult = {
123
+ action: 'orientation';
124
+ orientation: DeviceRotation;
125
+ message: string;
126
+ };
127
+ /**
128
+ * @deprecated The `rotate` command was renamed to `orientation`. This is the
129
+ * legacy response contract (`action: 'rotate'`) that shipped in v0.18/v0.19,
130
+ * retained for existing SDK consumers until the next major version. New code
131
+ * should use {@link OrientationCommandResult}.
132
+ */
133
+ type RotateCommandResult = {
134
+ action: 'rotate';
135
+ orientation: DeviceRotation;
136
+ message: string;
137
+ };
138
+ /** `app-switcher` — `{ action: 'app-switcher', message: 'Opened app switcher' }`. */
139
+ type AppSwitcherCommandResult = {
140
+ action: 'app-switcher';
141
+ message: string;
142
+ };
143
+ /** `tv-remote` — `{ action: 'tv-remote', button, durationMs?, message }`. */
144
+ type TvRemoteCommandResult = {
145
+ action: 'tv-remote';
146
+ button: TvRemoteButton;
151
147
  durationMs?: number;
148
+ message: string;
152
149
  };
153
150
  //#endregion
151
+ //#region src/core/recording-export-quality.d.ts
152
+ declare const RECORDING_EXPORT_QUALITIES: readonly ['medium', 'high'];
153
+ type RecordingExportQuality = (typeof RECORDING_EXPORT_QUALITIES)[number];
154
+ //#endregion
155
+ //#region src/contracts/recording-scope.d.ts
156
+ declare const RECORDING_SCOPE_VALUES: readonly ['app', 'device', 'system'];
157
+ type RecordingScope = (typeof RECORDING_SCOPE_VALUES)[number];
158
+ //#endregion
154
159
  //#region src/alert-contract.d.ts
155
160
  declare const ALERT_ACTIONS: readonly ['get', 'accept', 'dismiss', 'wait'];
156
161
  type AlertAction = (typeof ALERT_ACTIONS)[number];
@@ -162,7 +167,27 @@ type JsonObject = {
162
167
  [key: string]: JsonValue;
163
168
  };
164
169
  //#endregion
165
- //#region src/core/session-surface.d.ts
170
+ //#region src/commands/command-contract.d.ts
171
+ type JsonSchema = {
172
+ type?: string | readonly string[];
173
+ description?: string;
174
+ properties?: Record<string, JsonSchema>;
175
+ required?: readonly string[];
176
+ additionalProperties?: boolean | JsonSchema;
177
+ items?: JsonSchema;
178
+ prefixItems?: readonly JsonSchema[];
179
+ oneOf?: readonly JsonSchema[];
180
+ enum?: readonly unknown[];
181
+ const?: unknown;
182
+ minimum?: number;
183
+ maximum?: number;
184
+ };
185
+ type ExecutableCommandProjection<ClientMethod extends string = string> = {
186
+ clientMethod: ClientMethod;
187
+ outputSchema: JsonSchema;
188
+ };
189
+ //#endregion
190
+ //#region src/contracts/session-surface.d.ts
166
191
  declare const SESSION_SURFACES: readonly ['app', 'frontmost-app', 'desktop', 'menubar'];
167
192
  type SessionSurface = (typeof SESSION_SURFACES)[number];
168
193
  //#endregion
@@ -177,157 +202,38 @@ type ScreenshotResultData = {
177
202
  overlayRefs?: ScreenshotOverlayRef[];
178
203
  };
179
204
  //#endregion
180
- //#region src/contracts/interaction.d.ts
181
- type ResolvedTarget = {
182
- kind: 'selector';
183
- selector: string;
184
- } | {
185
- kind: 'ref';
186
- ref: string;
187
- };
188
- type ResolvedInteractionTarget = {
189
- kind: 'point';
190
- point: Point;
191
- preActionNodes?: SnapshotNode[];
192
- } | {
193
- kind: 'ref';
194
- point?: Point;
195
- target: Extract<ResolvedTarget, {
196
- kind: 'ref';
197
- }>;
198
- node?: SnapshotNode;
199
- selectorChain?: string[];
200
- refLabel?: string;
201
- targetHittable?: boolean;
202
- hint?: string;
203
- preActionNodes?: SnapshotNode[];
204
- } | {
205
- kind: 'selector';
206
- point: Point;
207
- target: Extract<ResolvedTarget, {
208
- kind: 'selector';
209
- }>;
210
- node: SnapshotNode;
211
- selectorChain: string[];
212
- refLabel?: string;
213
- targetHittable?: boolean;
214
- hint?: string;
215
- preActionNodes?: SnapshotNode[];
216
- };
217
- /**
218
- * Opt-in (`--verify`) cheap post-condition evidence for mutating interaction
219
- * commands (#1047). `digest`/`nodeCount`/`interactiveNodeCount` describe a single
220
- * interactive-only capture taken right after the action; `changedFromBefore`
221
- * compares that digest against the pre-action capture the resolution path already
222
- * held, so no extra device round trip is spent beyond the one verify capture.
223
- * `changedFromBefore: false` is evidence, not failure — the command still
224
- * succeeded.
225
- */
226
- type InteractionEvidence = {
227
- foregroundApp?: string;
228
- nodeCount: number;
229
- interactiveNodeCount: number;
230
- digest: string;
231
- changedFromBefore: boolean;
232
- };
233
- type SettleDiffLine = {
234
- kind: 'added' | 'removed';
235
- text: string;
236
- /**
237
- * Plain ref body (`e12`) for ADDED lines: minted from the settled tree that
238
- * became the stored session snapshot, so it is immediately actionable and
239
- * lets the MCP layer pin it at `refsGeneration`. Removed lines never carry
240
- * one — their refs name nodes of the replaced tree.
241
- */
242
- ref?: string;
243
- };
244
- /**
245
- * One still-present, actionable element on the settled tree, surfaced by the
246
- * unchanged-interactive tail (see `SettleObservation.tail`).
247
- */
248
- type SettleTailEntry = {
249
- ref: string;
250
- role: string;
251
- label?: string;
252
- };
253
- type SettleObservation = {
254
- settled: boolean;
255
- waitedMs: number;
256
- captures: number;
257
- quietMs: number;
258
- timeoutMs: number;
259
- /**
260
- * The session's snapshot generation after the settled tree became the stored
261
- * snapshot (#1076 versioned refs). Attached by the daemon response layer
262
- * when `diff` is present: added lines carry refs minted from that tree, so
263
- * the response is ref-issuing — the MCP layer merges per-ref pins from it
264
- * exactly like snapshot/find responses.
265
- */
266
- refsGeneration?: number;
267
- /**
268
- * Digest response view only: capped added-line refs preserved without the
269
- * verbose diff line text, so MCP can still pin refs when `diff.lines` is
270
- * intentionally omitted.
271
- */
272
- refs?: Array<{
273
- ref: string;
274
- }>;
275
- /** Present only for `settled: true` observations that stored the settled tree. */
276
- diff?: {
277
- summary: {
278
- additions: number;
279
- removals: number;
280
- unchanged: number;
281
- };
282
- lines: SettleDiffLine[];
283
- /** Present (true) when lines were capped to the response bound. */
284
- truncated?: boolean;
285
- };
286
- /**
287
- * Unchanged interactive refs tail: benchmarks (July 2026) showed 27% of
288
- * `--settle` actions were followed by a fallback `snapshot -i` because a
289
- * change-only diff omits refs for elements that did not change — after a
290
- * modal dismiss the diff shows only removals, and the next button to press
291
- * (already on screen, untouched) is absent from the response. `tail` lists
292
- * the settled tree's remaining hittable, uncovered interactive elements so
293
- * the response stays actionable without that extra round trip. Attached
294
- * ONLY when `diff` carries zero added-line refs (the modal-dismiss/
295
- * toast-only signature) — a diff with fresh added refs already hands the
296
- * next target, so the tail would be pure byte cost. Refs already present on
297
- * `diff`'s added lines are excluded. Capped; `tailTruncated` marks when
298
- * candidates exceeded the cap.
299
- */
300
- tail?: SettleTailEntry[];
301
- tailTruncated?: true;
302
- hint?: string;
303
- };
304
- type PressCommandResult = ResolvedInteractionTarget & {
305
- backendResult?: Record<string, unknown>;
306
- message?: string;
307
- warning?: string;
308
- evidence?: InteractionEvidence;
309
- settle?: SettleObservation;
310
- };
311
- type FillCommandResult = ResolvedInteractionTarget & {
312
- text: string;
313
- warning?: string;
314
- backendResult?: Record<string, unknown>;
315
- message?: string;
316
- evidence?: InteractionEvidence;
317
- settle?: SettleObservation;
318
- };
319
- type LongPressCommandResult = ResolvedInteractionTarget & {
320
- durationMs?: number;
321
- backendResult?: Record<string, unknown>;
322
- message?: string;
323
- warning?: string;
324
- settle?: SettleObservation;
325
- };
326
- //#endregion
327
205
  //#region src/commands/interaction/runtime/gestures.d.ts
328
206
  declare const SCROLL_INPUT_DIRECTIONS: readonly ['up', 'down', 'left', 'right', 'top', 'bottom'];
329
207
  type ScrollInputDirection = (typeof SCROLL_INPUT_DIRECTIONS)[number];
330
208
  //#endregion
209
+ //#region src/commands/system/navigation-projection.d.ts
210
+ declare const navigationCommandProjectionType: unique symbol;
211
+ type NavigationCommandProjection<Options, Result, Required extends boolean, ClientMethod extends string> = ExecutableCommandProjection<ClientMethod> & {
212
+ readonly [navigationCommandProjectionType]?: {
213
+ options: Options;
214
+ result: Result;
215
+ required: Required;
216
+ };
217
+ };
218
+ declare const NAVIGATION_COMMAND_PROJECTIONS: {
219
+ readonly back: NavigationCommandProjection<{
220
+ mode?: BackMode;
221
+ }, BackCommandResult, false, "back">;
222
+ readonly home: NavigationCommandProjection<{}, HomeCommandResult, false, "home">;
223
+ readonly orientation: NavigationCommandProjection<{
224
+ orientation: DeviceRotation;
225
+ }, OrientationCommandResult, true, "orientation">;
226
+ readonly 'app-switcher': NavigationCommandProjection<{}, AppSwitcherCommandResult, false, "appSwitcher">;
227
+ readonly 'tv-remote': NavigationCommandProjection<{
228
+ button: TvRemoteButton;
229
+ durationMs?: number;
230
+ }, TvRemoteCommandResult, true, "tvRemote">;
231
+ };
232
+ type NavigationCommandName = keyof typeof NAVIGATION_COMMAND_PROJECTIONS;
233
+ type NavigationCommandOptions<Name extends NavigationCommandName> = (typeof NAVIGATION_COMMAND_PROJECTIONS)[Name] extends NavigationCommandProjection<infer Options, unknown, boolean, string> ? Options : never;
234
+ type ProjectedNavigationCommandMethod<BaseOptions, Projection> = Projection extends NavigationCommandProjection<infer Options, infer Result, infer Required, string> ? Required extends true ? (options: BaseOptions & Options) => Promise<Result> : (options?: BaseOptions & Options) => Promise<Result> : never;
235
+ type ProjectedNavigationCommandClient<BaseOptions> = { [Name in NavigationCommandName as (typeof NAVIGATION_COMMAND_PROJECTIONS)[Name]['clientMethod']]: ProjectedNavigationCommandMethod<BaseOptions, (typeof NAVIGATION_COMMAND_PROJECTIONS)[Name]>; };
236
+ //#endregion
331
237
  //#region src/contracts/logs.d.ts
332
238
  declare const LOG_ACTION_VALUES: readonly ['path', 'start', 'stop', 'doctor', 'mark', 'clear'];
333
239
  type LogAction = (typeof LOG_ACTION_VALUES)[number];
@@ -413,46 +319,6 @@ type ViewportCommandResult = {
413
319
  message: string;
414
320
  };
415
321
  //#endregion
416
- //#region src/contracts/navigation.d.ts
417
- /**
418
- * Closed results of the navigation/global action commands. Each mirrors the
419
- * dispatch handler's literal return EXACTLY (src/core/dispatch.ts
420
- * `DISPATCH_HANDLERS`): a fixed `action` discriminant plus the always-present
421
- * `successText` message (the handlers always pass a non-empty message, so it is
422
- * required here). The handlers spread nothing else, so the shapes are closed —
423
- * consistent with the `viewport` contract, the generic-dispatch Android
424
- * dialog-recovery `warning` annotation is intentionally not part of the contract.
425
- */
426
- /** `home` — `{ action: 'home', message: 'Home' }`. */
427
- type HomeCommandResult = {
428
- action: 'home';
429
- message: string;
430
- };
431
- /** `back` — `{ action: 'back', mode, message: 'Back' }`; `mode` defaults to `'in-app'`. */
432
- type BackCommandResult = {
433
- action: 'back';
434
- mode: BackMode;
435
- message: string;
436
- };
437
- /** `rotate` — `{ action: 'rotate', orientation, message: 'Rotated to <orientation>' }`. */
438
- type RotateCommandResult = {
439
- action: 'rotate';
440
- orientation: DeviceRotation;
441
- message: string;
442
- };
443
- /** `app-switcher` — `{ action: 'app-switcher', message: 'Opened app switcher' }`. */
444
- type AppSwitcherCommandResult = {
445
- action: 'app-switcher';
446
- message: string;
447
- };
448
- /** `tv-remote` — `{ action: 'tv-remote', button, durationMs?, message }`. */
449
- type TvRemoteCommandResult = {
450
- action: 'tv-remote';
451
- button: TvRemoteButton;
452
- durationMs?: number;
453
- message: string;
454
- };
455
- //#endregion
456
322
  //#region src/contracts/clipboard.d.ts
457
323
  /**
458
324
  * Closed result of the `clipboard` command. Mirrors the dispatch handler's
@@ -609,6 +475,172 @@ type TriggerAppEventCommandResult = {
609
475
  message: string;
610
476
  };
611
477
  //#endregion
478
+ //#region src/contracts/doctor.d.ts
479
+ type DoctorStatus = 'pass' | 'warn' | 'fail' | 'info';
480
+ type DoctorKind = 'auto' | 'react-native' | 'expo' | 'repack';
481
+ type DoctorCheck = {
482
+ id: string;
483
+ status: DoctorStatus;
484
+ summary: string;
485
+ hint?: string;
486
+ command?: string;
487
+ evidence?: Record<string, unknown>;
488
+ };
489
+ type DoctorCommandResult = {
490
+ status: DoctorStatus;
491
+ summary: string;
492
+ kind: DoctorKind;
493
+ platform?: PlatformSelector;
494
+ target?: DeviceTarget;
495
+ targetApp?: string;
496
+ metro?: {
497
+ host: string;
498
+ port: number;
499
+ };
500
+ checks: DoctorCheck[];
501
+ };
502
+ //#endregion
503
+ //#region src/snapshot/snapshot-diff.d.ts
504
+ type SnapshotDiffLine = {
505
+ kind: 'added' | 'removed' | 'unchanged';
506
+ text: string;
507
+ /**
508
+ * Plain ref body (`e12`) of the CURRENT-tree node behind an added line.
509
+ * Only populated with `withRefs` (interaction `--settle`, #1101) so the
510
+ * `diff` command's wire shape stays byte-identical. Removed/unchanged lines
511
+ * never carry it: a removed line's ref names a node of the replaced tree.
512
+ */
513
+ ref?: string;
514
+ };
515
+ type SnapshotDiffSummary = {
516
+ additions: number;
517
+ removals: number;
518
+ unchanged: number;
519
+ };
520
+ //#endregion
521
+ //#region src/contracts/diff.d.ts
522
+ type DiffSnapshotCommandResult = {
523
+ mode: 'snapshot';
524
+ baselineInitialized: boolean;
525
+ summary: SnapshotDiffSummary;
526
+ lines: SnapshotDiffLine[];
527
+ warnings?: string[];
528
+ };
529
+ //#endregion
530
+ //#region src/contracts/recording.d.ts
531
+ type RecordingAppIdentity = {
532
+ bundleId: string;
533
+ name?: string;
534
+ };
535
+ type RecordingStartCommandResult = {
536
+ recording: 'started';
537
+ outPath: string;
538
+ sessionStateDir: string;
539
+ recordingBackend?: string;
540
+ recordingScope?: RecordingScope;
541
+ recordOnlySession?: boolean;
542
+ activeSessionApp?: RecordingAppIdentity;
543
+ showTouches: boolean;
544
+ };
545
+ type RecordingStopCommandResult = {
546
+ recording: 'stopped';
547
+ outPath: string;
548
+ telemetryPath?: string;
549
+ artifacts: DaemonArtifact[];
550
+ recordingBackend?: string;
551
+ recordingScope?: RecordingScope;
552
+ recordOnlySession?: boolean;
553
+ activeSessionApp?: RecordingAppIdentity;
554
+ durationMs: number;
555
+ showTouches: boolean;
556
+ warning?: string;
557
+ overlayWarning?: string;
558
+ chunks?: Array<{
559
+ index: number;
560
+ path: string;
561
+ }>;
562
+ };
563
+ type RecordingCommandResult = RecordingStartCommandResult | RecordingStopCommandResult;
564
+ type TraceCommandResult = {
565
+ trace: 'started';
566
+ outPath: string;
567
+ } | {
568
+ trace: 'stopped';
569
+ outPath: string;
570
+ };
571
+ //#endregion
572
+ //#region src/contracts/replay.d.ts
573
+ type ReplayCommandResult = {
574
+ replayed: number;
575
+ healed: number;
576
+ session: string;
577
+ artifactPaths: string[];
578
+ warnings?: string[];
579
+ snapshotDiagnostics?: SnapshotDiagnosticsSummary;
580
+ message: string;
581
+ };
582
+ type ReplaySuiteTestSkipReason = 'skipped-by-filter';
583
+ type ReplaySuiteAttemptFailure = {
584
+ attempt: number;
585
+ message: string;
586
+ durationMs?: number;
587
+ };
588
+ type ReplaySuiteTestPassed = {
589
+ file: string;
590
+ title?: string;
591
+ session: string;
592
+ status: 'passed';
593
+ durationMs: number;
594
+ finalAttemptDurationMs?: number;
595
+ attempts: number;
596
+ artifactsDir?: string;
597
+ replayed: number;
598
+ healed: number;
599
+ warnings?: string[];
600
+ attemptFailures?: ReplaySuiteAttemptFailure[];
601
+ shardIndex?: number;
602
+ shardCount?: number;
603
+ deviceId?: string;
604
+ deviceName?: string;
605
+ snapshotDiagnostics?: SnapshotDiagnosticsSummary;
606
+ };
607
+ type ReplaySuiteTestFailed = {
608
+ file: string;
609
+ title?: string;
610
+ session: string;
611
+ status: 'failed';
612
+ durationMs: number;
613
+ attempts: number;
614
+ artifactsDir?: string;
615
+ error: DaemonError;
616
+ shardIndex?: number;
617
+ shardCount?: number;
618
+ deviceId?: string;
619
+ deviceName?: string;
620
+ snapshotDiagnostics?: SnapshotDiagnosticsSummary;
621
+ };
622
+ type ReplaySuiteTestSkipped = {
623
+ file: string;
624
+ title?: string;
625
+ status: 'skipped';
626
+ durationMs: 0;
627
+ reason: ReplaySuiteTestSkipReason;
628
+ message: string;
629
+ };
630
+ type ReplaySuiteTestResult = ReplaySuiteTestPassed | ReplaySuiteTestFailed | ReplaySuiteTestSkipped;
631
+ type ReplaySuiteResult = {
632
+ total: number;
633
+ executed: number;
634
+ passed: number;
635
+ failed: number;
636
+ skipped: number;
637
+ notRun: number;
638
+ durationMs: number;
639
+ failures: ReplaySuiteTestFailed[];
640
+ tests: ReplaySuiteTestResult[];
641
+ snapshotDiagnostics?: SnapshotDiagnosticsSummary;
642
+ };
643
+ //#endregion
612
644
  //#region src/core/command-descriptor/command-result.d.ts
613
645
  /**
614
646
  * The additive typed-result spine (ADR-0008, Phase 1 step 6).
@@ -621,8 +653,8 @@ type TriggerAppEventCommandResult = {
621
653
  * invented shape.
622
654
  *
623
655
  * Batches 1-2 wired `boot` / `shutdown` / `viewport` and the navigation/action
624
- * commands `home` / `back` / `rotate` / `app-switcher` alongside the seed
625
- * interaction trio. Batch 3 adds `clipboard` (a closed `read`/`write` union) and
656
+ * commands `home` / `back` / `orientation` / `app-switcher` alongside the seed
657
+ * interaction quartet. Batch 3 adds `clipboard` (a closed `read`/`write` union) and
626
658
  * `appstate` (a closed `platform` union — Apple session state with the iOS-only
627
659
  * device locators, or Android package/activity). Batch 4 adds `keyboard` (a
628
660
  * closed flat shape). Batch 5 adds the compact daemon projections for `wait`,
@@ -630,15 +662,17 @@ type TriggerAppEventCommandResult = {
630
662
  * re-read of the handler's literal return; see the per-type docstrings.
631
663
  */
632
664
  interface CommandResultMap {
633
- press: PressCommandResult;
634
- fill: FillCommandResult;
635
- longpress: LongPressCommandResult;
665
+ press: PressCommandResponseData;
666
+ click: ClickCommandResponseData;
667
+ fill: FillCommandResponseData;
668
+ longpress: LongPressCommandResponseData;
669
+ find: FindCommandResponseData;
636
670
  boot: BootCommandResult;
637
671
  shutdown: ShutdownCommandResult;
638
672
  viewport: ViewportCommandResult;
639
673
  home: HomeCommandResult;
640
674
  back: BackCommandResult;
641
- rotate: RotateCommandResult;
675
+ orientation: OrientationCommandResult;
642
676
  'app-switcher': AppSwitcherCommandResult;
643
677
  clipboard: ClipboardCommandResult;
644
678
  appstate: AppStateCommandResult;
@@ -648,6 +682,12 @@ interface CommandResultMap {
648
682
  prepare: PrepareCommandResult;
649
683
  push: PushCommandResult;
650
684
  'trigger-app-event': TriggerAppEventCommandResult;
685
+ doctor: DoctorCommandResult;
686
+ diff: DiffSnapshotCommandResult;
687
+ replay: ReplayCommandResult;
688
+ test: ReplaySuiteResult;
689
+ record: RecordingCommandResult;
690
+ trace: TraceCommandResult;
651
691
  }
652
692
  /**
653
693
  * The typed result for a command named `N`. Seeded commands resolve to their
@@ -805,6 +845,23 @@ type SessionCloseResult = {
805
845
  session: string;
806
846
  shutdown?: TargetShutdownResult;
807
847
  provider?: CloudProviderSessionResult;
848
+ /**
849
+ * #1258: absolute path of the committed session/healed script when this close
850
+ * published one (`close --save-script`, or a repair-armed session's finalize)
851
+ * — so a client that requested publication learns where the file landed.
852
+ */
853
+ savedScript?: string;
854
+ identifiers: AgentDeviceIdentifiers;
855
+ };
856
+ type SessionSaveScriptOptions = AgentDeviceRequestOverrides & {
857
+ path?: string;
858
+ /** Atomically replace an existing target instead of refusing publication. */
859
+ force?: boolean;
860
+ };
861
+ type SessionSaveScriptResult = {
862
+ session: string;
863
+ savedScript: string;
864
+ actionCount: number;
808
865
  identifiers: AgentDeviceIdentifiers;
809
866
  };
810
867
  type CloudArtifactsOptions = AgentDeviceRequestOverrides & {
@@ -837,12 +894,16 @@ type AppOpenOptions = AgentDeviceRequestOverrides & AgentDeviceSelectionOptions
837
894
  launchArgs?: string[];
838
895
  relaunch?: boolean;
839
896
  saveScript?: boolean | string;
897
+ /** #1258: overwrite an existing --save-script target instead of refusing. Alias: --overwrite. */
898
+ force?: boolean;
840
899
  deviceHub?: boolean;
900
+ testIme?: boolean;
841
901
  noRecord?: boolean;
842
902
  runtime?: SessionRuntimeHints;
843
903
  };
844
904
  type AppOpenResult = {
845
905
  session: string;
906
+ warnings?: string[];
846
907
  sessionStateDir?: string;
847
908
  runnerLogPath?: string;
848
909
  requestLogPath?: string;
@@ -858,11 +919,20 @@ type AppOpenResult = {
858
919
  type AppCloseOptions = AgentDeviceRequestOverrides & {
859
920
  app?: string;
860
921
  shutdown?: boolean;
922
+ saveScript?: boolean | string;
923
+ /** #1258: overwrite an existing --save-script target instead of refusing. Alias: --overwrite. */
924
+ force?: boolean;
861
925
  };
862
926
  type AppCloseResult = {
863
927
  session: string;
864
928
  closedApp?: string;
865
929
  shutdown?: TargetShutdownResult;
930
+ /**
931
+ * #1258: absolute path of the committed session/healed script when this close
932
+ * published one (`close --save-script`, or a repair-armed session's finalize)
933
+ * — so a client that requested publication learns where the file landed.
934
+ */
935
+ savedScript?: string;
866
936
  identifiers: AgentDeviceIdentifiers;
867
937
  };
868
938
  type AppInstallFromSourceOptions = AgentDeviceRequestOverrides & AgentDeviceSelectionOptions & {
@@ -962,6 +1032,13 @@ type CaptureSnapshotOptions = AgentDeviceRequestOverrides & AgentDeviceSelection
962
1032
  raw?: boolean;
963
1033
  forceFull?: boolean;
964
1034
  timeoutMs?: number;
1035
+ /**
1036
+ * #1271 stage 2 (ADR 0012 amendment): `snapshot` is observation-only and
1037
+ * excluded from a repair-armed heal by default; `record` forces it
1038
+ * through. Mutually exclusive with `noRecord`.
1039
+ */
1040
+ noRecord?: boolean;
1041
+ record?: boolean;
965
1042
  };
966
1043
  type CaptureSnapshotResult = {
967
1044
  nodes: SnapshotNode[];
@@ -972,6 +1049,21 @@ type CaptureSnapshotResult = {
972
1049
  unchanged?: SnapshotUnchanged;
973
1050
  snapshotDiagnostics?: SnapshotDiagnosticsSummary;
974
1051
  identifiers: AgentDeviceIdentifiers;
1052
+ /**
1053
+ * ADR 0014: the response-level ref-frame epoch the plain node refs were minted
1054
+ * from. A ref-issuing snapshot carries it ONCE (nodes stay plain `@e12` for the
1055
+ * token budget); pair a ref with it (`@e12~s<refsGeneration>`) before a mutation.
1056
+ */
1057
+ refsGeneration?: number;
1058
+ /**
1059
+ * Digest response view only: a capped list of `{ ref, label? }` pairs taken
1060
+ * from the full `nodes` tree so the MCP layer can still pin refs when the
1061
+ * default-level `nodes` payload is intentionally omitted.
1062
+ */
1063
+ refs?: Array<{
1064
+ ref: string;
1065
+ label?: string;
1066
+ }>;
975
1067
  } & PublicSnapshotCaptureAnnotations;
976
1068
  type CaptureScreenshotOptions = AgentDeviceRequestOverrides & {
977
1069
  path?: string;
@@ -1035,14 +1127,9 @@ type AlertCommandOptions = DeviceCommandBaseOptions & {
1035
1127
  timeoutMs?: number;
1036
1128
  };
1037
1129
  type AppStateCommandOptions = DeviceCommandBaseOptions;
1038
- type BackCommandOptions = DeviceCommandBaseOptions & {
1039
- mode?: BackMode;
1040
- };
1041
- type HomeCommandOptions = DeviceCommandBaseOptions;
1042
- type RotateCommandOptions = DeviceCommandBaseOptions & {
1043
- orientation: DeviceRotation;
1044
- };
1045
- type AppSwitcherCommandOptions = DeviceCommandBaseOptions;
1130
+ type OrientationCommandOptions = DeviceCommandBaseOptions & NavigationCommandOptions<'orientation'>;
1131
+ /** @deprecated Renamed to `OrientationCommandOptions`. Retained until the next major. */
1132
+ type RotateCommandOptions = OrientationCommandOptions;
1046
1133
  type KeyboardCommandOptions = DeviceCommandBaseOptions & {
1047
1134
  action?: 'status' | 'dismiss' | 'enter' | 'return';
1048
1135
  };
@@ -1052,10 +1139,6 @@ type ClipboardCommandOptions = (DeviceCommandBaseOptions & {
1052
1139
  action: 'write';
1053
1140
  text: string;
1054
1141
  });
1055
- type TvRemoteCommandOptions = DeviceCommandBaseOptions & {
1056
- button: TvRemoteButton;
1057
- durationMs?: number;
1058
- };
1059
1142
  type ReactNativeCommandOptions = DeviceCommandBaseOptions & {
1060
1143
  action: 'dismiss-overlay';
1061
1144
  };
@@ -1071,19 +1154,14 @@ type ViewportCommandOptions = DeviceCommandBaseOptions & {
1071
1154
  width: number;
1072
1155
  height: number;
1073
1156
  };
1074
- type AgentDeviceCommandClient = {
1157
+ type NonNavigationCommandClient = {
1075
1158
  wait: (options: WaitCommandOptions) => Promise<CommandResult<'wait'>>;
1076
1159
  alert: (options?: AlertCommandOptions) => Promise<CommandRequestResult>;
1077
1160
  appState: (options?: AppStateCommandOptions) => Promise<CommandResult<'appstate'>>;
1078
- back: (options?: BackCommandOptions) => Promise<CommandResult<'back'>>;
1079
- home: (options?: HomeCommandOptions) => Promise<CommandResult<'home'>>;
1080
- rotate: (options: RotateCommandOptions) => Promise<CommandResult<'rotate'>>;
1081
- appSwitcher: (options?: AppSwitcherCommandOptions) => Promise<CommandResult<'app-switcher'>>;
1082
1161
  keyboard: (options?: KeyboardCommandOptions) => Promise<CommandResult<'keyboard'>>;
1083
1162
  clipboard: (options: ClipboardCommandOptions) => Promise<CommandResult<'clipboard'>>;
1084
- tvRemote: (options: TvRemoteCommandOptions) => Promise<CommandResult<'tv-remote'>>;
1085
1163
  reactNative: (options: ReactNativeCommandOptions) => Promise<CommandRequestResult>;
1086
- doctor: (options?: DoctorCommandOptions) => Promise<CommandRequestResult>;
1164
+ doctor: (options?: DoctorCommandOptions) => Promise<CommandResult<'doctor'>>;
1087
1165
  /**
1088
1166
  * JSON prepare results include timing.additiveParts for additive wall-clock phases.
1089
1167
  * Top-level buildMs/connectMs/healthCheckMs are diagnostics and may overlap.
@@ -1091,6 +1169,15 @@ type AgentDeviceCommandClient = {
1091
1169
  prepare: (options: PrepareCommandOptions) => Promise<CommandResult<'prepare'>>;
1092
1170
  viewport: (options: ViewportCommandOptions) => Promise<CommandResult<'viewport'>>;
1093
1171
  };
1172
+ type AgentDeviceCommandClient = ProjectedNavigationCommandClient<DeviceCommandBaseOptions> & NonNavigationCommandClient & DeprecatedCommandClient;
1173
+ /** Renamed command methods retained for existing consumers until the next major. */
1174
+ type DeprecatedCommandClient = {
1175
+ /**
1176
+ * @deprecated Renamed to `orientation`. Delegates to it and returns the legacy
1177
+ * `action: 'rotate'` response contract. Retained until the next major version.
1178
+ */
1179
+ rotate: (options: RotateCommandOptions) => Promise<RotateCommandResult>;
1180
+ };
1094
1181
  type SelectorSnapshotCommandOptions = Pick<CaptureSnapshotOptions, 'depth' | 'scope' | 'raw'>;
1095
1182
  type FindSnapshotCommandOptions = Pick<CaptureSnapshotOptions, 'depth' | 'raw'>;
1096
1183
  type PointTarget = {
@@ -1176,7 +1263,6 @@ type SwipeOptions = DeviceCommandBaseOptions & {
1176
1263
  x: number;
1177
1264
  y: number;
1178
1265
  };
1179
- durationMs?: number;
1180
1266
  count?: number;
1181
1267
  pauseMs?: number;
1182
1268
  pattern?: SwipePattern;
@@ -1186,6 +1272,7 @@ type PanOptions = DeviceCommandBaseOptions & {
1186
1272
  y: number;
1187
1273
  dx: number;
1188
1274
  dy: number;
1275
+ pointerCount?: GesturePointerCount;
1189
1276
  durationMs?: number;
1190
1277
  };
1191
1278
  type FlingOptions = DeviceCommandBaseOptions & {
@@ -1193,11 +1280,9 @@ type FlingOptions = DeviceCommandBaseOptions & {
1193
1280
  x: number;
1194
1281
  y: number;
1195
1282
  distance?: number;
1196
- durationMs?: number;
1197
1283
  };
1198
1284
  type SwipeGestureOptions = DeviceCommandBaseOptions & {
1199
1285
  preset: SwipePreset;
1200
- durationMs?: number;
1201
1286
  };
1202
1287
  type FocusOptions = DeviceCommandBaseOptions & {
1203
1288
  x: number;
@@ -1227,24 +1312,33 @@ type RotateGestureOptions = DeviceCommandBaseOptions & {
1227
1312
  degrees: number;
1228
1313
  x?: number;
1229
1314
  y?: number;
1230
- velocity?: number;
1231
1315
  };
1232
1316
  type TransformGestureOptions = DeviceCommandBaseOptions & TransformGestureParams;
1233
- type GetOptions = DeviceCommandBaseOptions & SelectorSnapshotCommandOptions & ElementTarget & {
1317
+ /**
1318
+ * #1271 stage 2 (ADR 0012 amendment): `get`/`is`/`find` are observation-only
1319
+ * and excluded from a repair-armed heal by default. `record` forces this
1320
+ * action through (the corrective-read case); `noRecord` continues to opt the
1321
+ * action out entirely. Mutually exclusive.
1322
+ */
1323
+ type RecordControlOptions = {
1324
+ noRecord?: boolean;
1325
+ record?: boolean;
1326
+ };
1327
+ type GetOptions = DeviceCommandBaseOptions & SelectorSnapshotCommandOptions & ElementTarget & RecordControlOptions & {
1234
1328
  format: 'text' | 'attrs';
1235
1329
  };
1236
- type IsTextPredicateOptions = DeviceCommandBaseOptions & SelectorSnapshotCommandOptions & {
1330
+ type IsTextPredicateOptions = DeviceCommandBaseOptions & SelectorSnapshotCommandOptions & RecordControlOptions & {
1237
1331
  predicate: 'text';
1238
1332
  selector: string;
1239
1333
  value: string;
1240
1334
  };
1241
- type IsStatePredicateOptions = DeviceCommandBaseOptions & SelectorSnapshotCommandOptions & {
1335
+ type IsStatePredicateOptions = DeviceCommandBaseOptions & SelectorSnapshotCommandOptions & RecordControlOptions & {
1242
1336
  predicate: 'visible' | 'hidden' | 'exists' | 'editable' | 'selected' | 'focused';
1243
1337
  selector: string;
1244
1338
  value?: never;
1245
1339
  };
1246
1340
  type IsOptions = IsTextPredicateOptions | IsStatePredicateOptions;
1247
- type FindBaseOptions = DeviceCommandBaseOptions & FindSnapshotCommandOptions & {
1341
+ type FindBaseOptions = DeviceCommandBaseOptions & FindSnapshotCommandOptions & RecordControlOptions & {
1248
1342
  locator?: FindLocator;
1249
1343
  query: string;
1250
1344
  first?: boolean;
@@ -1261,15 +1355,40 @@ type FindOptions = (FindBaseOptions & {
1261
1355
  });
1262
1356
  type ReplayRunOptions = AgentDeviceRequestOverrides & AgentDeviceSelectionOptions & {
1263
1357
  path: string;
1358
+ runtime?: SessionRuntimeHints;
1359
+ /**
1360
+ * @deprecated ADR 0012 migration step 6: `--update` no longer rewrites
1361
+ * the script. Accepted for backward compatibility; every divergence
1362
+ * already carries ranked selector suggestions regardless of this flag.
1363
+ */
1264
1364
  update?: boolean;
1265
1365
  /** @deprecated Use backend: 'maestro'. */
1266
1366
  maestro?: boolean;
1267
1367
  backend?: string;
1268
1368
  env?: string[];
1269
1369
  timeoutMs?: number;
1370
+ /**
1371
+ * ADR 0012 decision 4 / migration step 5: resume at this 1-based plan
1372
+ * step, skipping `1..resumeFrom-1` without executing them. Requires
1373
+ * `resumePlanDigest` from the divergence report that reported this
1374
+ * step as the failure. `replay` only — `test` has no resume fields.
1375
+ */
1376
+ resumeFrom?: number;
1377
+ /** The `resume.planDigest` from the divergence report `resumeFrom` came from. */
1378
+ resumePlanDigest?: string;
1379
+ /**
1380
+ * ADR 0012 decision 6, R1/R6: arms agent-supervised re-record repair
1381
+ * from this replay attempt onward. Optional string value is the healed
1382
+ * `.ad`'s output path; absent one, it defaults to the `<path>` sibling
1383
+ * `<stem>.healed.ad` when the repair ends with `close --save-script`.
1384
+ */
1385
+ saveScript?: boolean | string;
1386
+ /** #1258: overwrite an existing --save-script target instead of refusing. Alias: --overwrite. */
1387
+ force?: boolean;
1270
1388
  };
1271
1389
  type ReplayTestOptions = AgentDeviceRequestOverrides & AgentDeviceSelectionOptions & {
1272
1390
  paths: string[];
1391
+ runtime?: SessionRuntimeHints;
1273
1392
  update?: boolean;
1274
1393
  /** @deprecated Use backend: 'maestro'. */
1275
1394
  maestro?: boolean;
@@ -1383,7 +1502,11 @@ type AgentDeviceClient = {
1383
1502
  stateDir: (options?: AgentDeviceRequestOverrides & Pick<AgentDeviceClientConfig, 'stateDir'>) => Promise<string>;
1384
1503
  close: (options?: AgentDeviceRequestOverrides & {
1385
1504
  shutdown?: boolean;
1505
+ saveScript?: boolean | string;
1506
+ /** #1258: overwrite an existing --save-script target instead of refusing. Alias: --overwrite. */
1507
+ force?: boolean;
1386
1508
  }) => Promise<SessionCloseResult>;
1509
+ saveScript: (options?: SessionSaveScriptOptions) => Promise<SessionSaveScriptResult>;
1387
1510
  artifacts: (options?: CloudArtifactsOptions) => Promise<AgentArtifactsResult>;
1388
1511
  };
1389
1512
  apps: {
@@ -1414,30 +1537,30 @@ type AgentDeviceClient = {
1414
1537
  capture: {
1415
1538
  snapshot: (options?: CaptureSnapshotOptions) => Promise<CaptureSnapshotResult>;
1416
1539
  screenshot: (options?: CaptureScreenshotOptions) => Promise<CaptureScreenshotResult>;
1417
- diff: (options: CaptureDiffOptions) => Promise<CommandRequestResult>;
1540
+ diff: (options: CaptureDiffOptions) => Promise<CommandResult<'diff'>>;
1418
1541
  };
1419
1542
  interactions: {
1420
- click: (options: ClickOptions) => Promise<CommandRequestResult>;
1421
- press: (options: PressOptions) => Promise<CommandRequestResult>;
1422
- longPress: (options: LongPressOptions) => Promise<CommandRequestResult>;
1543
+ click: (options: ClickOptions) => Promise<CommandResult<'click'>>;
1544
+ press: (options: PressOptions) => Promise<CommandResult<'press'>>;
1545
+ longPress: (options: LongPressOptions) => Promise<CommandResult<'longpress'>>;
1423
1546
  swipe: (options: SwipeOptions) => Promise<CommandRequestResult>;
1424
1547
  pan: (options: PanOptions) => Promise<CommandRequestResult>;
1425
1548
  fling: (options: FlingOptions) => Promise<CommandRequestResult>;
1426
1549
  swipeGesture: (options: SwipeGestureOptions) => Promise<CommandRequestResult>;
1427
1550
  focus: (options: FocusOptions) => Promise<CommandRequestResult>;
1428
1551
  type: (options: TypeTextOptions) => Promise<CommandRequestResult>;
1429
- fill: (options: FillOptions) => Promise<CommandRequestResult>;
1552
+ fill: (options: FillOptions) => Promise<CommandResult<'fill'>>;
1430
1553
  scroll: (options: ScrollOptions) => Promise<CommandRequestResult>;
1431
1554
  pinch: (options: PinchOptions) => Promise<CommandRequestResult>;
1432
1555
  rotateGesture: (options: RotateGestureOptions) => Promise<CommandRequestResult>;
1433
1556
  transformGesture: (options: TransformGestureOptions) => Promise<CommandRequestResult>;
1434
1557
  get: (options: GetOptions) => Promise<CommandRequestResult>;
1435
1558
  is: (options: IsOptions) => Promise<CommandRequestResult>;
1436
- find: (options: FindOptions) => Promise<CommandRequestResult>;
1559
+ find: (options: FindOptions) => Promise<CommandResult<'find'>>;
1437
1560
  };
1438
1561
  replay: {
1439
- run: (options: ReplayRunOptions) => Promise<CommandRequestResult>;
1440
- test: (options: ReplayTestOptions) => Promise<CommandRequestResult>;
1562
+ run: (options: ReplayRunOptions) => Promise<CommandResult<'replay'>>;
1563
+ test: (options: ReplayTestOptions) => Promise<CommandResult<'test'>>;
1441
1564
  };
1442
1565
  batch: {
1443
1566
  run: (options: BatchRunOptions) => Promise<BatchRunResult>;
@@ -1453,15 +1576,15 @@ type AgentDeviceClient = {
1453
1576
  symbols: (options: DebugSymbolsOptions) => Promise<DebugSymbolsResult>;
1454
1577
  };
1455
1578
  recording: {
1456
- record: (options: RecordOptions) => Promise<CommandRequestResult>;
1457
- trace: (options: TraceOptions) => Promise<CommandRequestResult>;
1579
+ record: (options: RecordOptions) => Promise<CommandResult<'record'>>;
1580
+ trace: (options: TraceOptions) => Promise<CommandResult<'trace'>>;
1458
1581
  };
1459
1582
  settings: {
1460
1583
  update: (options: SettingsUpdateOptions) => Promise<CommandRequestResult>;
1461
1584
  };
1462
1585
  };
1463
1586
  //#endregion
1464
- //#region src/client/client.d.ts
1587
+ //#region src/agent-device-client.d.ts
1465
1588
  declare function createAgentDeviceClient(config?: AgentDeviceClientConfig, deps?: {
1466
1589
  transport?: AgentDeviceDaemonTransport;
1467
1590
  }): AgentDeviceClient;