agent-device 0.18.3 → 0.19.1

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 (219) hide show
  1. package/README.md +5 -1
  2. package/android-multitouch-helper/dist/{agent-device-android-multitouch-helper-0.18.3.apk → agent-device-android-multitouch-helper-0.19.1.apk} +0 -0
  3. package/android-multitouch-helper/dist/agent-device-android-multitouch-helper-0.19.1.apk.sha256 +1 -0
  4. package/android-multitouch-helper/dist/{agent-device-android-multitouch-helper-0.18.3.manifest.json → agent-device-android-multitouch-helper-0.19.1.manifest.json} +4 -4
  5. package/android-snapshot-helper/dist/{agent-device-android-snapshot-helper-0.18.3.apk → agent-device-android-snapshot-helper-0.19.1.apk} +0 -0
  6. package/android-snapshot-helper/dist/agent-device-android-snapshot-helper-0.19.1.apk.sha256 +1 -0
  7. package/android-snapshot-helper/dist/{agent-device-android-snapshot-helper-0.18.3.manifest.json → agent-device-android-snapshot-helper-0.19.1.manifest.json} +6 -6
  8. package/dist/apple-runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTapPointPolicy.swift +28 -0
  9. package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+AXSnapshotFallback.swift +33 -127
  10. package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+CommandExecution.swift +630 -177
  11. package/dist/apple-runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+CommandJournal.swift +155 -0
  12. package/dist/apple-runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+FlatSnapshotFiltering.swift +67 -0
  13. package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Interaction.swift +173 -122
  14. package/dist/apple-runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Navigation.swift +172 -0
  15. package/dist/apple-runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+ScrollGesture.swift +64 -0
  16. package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SequenceExecution.swift +76 -182
  17. package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Snapshot.swift +92 -51
  18. package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SnapshotCapturePlan.swift +213 -137
  19. package/dist/apple-runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SynthesizedGesturePolicy.swift +142 -0
  20. package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+TextEntry.swift +208 -46
  21. package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Transport.swift +82 -11
  22. package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests.swift +74 -0
  23. package/dist/src/agent-browser-tool.js +1 -0
  24. package/dist/src/android-adb.d.ts +63 -234
  25. package/dist/src/android-adb.js +1 -1
  26. package/dist/src/android-input-ownership.js +6 -0
  27. package/dist/src/android.js +1 -5
  28. package/dist/src/app-lifecycle.js +7 -0
  29. package/dist/src/apple-runner-options.js +1 -0
  30. package/dist/src/apps.js +5 -11
  31. package/dist/src/artifacts.d.ts +4 -3
  32. package/dist/src/artifacts.js +1 -1
  33. package/dist/src/audio-probe.js +1 -1
  34. package/dist/src/batch.d.ts +2 -177
  35. package/dist/src/batch.js +1 -1
  36. package/dist/src/cli-help.js +178 -60
  37. package/dist/src/cli-output.js +1 -1
  38. package/dist/src/cli-runner.js +2 -0
  39. package/dist/src/cli.js +12 -41
  40. package/dist/src/client-metro-companion.js +1 -0
  41. package/dist/src/client.js +3 -0
  42. package/dist/src/command-metadata.js +1 -0
  43. package/dist/src/command-schema.js +22 -0
  44. package/dist/src/command-surface.js +1 -1
  45. package/dist/src/contracts.d.ts +2 -213
  46. package/dist/src/contracts.js +1 -1
  47. package/dist/src/debug-symbols.js +5 -3
  48. package/dist/src/device-input-state.js +2 -0
  49. package/dist/src/devices.js +1 -1
  50. package/dist/src/devices2.js +1 -0
  51. package/dist/src/devices3.js +1 -0
  52. package/dist/src/find.js +1 -1
  53. package/dist/src/finders.d.ts +2 -81
  54. package/dist/src/finders.js +1 -1
  55. package/dist/src/generic.js +1 -1
  56. package/dist/src/handler-utils.js +1 -1
  57. package/dist/src/helper.js +2 -0
  58. package/dist/src/host-process.js +2 -0
  59. package/dist/src/index.d.ts +1444 -1786
  60. package/dist/src/index.js +1 -1
  61. package/dist/src/input-actions.js +3 -1
  62. package/dist/src/input-actions2.js +1 -0
  63. package/dist/src/install-source.d.ts +13 -14
  64. package/dist/src/install-source.js +1 -1
  65. package/dist/src/install-source2.js +1 -0
  66. package/dist/src/interaction-snapshot.js +1 -0
  67. package/dist/src/interaction.js +1 -1
  68. package/dist/src/interactor.js +2 -1
  69. package/dist/src/internal/bin.d.ts +1 -1
  70. package/dist/src/internal/bin.js +2 -5
  71. package/dist/src/internal/companion-tunnel.d.ts +1 -1
  72. package/dist/src/internal/companion-tunnel.js +1 -1
  73. package/dist/src/internal/daemon.d.ts +1 -1
  74. package/dist/src/internal/daemon.js +18 -1
  75. package/dist/src/internal/png-worker.d.ts +29 -26
  76. package/dist/src/internal/png-worker.js +1 -1
  77. package/dist/src/internal/update-check-entry.d.ts +1 -1
  78. package/dist/src/internal/update-check-entry.js +1 -1
  79. package/dist/src/io.d.ts +2 -85
  80. package/dist/src/io.js +1 -1
  81. package/dist/src/lease.js +1 -1
  82. package/dist/src/linux.js +1 -1
  83. package/dist/src/manifest.js +1 -0
  84. package/dist/src/metro.d.ts +69 -113
  85. package/dist/src/metro.js +1 -1
  86. package/dist/src/metro2.js +1 -0
  87. package/dist/src/notifications.js +1 -1
  88. package/dist/src/output-path.js +1 -0
  89. package/dist/src/path-resolution.js +1 -0
  90. package/dist/src/png-worker-contract.js +1 -0
  91. package/dist/src/points.js +4 -0
  92. package/dist/src/project-runtime.js +1 -0
  93. package/dist/src/provider.js +1 -1
  94. package/dist/src/providers.js +1 -0
  95. package/dist/src/react-native.js +1 -1
  96. package/dist/src/record-trace-recording.js +2 -5
  97. package/dist/src/record-trace.js +1 -1
  98. package/dist/src/recording-provider.js +1 -1
  99. package/dist/src/registry.js +38 -0
  100. package/dist/src/remote-config.d.ts +2 -83
  101. package/dist/src/reporting.js +9 -0
  102. package/dist/src/rolldown-runtime.js +1 -0
  103. package/dist/src/runner-client.js +1 -0
  104. package/dist/src/runner-provider.js +1 -0
  105. package/dist/src/runner-sequence.js +1 -1
  106. package/dist/src/runtime-transport.js +1 -0
  107. package/dist/src/runtime.js +3 -0
  108. package/dist/src/scoped-provider.js +1 -0
  109. package/dist/src/sdk-android-adb.d.ts +144 -0
  110. package/dist/src/sdk-android-adb.js +4 -0
  111. package/dist/src/sdk-app-inventory.d.ts +4 -0
  112. package/dist/src/sdk-app-inventory.js +1 -0
  113. package/dist/src/sdk-batch-runner.d.ts +39 -0
  114. package/dist/src/sdk-batch-runner.js +2 -0
  115. package/dist/src/sdk-batch.js +2 -0
  116. package/dist/src/sdk-contracts.d.ts +386 -0
  117. package/dist/src/sdk-contracts.js +2 -0
  118. package/dist/src/sdk-finders.d.ts +60 -0
  119. package/dist/src/sdk-finders.js +1 -0
  120. package/dist/src/sdk-io.d.ts +78 -0
  121. package/dist/src/sdk-io.js +1 -0
  122. package/dist/src/sdk-remote-config.d.ts +139 -0
  123. package/dist/src/sdk-remote-config.js +1 -0
  124. package/dist/src/sdk-selectors.js +1 -0
  125. package/dist/src/selector-runtime.js +1 -1
  126. package/dist/src/selectors.d.ts +38 -137
  127. package/dist/src/selectors.js +1 -1
  128. package/dist/src/selectors2.js +1 -0
  129. package/dist/src/server.js +3 -2
  130. package/dist/src/session.js +10 -11
  131. package/dist/src/setting-state.js +1 -0
  132. package/dist/src/simctl.js +1 -0
  133. package/dist/src/simulator.js +1 -2
  134. package/dist/src/snapshot-diagnostics.js +3 -0
  135. package/dist/src/snapshot-helper.js +5 -0
  136. package/dist/src/snapshot-quality.js +1 -0
  137. package/dist/src/snapshot.js +1 -2
  138. package/dist/src/snapshot2.js +2 -0
  139. package/dist/src/{5560.js → timeouts.js} +1 -1
  140. package/dist/src/tool-provider.js +3 -0
  141. package/dist/src/tool-provider2.js +1 -0
  142. package/dist/src/ttl-memo.js +1 -0
  143. package/dist/src/tv-remote.js +14 -0
  144. package/dist/src/update-check.js +1 -0
  145. package/dist/src/url.js +1 -0
  146. package/dist/src/version.js +1 -0
  147. package/dist/src/web.js +1 -1
  148. package/dist/src/xml.js +2 -0
  149. package/package.json +13 -19
  150. package/server.json +2 -2
  151. package/skills/agent-device/SKILL.md +8 -7
  152. package/android-multitouch-helper/dist/agent-device-android-multitouch-helper-0.18.3.apk.sha256 +0 -1
  153. package/android-snapshot-helper/dist/agent-device-android-snapshot-helper-0.18.3.apk.sha256 +0 -1
  154. package/apple-runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+CommandJournal.swift +0 -443
  155. package/apple-runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+FlatSnapshotFiltering.swift +0 -169
  156. package/apple-runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+ScrollGesture.swift +0 -220
  157. package/dist/src/1404.js +0 -1
  158. package/dist/src/1986.js +0 -1
  159. package/dist/src/2748.js +0 -1
  160. package/dist/src/2948.js +0 -30
  161. package/dist/src/3006.js +0 -1
  162. package/dist/src/314.js +0 -1
  163. package/dist/src/3340.js +0 -8
  164. package/dist/src/4418.js +0 -1
  165. package/dist/src/4428.js +0 -3
  166. package/dist/src/485.js +0 -1
  167. package/dist/src/4917.js +0 -1
  168. package/dist/src/495.js +0 -5
  169. package/dist/src/5448.js +0 -3
  170. package/dist/src/5484.js +0 -1
  171. package/dist/src/5643.js +0 -1
  172. package/dist/src/587.js +0 -1
  173. package/dist/src/5913.js +0 -4
  174. package/dist/src/6849.js +0 -1
  175. package/dist/src/6918.js +0 -1
  176. package/dist/src/6967.js +0 -1
  177. package/dist/src/760.js +0 -1
  178. package/dist/src/7871.js +0 -1
  179. package/dist/src/8184.js +0 -1
  180. package/dist/src/8225.js +0 -1
  181. package/dist/src/8391.js +0 -1
  182. package/dist/src/8404.js +0 -2
  183. package/dist/src/8414.js +0 -2
  184. package/dist/src/8875.js +0 -4
  185. package/dist/src/893.js +0 -1
  186. package/dist/src/8936.js +0 -1
  187. package/dist/src/9414.js +0 -1
  188. package/dist/src/9581.js +0 -22
  189. package/dist/src/9612.js +0 -1
  190. package/dist/src/9624.js +0 -1
  191. package/dist/src/9722.js +0 -39
  192. package/dist/src/devices~1.js +0 -1
  193. package/dist/src/devices~2.js +0 -1
  194. package/dist/src/input-actions~1.js +0 -1
  195. package/dist/src/rslib-runtime.js +0 -1
  196. /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunner/AgentDeviceRunnerApp.m +0 -0
  197. /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunner.xcodeproj/project.pbxproj +0 -0
  198. /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunner.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -0
  199. /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunner.xcodeproj/xcshareddata/xcschemes/AgentDeviceRunner.xcscheme +0 -0
  200. /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/AgentDeviceRunnerUITests-Bridging-Header.h +0 -0
  201. /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/AgentDeviceRunnerUITests.entitlements +0 -0
  202. /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerAXSnapshotBridge.h +0 -0
  203. /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerAXSnapshotBridge.m +0 -0
  204. /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerObjCExceptionCatcher.h +0 -0
  205. /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerObjCExceptionCatcher.m +0 -0
  206. /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerSynthesizedGesture.h +0 -0
  207. /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerSynthesizedGesture.m +0 -0
  208. /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Alert.swift +0 -0
  209. /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Environment.swift +0 -0
  210. /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Exceptions.swift +0 -0
  211. /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Lifecycle.swift +0 -0
  212. /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Models.swift +0 -0
  213. /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+ScreenRecorder.swift +0 -0
  214. /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SystemModal.swift +0 -0
  215. /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+TvRemote.swift +0 -0
  216. /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests.xctestplan +0 -0
  217. /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/RecordingScripts/recording-overlay.swift +0 -0
  218. /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/RecordingScripts/recording-resize.swift +0 -0
  219. /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/RecordingScripts/recording-trim.swift +0 -0
@@ -1,26 +1,29 @@
1
- declare type PngWorkerJobResult = {
2
- kind: 'decode';
3
- width: number;
4
- height: number;
5
- data: Uint8Array;
6
- } | {
7
- kind: 'encode';
8
- png: Uint8Array;
9
- } | ({
10
- kind: 'diff-pixels';
11
- } & ScreenshotDiffPixelsResult);
12
-
13
- /**
14
- * Transfers result buffers instead of structured-cloning them, but only when a
15
- * view fully owns its ArrayBuffer. Exported for direct unit coverage; the
16
- * worker itself is the only runtime caller.
17
- */
18
- export declare function resultTransferList(result: PngWorkerJobResult): ArrayBuffer[];
19
-
20
- declare type ScreenshotDiffPixelsResult = {
21
- diffData: Buffer;
22
- diffMask: Uint8Array;
23
- differentPixels: number;
24
- };
25
-
26
- export { }
1
+ //#region src/utils/screenshot-diff-pixels.d.ts
2
+ type ScreenshotDiffPixelsResult = {
3
+ diffData: Buffer;
4
+ diffMask: Uint8Array;
5
+ differentPixels: number;
6
+ };
7
+ //#endregion
8
+ //#region src/utils/png-worker-contract.d.ts
9
+ type PngWorkerJobResult = {
10
+ kind: 'decode';
11
+ width: number;
12
+ height: number;
13
+ data: Uint8Array;
14
+ } | {
15
+ kind: 'encode';
16
+ png: Uint8Array;
17
+ } | ({
18
+ kind: 'diff-pixels';
19
+ } & ScreenshotDiffPixelsResult);
20
+ //#endregion
21
+ //#region src/utils/png-worker.d.ts
22
+ /**
23
+ * Transfers result buffers instead of structured-cloning them, but only when a
24
+ * view fully owns its ArrayBuffer. Exported for direct unit coverage; the
25
+ * worker itself is the only runtime caller.
26
+ */
27
+ declare function resultTransferList(result: PngWorkerJobResult): ArrayBuffer[];
28
+ //#endregion
29
+ export { resultTransferList };
@@ -1 +1 @@
1
- import{parentPort as e}from"node:worker_threads";import{normalizeError as t}from"../485.js";import{computeScreenshotDiffPixels as r,PNG as i,toBuffer as n,decodePng as d}from"../4418.js";function f(e){return e.buffer instanceof ArrayBuffer&&0===e.byteOffset&&e.byteLength===e.buffer.byteLength}function a(e){return(function(e){switch(e.kind){case"decode":return[e.data];case"encode":return[e.png];case"diff-pixels":return[e.diffData,e.diffMask]}})(e).filter(f).map(e=>e.buffer)}e&&e.on("message",f=>{let o;try{o={id:f.id,ok:!0,result:function(e){switch(e.kind){case"decode":{let t=d(n(e.png),e.label);return{kind:"decode",width:t.width,height:t.height,data:t.data}}case"encode":{let t=new i({width:e.width,height:e.height,data:n(e.data)});return{kind:"encode",png:i.sync.write(t)}}case"diff-pixels":return{kind:"diff-pixels",...r(e)}}}(f)}}catch(e){o={id:f.id,ok:!1,error:t(e)}}e.postMessage(o,o.ok?a(o.result):[])});export{a as resultTransferList};
1
+ import{B as e}from"../sdk-contracts.js";import{i as t,n,r,t as i}from"../png-worker-contract.js";import{parentPort as a}from"node:worker_threads";function o(e){switch(e.kind){case`decode`:{let t=r(i(e.png),e.label);return{kind:`decode`,width:t.width,height:t.height,data:t.data}}case`encode`:{let n=new t({width:e.width,height:e.height,data:i(e.data)});return{kind:`encode`,png:t.sync.write(n)}}case`diff-pixels`:return{kind:`diff-pixels`,...n(e)}}}function s(e){return e.buffer instanceof ArrayBuffer&&e.byteOffset===0&&e.byteLength===e.buffer.byteLength}function c(e){return l(e).filter(s).map(e=>e.buffer)}function l(e){switch(e.kind){case`decode`:return[e.data];case`encode`:return[e.png];case`diff-pixels`:return[e.diffData,e.diffMask]}}const u=a;u&&u.on(`message`,t=>{let n;try{n={id:t.id,ok:!0,result:o(t)}}catch(r){n={id:t.id,ok:!1,error:e(r)}}u.postMessage(n,n.ok?c(n.result):[])});export{c as resultTransferList};
@@ -1 +1 @@
1
- export { }
1
+ export { };
@@ -1 +1 @@
1
- import{readUpdateCheckWorkerArgs as e,runUpdateCheckWorker as o}from"../5448.js";let r=e(process.argv.slice(2));r&&o(r).catch(()=>{process.exitCode=0});
1
+ import{n as e,r as t}from"../update-check.js";const n=e(process.argv.slice(2));n&&t(n).catch(()=>{process.exitCode=0});export{};
package/dist/src/io.d.ts CHANGED
@@ -1,85 +1,2 @@
1
- export declare type ArtifactAdapter = {
2
- resolveInput(ref: FileInputRef, options: ResolveInputOptions): Promise<ResolvedInputFile>;
3
- reserveOutput(ref: FileOutputRef | undefined, options: ReserveOutputOptions): Promise<ReservedOutputFile>;
4
- createTempFile(options: CreateTempFileOptions): Promise<TemporaryFile>;
5
- };
6
-
7
- export declare type ArtifactDescriptor = {
8
- kind: 'localPath';
9
- field: string;
10
- path: string;
11
- fileName?: string;
12
- metadata?: Record<string, unknown>;
13
- } | {
14
- kind: 'artifact';
15
- field: string;
16
- artifactId: string;
17
- fileName?: string;
18
- url?: string;
19
- clientPath?: string;
20
- metadata?: Record<string, unknown>;
21
- };
22
-
23
- export declare function createLocalArtifactAdapter(options?: LocalArtifactAdapterOptions): ArtifactAdapter;
24
-
25
- export declare type CreateTempFileOptions = {
26
- prefix: string;
27
- ext: string;
28
- };
29
-
30
- export declare type FileInputRef = {
31
- kind: 'path';
32
- path: string;
33
- } | {
34
- kind: 'uploadedArtifact';
35
- id: string;
36
- };
37
-
38
- export declare type FileOutputRef = {
39
- kind: 'path';
40
- path: string;
41
- } | {
42
- kind: 'downloadableArtifact';
43
- clientPath?: string;
44
- fileName?: string;
45
- };
46
-
47
- export declare type LocalArtifactAdapterOptions = {
48
- cwd?: string;
49
- tempDir?: string;
50
- rootDir?: string;
51
- };
52
-
53
- export declare type OutputVisibility = 'client-visible' | 'internal';
54
-
55
- export declare type ReservedOutputFile = {
56
- path: string;
57
- visibility: OutputVisibility;
58
- publish: () => Promise<ArtifactDescriptor | undefined>;
59
- cleanup?: () => Promise<void>;
60
- };
61
-
62
- export declare type ReserveOutputOptions = {
63
- field: string;
64
- ext: string;
65
- requestedClientPath?: string;
66
- visibility?: OutputVisibility;
67
- };
68
-
69
- export declare type ResolvedInputFile = {
70
- path: string;
71
- cleanup?: () => Promise<void>;
72
- };
73
-
74
- export declare type ResolveInputOptions = {
75
- usage: string;
76
- field?: string;
77
- };
78
-
79
- export declare type TemporaryFile = {
80
- path: string;
81
- visibility: 'internal';
82
- cleanup: () => Promise<void>;
83
- };
84
-
85
- export { }
1
+ import { a as FileOutputRef, c as ReserveOutputOptions, d as ResolvedInputFile, f as TemporaryFile, i as FileInputRef, l as ReservedOutputFile, n as ArtifactDescriptor, o as LocalArtifactAdapterOptions, p as createLocalArtifactAdapter, r as CreateTempFileOptions, s as OutputVisibility, t as ArtifactAdapter, u as ResolveInputOptions } from "./sdk-io.js";
2
+ export { ArtifactAdapter, ArtifactDescriptor, CreateTempFileOptions, FileInputRef, FileOutputRef, LocalArtifactAdapterOptions, OutputVisibility, ReserveOutputOptions, ReservedOutputFile, ResolveInputOptions, ResolvedInputFile, TemporaryFile, createLocalArtifactAdapter };
package/dist/src/io.js CHANGED
@@ -1 +1 @@
1
- export{createLocalArtifactAdapter}from"./314.js";
1
+ import{t as e}from"./sdk-io.js";export{e as createLocalArtifactAdapter};
package/dist/src/lease.js CHANGED
@@ -1 +1 @@
1
- import{PUBLIC_COMMANDS as e}from"./1986.js";import{listDownloadableArtifacts as a,resolveRequestOrSessionLeaseScope as r,resolveLeaseScope as t}from"./9722.js";import{isProxyLeaseScope as o,leaseScopeToReleaseRequest as s,leaseScopeToAllocateRequest as i,leaseScopeToHeartbeatRequest as l}from"./2948.js";import{AppError as n}from"./485.js";async function d(a){let{req:o,sessionName:n,sessionStore:d,leaseRegistry:_,leaseLifecycleProvider:u,cloudArtifactProvider:v}=a,f=t(o);switch(o.command){case e.artifacts:{let e=r(o,d.get(n));return{ok:!0,data:await c(o,e,v)}}case"lease_allocate":{let e,a=_.allocateLease(i(f));try{e=await u?.allocate?.(a,{req:o})}catch(e){throw _.releaseLease(s({leaseId:a.leaseId,tenantId:a.tenantId,runId:a.runId,leaseBackend:a.backend,leaseProvider:a.leaseProvider,deviceKey:a.deviceKey,clientId:a.clientId})),e}return{ok:!0,data:{lease:a,...e?{provider:e}:{}}}}case"lease_heartbeat":{let e=_.heartbeatLease(l(f)),a=await u?.heartbeat?.(e,{req:o});return{ok:!0,data:{lease:e,...a?{provider:a}:{}}}}case"lease_release":{let e=_.releaseLease(s(f)),a=e.lease?await u?.release?.(e.lease,{req:o}):void 0;return{ok:!0,data:{released:e.released,...a?{provider:a}:{}}}}default:return null}}async function c(e,a,r){var t,s,i;let l,n=(t=e.flags,"string"==typeof(l=t?.providerSessionId)&&l.length>0?l:void 0);return(s=a,i=n,!o(s)&&(s.leaseProvider||i))?await u(a,n,r):await _(a.tenantId)}async function _(e){let r=await a(e);return{source:"daemon",status:"ready",artifacts:r,...0===r.length?{message:"No daemon artifacts available."}:{}}}async function u(e,a,r){if(!e.leaseProvider)throw new n("INVALID_ARGS","artifacts requires --provider for provider session lookup or an active cloud connection.");if(!e.leaseId&&!a)throw new n("INVALID_ARGS","artifacts requires an active cloud lease or --provider-session <id>.");let t=await r?.listCloudArtifacts?.({provider:e.leaseProvider,leaseId:e.leaseId,providerSessionId:a});if(!t)throw new n("UNSUPPORTED_OPERATION",`Cloud artifacts are not available for provider "${e.leaseProvider}".`);return t}export{d as handleLeaseCommands};
1
+ import{F as e}from"./sdk-contracts.js";import{In as t,On as n,Pn as r,Qn as i,jn as a}from"./tv-remote.js";import{Bt as o,Vt as s,yn as c}from"./internal/daemon.js";async function l(e){let{req:n,sessionName:c,sessionStore:l,leaseRegistry:d,leaseLifecycleProvider:f,cloudArtifactProvider:p}=e,m=o(n);switch(n.command){case i.artifacts:return{ok:!0,data:await u(n,s(n,l.get(c)),p)};case`lease_allocate`:{let e=d.allocateLease(a(m)),r;try{r=await f?.allocate?.(e,{req:n})}catch(n){throw d.releaseLease(t({leaseId:e.leaseId,tenantId:e.tenantId,runId:e.runId,leaseBackend:e.backend,leaseProvider:e.leaseProvider,deviceKey:e.deviceKey,clientId:e.clientId})),n}return{ok:!0,data:{lease:e,...r?{provider:r}:{}}}}case`lease_heartbeat`:{let e=d.heartbeatLease(r(m)),t=await f?.heartbeat?.(e,{req:n});return{ok:!0,data:{lease:e,...t?{provider:t}:{}}}}case`lease_release`:{let e=d.releaseLease(t(m)),r=e.lease?await f?.release?.(e.lease,{req:n}):void 0;return{ok:!0,data:{released:e.released,...r?{provider:r}:{}}}}default:return null}}async function u(e,t,n){let r=m(e.flags,`providerSessionId`);return d(t,r)?await f(t.tenantId):await p(t,r,n)}function d(e,t){return n(e)||!e.leaseProvider&&!t}async function f(e){let t=await c(e);return{source:`daemon`,status:`ready`,artifacts:t,...t.length===0?{message:`No daemon artifacts available.`}:{}}}async function p(t,n,r){if(!t.leaseProvider)throw new e(`INVALID_ARGS`,`artifacts requires --provider for provider session lookup or an active cloud connection.`);if(!t.leaseId&&!n)throw new e(`INVALID_ARGS`,`artifacts requires an active cloud lease or --provider-session <id>.`);let i=await r?.listCloudArtifacts?.({provider:t.leaseProvider,leaseId:t.leaseId,providerSessionId:n});if(!i)throw new e(`UNSUPPORTED_OPERATION`,`Cloud artifacts are not available for provider "${t.leaseProvider}".`);return i}function m(e,t){let n=e?.[t];return typeof n==`string`&&n.length>0?n:void 0}export{l as handleLeaseCommands};
package/dist/src/linux.js CHANGED
@@ -1 +1 @@
1
- import{longPressLinux as t,pressLinux as e,typeLinux as n,scrollLinux as o,sendKey as r,fillLinux as a,focusLinux as i,swipeLinux as s,doubleClickLinux as p}from"./input-actions~1.js";import{snapshotLinux as u,resolveLinuxToolProvider as c}from"./9722.js";import{AppError as w}from"./485.js";import{withDiagnosticTimer as _}from"./8875.js";async function P(t){await c().desktop.openTarget(t)}async function d(t){await c().desktop.closeApp(t)}async function O(){await r("alt+Left",["56:1","105:1","105:0","56:0"])}async function f(){await r("super+d",["125:1","32:1","32:0","125:0"])}async function l(){return await c().clipboard.readText()}async function S(t){await c().clipboard.writeText(t)}async function E(t,e){await c().screenshot.capture(t,e)}function N(){return{open:t=>P(t),openDevice:()=>Promise.resolve(),close:t=>d(t),tap:(t,n)=>e(t,n),doubleTap:(t,e)=>p(t,e),swipe:(t,e,n,o,r)=>s(t,e,n,o,r),pan:(t,e,n,o,r)=>s(t,e,n,o,r),fling:()=>{throw new w("UNSUPPORTED_OPERATION","gesture fling not supported on Linux")},longPress:(e,n,o)=>t(e,n,o),focus:(t,e)=>i(t,e),type:(t,e)=>n(t,e),fill:(t,e,n,o)=>a(t,e,n,o),scroll:(t,e)=>o(t,e),pinch:()=>{throw new w("UNSUPPORTED_OPERATION","gesture pinch not supported on Linux")},screenshot:(t,e)=>E(t,e),snapshot:async t=>{let e=await _("snapshot_capture",async()=>await u(t?.surface),{backend:"linux-atspi"});return{nodes:e.nodes??[],truncated:e.truncated??!1,backend:"linux-atspi"}},back:()=>O(),home:()=>f(),rotate:()=>{throw new w("UNSUPPORTED_OPERATION","rotate not supported on Linux")},rotateGesture:()=>{throw new w("UNSUPPORTED_OPERATION","gesture rotate not supported on Linux")},transformGesture:()=>{throw new w("UNSUPPORTED_OPERATION","gesture transform not supported on Linux")},appSwitcher:()=>{throw new w("UNSUPPORTED_OPERATION","appSwitcher not yet supported on Linux")},readClipboard:()=>l(),writeClipboard:t=>S(t),setSetting:()=>{throw new w("UNSUPPORTED_OPERATION","setSetting not supported on Linux")}}}export{N as createLinuxInteractor};
1
+ import{F as e}from"./sdk-contracts.js";import{F as t}from"./sdk-android-adb.js";import{t as n}from"./snapshot.js";import{t as r}from"./tool-provider2.js";import{doubleClickLinux as i,fillLinux as a,focusLinux as o,longPressLinux as s,pressLinux as c,scrollLinux as l,sendKey as u,swipeLinux as d,typeLinux as f}from"./input-actions2.js";async function p(e){await r().desktop.openTarget(e)}async function m(e){await r().desktop.closeApp(e)}async function h(){await u(`alt+Left`,[`56:1`,`105:1`,`105:0`,`56:0`])}async function g(){await u(`super+d`,[`125:1`,`32:1`,`32:0`,`125:0`])}async function _(){return await r().clipboard.readText()}async function v(e){await r().clipboard.writeText(e)}async function y(e,t){await r().screenshot.capture(e,t)}function b(){return{open:e=>p(e),openDevice:()=>Promise.resolve(),close:e=>m(e),tap:(e,t)=>c(e,t),doubleTap:(e,t)=>i(e,t),swipe:(e,t,n,r,i)=>d(e,t,n,r,i),pan:(e,t,n,r,i)=>d(e,t,n,r,i),fling:()=>{throw new e(`UNSUPPORTED_OPERATION`,`gesture fling not supported on Linux`)},longPress:(e,t,n)=>s(e,t,n),focus:(e,t)=>o(e,t),type:(e,t)=>f(e,t),fill:(e,t,n,r)=>a(e,t,n,r),scroll:(e,t)=>l(e,t),pinch:()=>{throw new e(`UNSUPPORTED_OPERATION`,`gesture pinch not supported on Linux`)},screenshot:(e,t)=>y(e,t),snapshot:async e=>{let r=await t(`snapshot_capture`,async()=>await n(e?.surface),{backend:`linux-atspi`});return{nodes:r.nodes??[],truncated:r.truncated??!1,backend:`linux-atspi`}},back:()=>h(),home:()=>g(),rotate:()=>{throw new e(`UNSUPPORTED_OPERATION`,`rotate not supported on Linux`)},rotateGesture:()=>{throw new e(`UNSUPPORTED_OPERATION`,`gesture rotate not supported on Linux`)},transformGesture:()=>{throw new e(`UNSUPPORTED_OPERATION`,`gesture transform not supported on Linux`)},appSwitcher:()=>{throw new e(`UNSUPPORTED_OPERATION`,`appSwitcher not yet supported on Linux`)},tvRemote:()=>{throw new e(`UNSUPPORTED_OPERATION`,`tv-remote not supported on Linux`)},readClipboard:()=>_(),writeClipboard:e=>v(e),setSetting:()=>{throw new e(`UNSUPPORTED_OPERATION`,`setSetting not supported on Linux`)}}}export{b as createLinuxInteractor};
@@ -0,0 +1 @@
1
+ import{m as e,v as t}from"./sdk-android-adb.js";import{promises as n}from"node:fs";import r from"node:os";import i from"node:path";import a from"node:fs/promises";import{TextDecoder as o}from"node:util";const s=[`emulator`,`platform-tools`,i.join(`cmdline-tools`,`latest`,`bin`),i.join(`cmdline-tools`,`tools`,`bin`)];function c(e){let t=new Set,n=[];for(let r of e){let e=r.trim();!e||t.has(e)||(t.add(e),n.push(e))}return n}function l(e=process.env){let t=e.ANDROID_SDK_ROOT?.trim(),n=e.ANDROID_HOME?.trim(),a=e.HOME?.trim()||r.homedir(),o=a?i.join(a,`Android`,`Sdk`):``;return c([t??``,n??``,o])}async function u(e){try{return await n.access(e,n.constants.X_OK),!0}catch{return!1}}async function d(e=process.env){let t=[],n;for(let r of l(e)){let e=[];for(let t of s){let n=i.join(r,t);await u(n)&&e.push(n)}e.length!==0&&(n||=r,t.push(...e))}if(n&&(e.ANDROID_SDK_ROOT=e.ANDROID_SDK_ROOT?.trim()||n,e.ANDROID_HOME=e.ANDROID_HOME?.trim()||n),t.length===0)return;let r=(e.PATH??``).split(i.delimiter).map(e=>e.trim()).filter(e=>e.length>0);e.PATH=c([...t,...r]).join(i.delimiter)}const f=new o(`utf-16le`);let p;async function m(e){for(let t of[`AndroidManifest.xml`,`base/manifest/AndroidManifest.xml`]){let n=await h(e,t);if(!n)continue;let r=g(n);if(r)return r}return await T(e)}async function h(e,n){try{let r=await t(`unzip`,[`-p`,e,n],{allowFailure:!0,binaryStdout:!0});return r.exitCode!==0||!r.stdoutBuffer||r.stdoutBuffer.length===0?void 0:r.stdoutBuffer}catch{return}}function g(e){return e.subarray(0,Math.min(e.length,128)).toString(`utf8`).trimStart().startsWith(`<`)?_(e.toString(`utf8`)):v(e)}function _(e){return e.match(/<manifest\b[^>]*\bpackage\s*=\s*["']([^"']+)["']/i)?.[1]}function v(e){if(e.length<8||e.readUInt16LE(0)!==3)return;let t;for(let n=e.readUInt16LE(2);n+8<=e.length;){let r=e.readUInt16LE(n),i=e.readUInt16LE(n+2),a=e.readUInt32LE(n+4);if(a<=0||n+a>e.length)return;if(r===1)t=b(e.subarray(n,n+a));else if(r===258&&t){let r=y(e,n,i,t);if(r)return r}n+=a}}function y(e,t,n,r){if(n<36||t+n>e.length||r[e.readUInt32LE(t+20)]!==`manifest`)return;let i=e.readUInt16LE(t+24),a=e.readUInt16LE(t+26),o=e.readUInt16LE(t+28),s=t+i;for(let t=0;t<o;t+=1){let n=s+t*a;if(n+20>e.length)return;if(r[e.readUInt32LE(n+4)]!==`package`)continue;let i=e.readUInt32LE(n+8);if(i!==4294967295)return r[i];let o=e.readUInt8(n+15),c=e.readUInt32LE(n+16);return o===3?r[c]:void 0}}function b(e){if(e.length<28)return[];let t=e.readUInt32LE(8),n=e.readUInt32LE(16),r=e.readUInt32LE(20),i=(n&256)!=0,a=[];for(let n=0;n<t;n+=1){let t=28+n*4;if(t+4>e.length)return a;let o=r+e.readUInt32LE(t);a.push(i?x(e,o):S(e,o))}return a}function x(e,t){let[,n]=C(e,t),[r,i]=C(e,t+n),a=t+n+i;return e.subarray(a,a+r).toString(`utf8`)}function S(e,t){let[n,r]=w(e,t),i=t+r;return f.decode(e.subarray(i,i+n*2))}function C(e,t){let n=e.readUInt8(t);if(!(n&128))return[n,1];let r=e.readUInt8(t+1);return[(n&127)<<8|r,2]}function w(e,t){let n=e.readUInt16LE(t);if(!(n&32768))return[n,2];let r=e.readUInt16LE(t+2);return[(n&32767)<<16|r,4]}async function T(e){let n=await E();if(!n)return;let r=await t(n,[`dump`,`badging`,e],{allowFailure:!0});if(r.exitCode===0)return r.stdout.match(/package:\s+name='([^']+)'/)?.[1]}async function E(){if(p!==void 0)return p??void 0;try{for(let t of l()){let n=i.join(t,`build-tools`);try{let t=(await a.readdir(n)).sort((e,t)=>t.localeCompare(e,void 0,{numeric:!0}));for(let r of t){let t=i.join(n,r,`aapt`);if(i.isAbsolute(t)&&await e(t))return p=t,t}}catch{}}}catch{}p=null}export{d as n,m as t};
@@ -1,113 +1,69 @@
1
- export declare function buildBundleUrl(baseUrl: string, platform: 'ios' | 'android'): string;
2
-
3
- export declare type MetroBridgeDescriptor = {
4
- enabled: boolean;
5
- base_url: string;
6
- status_url?: string;
7
- bundle_url?: string;
8
- ios_runtime: MetroBridgeRuntimePayload;
9
- android_runtime: MetroBridgeRuntimePayload;
10
- upstream: {
11
- bundle_url?: string;
12
- host?: string;
13
- port?: number;
14
- status_url?: string;
15
- };
16
- probe: {
17
- reachable: boolean;
18
- status_code: number;
19
- latency_ms: number;
20
- detail: string;
21
- };
22
- };
23
-
24
- declare type MetroBridgeRuntimePayload = {
25
- metro_host?: string;
26
- metro_port?: number;
27
- metro_bundle_url?: string;
28
- launch_url?: string;
29
- };
30
-
31
- declare type MetroTunnelHttpErrorMessage = {
32
- type: 'http-error';
33
- requestId: string;
34
- message: string;
35
- };
36
-
37
- declare type MetroTunnelHttpRequestMessage = {
38
- type: 'http-request';
39
- requestId: string;
40
- method: string;
41
- path: string;
42
- headers?: Record<string, string>;
43
- bodyBase64?: string;
44
- };
45
-
46
- declare type MetroTunnelHttpResponseMessage = {
47
- type: 'http-response';
48
- requestId: string;
49
- status: number;
50
- headers: Record<string, string>;
51
- bodyBase64?: string;
52
- };
53
-
54
- declare type MetroTunnelPingMessage = {
55
- type: 'ping';
56
- timestamp: number;
57
- };
58
-
59
- declare type MetroTunnelPongMessage = {
60
- type: 'pong';
61
- timestamp: number;
62
- };
63
-
64
- export declare type MetroTunnelRequestMessage = MetroTunnelPingMessage | MetroTunnelHttpRequestMessage | MetroTunnelWebSocketOpenMessage | MetroTunnelWebSocketFrameMessage | MetroTunnelWebSocketCloseMessage;
65
-
66
- export declare type MetroTunnelResponseMessage = MetroTunnelPongMessage | MetroTunnelHttpResponseMessage | MetroTunnelHttpErrorMessage | MetroTunnelWebSocketOpenResultMessage | MetroTunnelWebSocketFrameMessage | MetroTunnelWebSocketCloseMessage;
67
-
68
- declare type MetroTunnelWebSocketCloseMessage = {
69
- type: 'ws-close';
70
- streamId: string;
71
- code?: number;
72
- reason?: string;
73
- };
74
-
75
- declare type MetroTunnelWebSocketFrameMessage = {
76
- type: 'ws-frame';
77
- streamId: string;
78
- dataBase64: string;
79
- binary: boolean;
80
- };
81
-
82
- declare type MetroTunnelWebSocketOpenMessage = {
83
- type: 'ws-open';
84
- streamId: string;
85
- path: string;
86
- headers?: Record<string, string>;
87
- };
88
-
89
- declare type MetroTunnelWebSocketOpenResultMessage = {
90
- type: 'ws-open-result';
91
- streamId: string;
92
- success: boolean;
93
- headers?: Record<string, string>;
94
- error?: string;
95
- };
96
-
97
- export declare function normalizeBaseUrl(input: string): string;
98
-
99
- export declare function resolveRuntimeTransport(runtime: SessionRuntimeHints | undefined): {
100
- host: string;
101
- port: number;
102
- scheme: 'http' | 'https';
103
- } | undefined;
104
-
105
- declare type SessionRuntimeHints = {
106
- platform?: 'ios' | 'android';
107
- metroHost?: string;
108
- metroPort?: number;
109
- bundleUrl?: string;
110
- launchUrl?: string;
111
- };
112
-
113
- export { }
1
+ import { y as SessionRuntimeHints } from "./sdk-contracts.js";
2
+ import { s as MetroBridgeDescriptor } from "./sdk-remote-config.js";
3
+ //#region src/utils/url.d.ts
4
+ declare function normalizeBaseUrl(input: string): string;
5
+ declare function buildBundleUrl(baseUrl: string, platform: 'ios' | 'android'): string;
6
+ //#endregion
7
+ //#region src/metro/metro.d.ts
8
+ declare function resolveRuntimeTransport(runtime: SessionRuntimeHints | undefined): {
9
+ host: string;
10
+ port: number;
11
+ scheme: 'http' | 'https';
12
+ } | undefined;
13
+ type MetroTunnelPingMessage = {
14
+ type: 'ping';
15
+ timestamp: number;
16
+ };
17
+ type MetroTunnelPongMessage = {
18
+ type: 'pong';
19
+ timestamp: number;
20
+ };
21
+ type MetroTunnelHttpRequestMessage = {
22
+ type: 'http-request';
23
+ requestId: string;
24
+ method: string;
25
+ path: string;
26
+ headers?: Record<string, string>;
27
+ bodyBase64?: string;
28
+ };
29
+ type MetroTunnelHttpResponseMessage = {
30
+ type: 'http-response';
31
+ requestId: string;
32
+ status: number;
33
+ headers: Record<string, string>;
34
+ bodyBase64?: string;
35
+ };
36
+ type MetroTunnelHttpErrorMessage = {
37
+ type: 'http-error';
38
+ requestId: string;
39
+ message: string;
40
+ };
41
+ type MetroTunnelWebSocketOpenMessage = {
42
+ type: 'ws-open';
43
+ streamId: string;
44
+ path: string;
45
+ headers?: Record<string, string>;
46
+ };
47
+ type MetroTunnelWebSocketOpenResultMessage = {
48
+ type: 'ws-open-result';
49
+ streamId: string;
50
+ success: boolean;
51
+ headers?: Record<string, string>;
52
+ error?: string;
53
+ };
54
+ type MetroTunnelWebSocketFrameMessage = {
55
+ type: 'ws-frame';
56
+ streamId: string;
57
+ dataBase64: string;
58
+ binary: boolean;
59
+ };
60
+ type MetroTunnelWebSocketCloseMessage = {
61
+ type: 'ws-close';
62
+ streamId: string;
63
+ code?: number;
64
+ reason?: string;
65
+ };
66
+ type MetroTunnelRequestMessage = MetroTunnelPingMessage | MetroTunnelHttpRequestMessage | MetroTunnelWebSocketOpenMessage | MetroTunnelWebSocketFrameMessage | MetroTunnelWebSocketCloseMessage;
67
+ type MetroTunnelResponseMessage = MetroTunnelPongMessage | MetroTunnelHttpResponseMessage | MetroTunnelHttpErrorMessage | MetroTunnelWebSocketOpenResultMessage | MetroTunnelWebSocketFrameMessage | MetroTunnelWebSocketCloseMessage;
68
+ //#endregion
69
+ export { type MetroBridgeDescriptor, type MetroTunnelRequestMessage, type MetroTunnelResponseMessage, buildBundleUrl, normalizeBaseUrl, resolveRuntimeTransport };
package/dist/src/metro.js CHANGED
@@ -1 +1 @@
1
- export{buildBundleUrl,normalizeBaseUrl}from"./4917.js";export{resolveRuntimeTransport}from"./6967.js";
1
+ import{n as e,t}from"./url.js";import{t as n}from"./metro2.js";export{t as buildBundleUrl,e as normalizeBaseUrl,n as resolveRuntimeTransport};
@@ -0,0 +1 @@
1
+ import{n as e}from"./client-metro-companion.js";import{t}from"./runtime-transport.js";function n(e){return t(e)}async function r(t){await e(t)}export{r as n,n as t};
@@ -1 +1 @@
1
- import{AppError as e}from"./485.js";import{runAndroidAdb as r}from"./3340.js";async function t(t,o,i){let n="string"==typeof i.action&&i.action.trim()?i.action.trim():`${o}.TEST_PUSH`,s=["shell","am","broadcast","-a",n,"-p",o],a="string"==typeof i.receiver?i.receiver.trim():"";a&&s.push("-n",a);let p=i.extras;if(void 0!==p&&("object"!=typeof p||null===p||Array.isArray(p)))throw new e("INVALID_ARGS","Android push payload extras must be an object");let u=0;for(let[r,t]of Object.entries(p??{}))r&&(function(r,t,o){if("string"==typeof o)return r.push("--es",t,o);if("boolean"==typeof o)return r.push("--ez",t,o?"true":"false");if("number"==typeof o&&Number.isFinite(o))return Number.isInteger(o)?r.push("--ei",t,String(o)):r.push("--ef",t,String(o));throw new e("INVALID_ARGS",`Unsupported Android broadcast extra type for "${t}". Use string, boolean, or number.`)}(s,r,t),u+=1);return await r(t,s),{action:n,extrasCount:u}}export{t as pushAndroidNotification};
1
+ import{F as e}from"./sdk-contracts.js";import{p as t}from"./android-input-ownership.js";async function n(n,i,a){let o=typeof a.action==`string`&&a.action.trim()?a.action.trim():`${i}.TEST_PUSH`,s=[`shell`,`am`,`broadcast`,`-a`,o,`-p`,i],c=typeof a.receiver==`string`?a.receiver.trim():``;c&&s.push(`-n`,c);let l=a.extras;if(l!==void 0&&(typeof l!=`object`||!l||Array.isArray(l)))throw new e(`INVALID_ARGS`,`Android push payload extras must be an object`);let u=l??{},d=0;for(let[e,t]of Object.entries(u))e&&(r(s,e,t),d+=1);return await t(n,s),{action:o,extrasCount:d}}function r(t,n,r){if(typeof r==`string`){t.push(`--es`,n,r);return}if(typeof r==`boolean`){t.push(`--ez`,n,r?`true`:`false`);return}if(typeof r==`number`&&Number.isFinite(r)){if(Number.isInteger(r)){t.push(`--ei`,n,String(r));return}t.push(`--ef`,n,String(r));return}throw new e(`INVALID_ARGS`,`Unsupported Android broadcast extra type for "${n}". Use string, boolean, or number.`)}export{n as pushAndroidNotification};
@@ -0,0 +1 @@
1
+ import e from"node:path";const t=`.webm`;function n(e){return e===`web`?t:`.mp4`}function r(t,n){return e.extname(t)?t:`${t}${n}`}function i(e){return`./recording-${Date.now()}${n(e)}`}export{n as i,r as n,i as r,t};
@@ -0,0 +1 @@
1
+ import e from"node:os";import t from"node:path";function n(t){return t?.HOME?.trim()||e.homedir()}function r(e,r={}){return e===`~`?n(r.env):e.startsWith(`~/`)?t.join(n(r.env),e.slice(2)):e}function i(e,n={}){let i=r(e,n);return t.isAbsolute(i)?i:t.resolve(n.cwd??process.cwd(),i)}export{i as n,r as t};
@@ -0,0 +1 @@
1
+ import{F as e}from"./sdk-contracts.js";import{deflateSync as t,inflateSync as n}from"node:zlib";const r=Buffer.from([137,80,78,71,13,10,26,10]),i=new Map([[0,1],[2,3],[3,1],[4,2],[6,4]]),a=new Map([[0,new Set([1,2,4,8,16])],[2,new Set([8,16])],[3,new Set([1,2,4,8])],[4,new Set([8,16])],[6,new Set([8,16])]]),o=[{x:0,y:0,dx:8,dy:8},{x:4,y:0,dx:8,dy:8},{x:0,y:4,dx:4,dy:8},{x:2,y:0,dx:4,dy:4},{x:0,y:2,dx:2,dy:4},{x:1,y:0,dx:2,dy:2},{x:0,y:1,dx:1,dy:2}];var s=class{width;height;data;static sync={read:c,write:p};constructor(e){this.width=I(e.width,`width`),this.height=I(e.height,`height`);let t=this.width*this.height*4;if(this.data=e.data?Buffer.from(e.data):Buffer.alloc(t),this.data.length!==t)throw Error(`PNG data length must be ${t} bytes`)}};function c(e){let{metadata:t,idatChunks:n}=l(e);if(!t)throw Error(`PNG is missing IHDR`);if(n.length===0)throw Error(`PNG is missing IDAT`);let r=f(n,t);return new s({width:t.width,height:t.height,data:t.interlace===1?b(r,t):y(g(r,t),t)})}function l(e){let t,n=[];for(let r of d(e))if(r.type===`IHDR`?t=m(r.data):r.type===`IDAT`?n.push(Buffer.from(r.data)):t=u(r,t),r.type===`IEND`)break;return{metadata:t,idatChunks:n}}function u(e,t){if(e.type===`PLTE`){if(!t)throw Error(`PNG PLTE appeared before IHDR`);t.palette=Buffer.from(e.data)}else if(e.type===`tRNS`){if(!t)throw Error(`PNG tRNS appeared before IHDR`);t.transparency=Buffer.from(e.data)}return t}function*d(e){if(!e.subarray(0,r.length).equals(r))throw Error(`Invalid PNG signature`);let t=r.length;for(;t<e.length;){if(t+12>e.length)throw Error(`Truncated PNG chunk`);let n=e.readUInt32BE(t),r=e.toString(`ascii`,t+4,t+8),i=t+8,a=i+n;if(a+4>e.length)throw Error(`Truncated PNG ${r} chunk`);let o=e.subarray(i,a),s=e.readUInt32BE(a);if(P(e.subarray(t+4,a))!==s)throw Error(`Invalid PNG ${r} chunk CRC`);t=a+4,yield{type:r,data:o}}}function f(e,t){let r=x(t);try{let t=n(Buffer.concat(e),{maxOutputLength:r});if(t.length!==r)throw Error(`PNG pixel data is truncated`);return t}catch(e){throw L(e)?Error(`PNG pixel data exceeds expected length ${r}`):e}}function p(e){let n=e.width*4,i=Buffer.alloc((n+1)*e.height);for(let t=0;t<e.height;t+=1){let r=t*(n+1);i[r]=0,e.data.copy(i,r+1,t*n,(t+1)*n)}let a=Buffer.alloc(13);return a.writeUInt32BE(e.width,0),a.writeUInt32BE(e.height,4),a[8]=8,a[9]=6,a[10]=0,a[11]=0,a[12]=0,Buffer.concat([r,N(`IHDR`,a),N(`IDAT`,t(i)),N(`IEND`,Buffer.alloc(0))])}function m(e){if(e.length!==13)throw Error(`Invalid PNG IHDR length`);let t=e.readUInt32BE(0),n=e.readUInt32BE(4),r=e[8],i=e[9],o=e[10],s=e[11],c=e[12];if(!h(i))throw Error(`Unsupported PNG color type ${i}`);if(!a.get(i)?.has(r))throw Error(`Unsupported PNG color type ${i} with bit depth ${r}`);if(o!==0)throw Error(`Unsupported PNG compression method ${o}`);if(s!==0)throw Error(`Unsupported PNG filter method ${s}`);if(c!==0&&c!==1)throw Error(`Unsupported PNG interlace method ${c}`);return{width:I(t,`width`),height:I(n,`height`),bitDepth:r,colorType:i,interlace:c}}function h(e){return i.has(e)}function g(e,t){return _({inflated:e,offset:0,scanlineLength:O(t),height:t.height,bytesPerPixel:k(t)}).raw}function _(e){let{inflated:t,offset:n,scanlineLength:r,height:i,bytesPerPixel:a}=e,o=n+(r+1)*i;if(t.length<o)throw Error(`PNG pixel data is truncated`);let s=Buffer.alloc(r*i);for(let e=0;e<i;e+=1){let i=n+e*(r+1),o=e*r,c=t[i];for(let n=0;n<r;n+=1){let l=t[i+1+n],u=n>=a?s[o+n-a]:0,d=e>0?s[o+n-r]:0,f=e>0&&n>=a?s[o+n-r-a]:0;s[o+n]=v(c,l,u,d,f)}}return{raw:s,offset:o}}function v(e,t,n,r,i){if(e===0)return t;if(e===1)return t+n&255;if(e===2)return t+r&255;if(e===3)return t+Math.floor((n+r)/2)&255;if(e===4)return t+F(n,r,i)&255;throw Error(`Unsupported PNG filter type ${e}`)}function y(e,t){let n=Buffer.alloc(t.width*t.height*4),r=O(t);for(let i=0;i<t.height;i+=1){let a=e.subarray(i*r,(i+1)*r);for(let e=0;e<t.width;e+=1){let r=(i*t.width+e)*4,[o,s,c,l]=w(a,e,t);n[r]=o,n[r+1]=s,n[r+2]=c,n[r+3]=l}}return n}function b(e,t){let n=Buffer.alloc(t.width*t.height*4),r=0;for(let i of o){let a=C(t.width,i.x,i.dx),o=C(t.height,i.y,i.dy);if(a===0||o===0)continue;let s={...t,width:a,height:o,interlace:0},c=_({inflated:e,offset:r,scanlineLength:O(s),height:o,bytesPerPixel:k(s)});r=c.offset;let l=O(s);for(let e=0;e<o;e+=1){let r=c.raw.subarray(e*l,(e+1)*l);for(let o=0;o<a;o+=1){let a=i.x+o*i.dx,c=((i.y+e*i.dy)*t.width+a)*4,[l,u,d,f]=w(r,o,s);n[c]=l,n[c+1]=u,n[c+2]=d,n[c+3]=f}}}return n}function x(e){if(e.interlace===0)return S(e,e.height);let t=0;for(let n of o){let r=C(e.width,n.x,n.dx),i=C(e.height,n.y,n.dy);r===0||i===0||(t+=S({...e,width:r,height:i},i))}return t}function S(e,t){return(O(e)+1)*t}function C(e,t,n){return e<=t?0:Math.floor((e-t+n-1)/n)}function w(e,t,n){if(n.colorType===3)return T(e,t,n);if(n.bitDepth<8)return E(e,t,n);let r=n.bitDepth===16?2:1,a=t*i.get(n.colorType)*r,o=t=>n.bitDepth===16?e.readUInt16BE(a+t*2):e[a+t*r],s=e=>A(o(e),n.bitDepth);if(n.colorType===0){let e=s(0);return[e,e,e,j(o(0),n)?0:255]}if(n.colorType===2)return[s(0),s(1),s(2),M(o(0),o(1),o(2),n)?0:255];if(n.colorType===4){let e=s(0);return[e,e,e,s(1)]}return[s(0),s(1),s(2),s(3)]}function T(e,t,n){if(!n.palette)throw Error(`Indexed PNG is missing PLTE`);let r=D(e,t,n.bitDepth),i=r*3;if(i+2>=n.palette.length)throw Error(`Indexed PNG palette is invalid`);return[n.palette[i],n.palette[i+1],n.palette[i+2],n.transparency?.[r]??255]}function E(e,t,n){let r=D(e,t,n.bitDepth),i=(1<<n.bitDepth)-1,a=Math.round(r/i*255);return[a,a,a,n.transparency&&n.transparency.length>=2&&r===n.transparency.readUInt16BE(0)?0:255]}function D(e,t,n){let r=t*n;return e[Math.floor(r/8)]>>8-n-r%8&(1<<n)-1}function O(e){let t=i.get(e.colorType);return Math.ceil(e.width*t*e.bitDepth/8)}function k(e){let t=i.get(e.colorType);return Math.max(1,Math.ceil(t*e.bitDepth/8))}function A(e,t){return t===16?Math.round(e/65535*255):e}function j(e,t){return!t.transparency||t.transparency.length<2?!1:e===t.transparency.readUInt16BE(0)}function M(e,t,n,r){return!r.transparency||r.transparency.length<6?!1:e===r.transparency.readUInt16BE(0)&&t===r.transparency.readUInt16BE(2)&&n===r.transparency.readUInt16BE(4)}function N(e,t){let n=Buffer.from(e,`ascii`),r=Buffer.alloc(8+t.length+4);return r.writeUInt32BE(t.length,0),n.copy(r,4),t.copy(r,8),r.writeUInt32BE(P(Buffer.concat([n,t])),8+t.length),r}function P(e){let t=4294967295;for(let n of e){t^=n;for(let e=0;e<8;e+=1)t=t&1?3988292384^t>>>1:t>>>1}return(t^4294967295)>>>0}function F(e,t,n){let r=e+t-n,i=Math.abs(r-e),a=Math.abs(r-t),o=Math.abs(r-n);return i<=a&&i<=o?e:a<=o?t:n}function I(e,t){if(!Number.isInteger(e)||e<1)throw Error(`PNG ${t} must be positive`);return e}function L(e){return e instanceof Error&&`code`in e&&e.code===`ERR_BUFFER_TOO_LARGE`}function R(t,n){try{return s.sync.read(t)}catch(t){throw new e(`COMMAND_FAILED`,`Failed to decode ${n} as PNG`,{label:n,reason:t instanceof Error?t.message:String(t)})}}const z=.78,B={r:220,g:0,b:0};function V(e){let{baselineData:t,currentData:n,maxColorDistance:r}=e,i=e.width*e.height,a=Buffer.alloc(i*4),o=new Uint8Array(i),s=0;for(let e=0,i=0;e<t.length;e+=4,i+=1){let c=t[e]-n[e],l=t[e+1]-n[e+1],u=t[e+2]-n[e+2];if(Math.sqrt(c**2+l**2+u**2)>r){s+=1,o[i]=1;let t=H(n,e);a[e]=U(t,B.r,z),a[e+1]=U(t,B.g,z),a[e+2]=U(t,B.b,z),a[e+3]=255;continue}let d=H(n,e);a[e]=d,a[e+1]=d,a[e+2]=d,a[e+3]=255}return{diffData:a,diffMask:o,differentPixels:s}}function H(e,t){return U(Math.round(e[t]*.299+e[t+1]*.587+e[t+2]*.114),255,.72)}function U(e,t,n){return Math.round(e*(1-n)+t*n)}function W(e){return Buffer.from(e.buffer,e.byteOffset,e.byteLength)}export{s as i,V as n,R as r,W as t};
@@ -0,0 +1,4 @@
1
+ import{F as e,b as t,l as n}from"./sdk-contracts.js";import{Nt as r,Pt as i,bn as a,d as o}from"./tv-remote.js";import{a as s,f as c,i as ee,l,m as u,p as d,u as f}from"./providers.js";import p from"node:fs";import{parseAllDocuments as m,stringify as h}from"yaml";const g=/^[A-Z_][A-Z0-9_]*$/,_=/(\\\$\{)|\$\{([A-Za-z_][A-Za-z0-9_.]*)(?::-((?:[^}\\]|\\.)*))?\}/g;function v(e){return e.startsWith(`AD_`)}function y(t){return new e(`INVALID_ARGS`,`The AD_* namespace is reserved for built-in variables. Rename ${t} to avoid the AD_ prefix.`)}function te(e){let t={};if(e.builtins)for(let[n,r]of Object.entries(e.builtins))t[n]=r;let n=[e.fileEnv,e.shellEnv,e.cliEnv];for(let e of n)if(e)for(let[n,r]of Object.entries(e)){if(v(n))throw y(n);t[n]=r}return{values:t}}function ne(e,t){Object.assign(e.values,t)}function b(e){let t={};for(let[n,r]of Object.entries(e)){if(typeof r!=`string`||!n.startsWith(`AD_VAR_`))continue;let e=n.slice(7);e.length!==0&&g.test(e)&&(v(e)||(t[e]=r))}return t}function x(t){let n={};for(let r of t){let t=r.indexOf(`=`);if(t<=0)throw new e(`INVALID_ARGS`,`Invalid -e entry "${r}": expected KEY=VALUE.`);let i=r.slice(0,t);if(!g.test(i))throw new e(`INVALID_ARGS`,`Invalid -e key "${i}": keys must be uppercase letters, digits, and underscores (e.g. APP_ID).`);if(v(i))throw y(i);n[i]=r.slice(t+1)}return n}function S(e){return Array.isArray(e)?e.filter(e=>typeof e==`string`):[]}function C(e){if(e&&typeof e==`object`&&!Array.isArray(e)){let t={};for(let[n,r]of Object.entries(e))typeof r==`string`&&(t[n]=r);return t}return process.env}function w(t,n,r){return t.replace(_,(t,i,a,o)=>{if(i)return"${";if(!a)return t;if(Object.prototype.hasOwnProperty.call(n.values,a))return String(n.values[a]);if(o!==void 0)return o.replace(/\\(.)/g,`$1`);throw new e(`INVALID_ARGS`,`Unresolved variable \${${a}} at ${r.file}:${r.line}.`)})}function T(e,t,n){return{...e,positionals:(e.positionals??[]).map(e=>w(e,t,n)),flags:D(e.flags,t,n)??{},runtime:D(e.runtime,t,n),replayControl:E(e.replayControl,t,n)}}function E(e,t,n){if(!e)return e;switch(e.kind){case`maestroRunFlowWhen`:return{...e,selector:w(e.selector,t,n)};case`retry`:return e}return e}function D(e,t,n){return e&&O(e,t,n)}function O(e,t,n){return typeof e==`string`?w(e,t,n):Array.isArray(e)?e.map(e=>O(e,t,n)):e&&typeof e==`object`?Object.fromEntries(Object.entries(e).map(([e,r])=>[e,O(r,t,n)])):e}const k=new Set(n.filter(e=>e!==`web`)),A=new Set([`mobile`,`tv`,`desktop`]);function j(t){let n=[],r=[],i=t.split(/\r?\n/),a=!1;for(let[t,o]of i.entries()){let i=o.trim();if(i.length===0||i.startsWith(`#`))continue;if(N(i)){if(a)throw new e(`INVALID_ARGS`,`env directives must precede all actions (line ${t+1}).`);continue}let s=R(o);s&&(n.push(s),r.push(t+1),a=!0)}return{actions:n,actionLines:r}}function M(e){let t=e.split(/\r?\n/),n={};for(let[e,r]of t.entries()){let t=r.trim();if(t.length===0||t.startsWith(`#`))continue;if(N(t)){I(n,t,e+1);continue}if(!t.startsWith(`context `))break;let i=t.match(/(?:^|\s)platform=([^\s]+)/);if(i){let e=i[1];e&&k.has(e)&&L(n,`platform`,e)}let a=t.match(/(?:^|\s)target=([^\s]+)/);if(a){let e=a[1];e&&A.has(e)&&L(n,`target`,e)}let o=t.match(/(?:^|\s)timeout=(\d+)/);if(o){let e=Number(o[1]);Number.isFinite(e)&&e>=1&&L(n,`timeoutMs`,Math.floor(e))}let s=t.match(/(?:^|\s)retries=(\d+)/);if(s){let e=Number(s[1]);Number.isFinite(e)&&e>=0&&L(n,`retries`,Math.floor(e))}}return n}function N(e){return e===`env`||e.startsWith(`env `)||e.startsWith(`env `)}function P(t,n){let r=t.slice(3).replace(/^[\s]+/,``),i=r.indexOf(`=`);if(i<=0)throw new e(`INVALID_ARGS`,`Invalid env directive on line ${n}: expected "env KEY=VALUE".`);let a=r.slice(0,i);if(!g.test(a))throw new e(`INVALID_ARGS`,`Invalid env key "${a}" on line ${n}: keys must be uppercase letters, digits, and underscores (e.g. APP_ID).`);if(a.startsWith(`AD_`))throw new e(`INVALID_ARGS`,`Invalid env key "${a}" on line ${n}: the AD_* namespace is reserved for built-in variables. Rename ${a} to avoid the AD_ prefix.`);return{key:a,value:F(r.slice(i+1),n)}}function F(t,n){if(t.length===0)return``;if(t.startsWith(`"`))try{let e=JSON.parse(t);if(typeof e!=`string`)throw Error(`not a string literal`);return e}catch{throw new e(`INVALID_ARGS`,`Invalid quoted env value on line ${n}.`)}return t}function I(t,n,r){let{key:i,value:a}=P(n,r),o=t.env??{};if(Object.prototype.hasOwnProperty.call(o,i))throw new e(`INVALID_ARGS`,`Duplicate env directive "${i}" on line ${r}.`);o[i]=a,t.env=o}function L(t,n,r){let i=t[n];if(i!==void 0)throw new e(`INVALID_ARGS`,i===r?`Duplicate replay test metadata "${n}" in context header.`:`Conflicting replay test metadata "${n}" in context header: ${String(i)} vs ${String(r)}.`);t[n]=r}function R(e){let t=e.trim();if(t.length===0||t.startsWith(`#`))return null;let[n,...r]=V(t);if(n===void 0||n===`context`)return null;let i={ts:Date.now(),command:n,positionals:[],flags:{}};if(n===`snapshot`){i.positionals=[];for(let e=0;e<r.length;e+=1){let t=r[e];if(t===`-i`){i.flags.snapshotInteractiveOnly=!0;continue}if(t!==`-c`){if(t===`--raw`){i.flags.snapshotRaw=!0;continue}if(t===`--force-full`){i.flags.snapshotForceFull=!0;continue}if((t===`-d`||t===`--depth`)&&e+1<r.length){let t=Number(r[e+1]);Number.isFinite(t)&&t>=0&&(i.flags.snapshotDepth=Math.floor(t)),e+=1;continue}if((t===`-s`||t===`--scope`)&&e+1<r.length){i.flags.snapshotScope=r[e+1],e+=1;continue}if(t===`--backend`&&e+1<r.length){e+=1;continue}}}return i}if(n===`open`){let e=s(r);return i.positionals=e.positionals,Object.assign(i.flags,e.flags),i.runtime=e.runtime,i}if(n===`runtime`){let e=c(r);return i.positionals=e.positionals,Object.assign(i.flags,e.flags),i}if(f(n)){let e=d(n,r);Object.assign(i.flags,e.flags);let t=e.positionals[0];if(t===void 0)return i;if(t.startsWith(`@`))return i.positionals=[u(t)],e.positionals[1]&&(i.result={refLabel:e.positionals[1]}),i;let a=e.positionals[0],o=e.positionals[1];return B(a)&&B(o)&&e.positionals.length>=2?(i.positionals=[a,o],i):(i.positionals=[e.positionals.join(` `)],i)}if(n===`fill`){let e=d(n,r);if(Object.assign(i.flags,e.flags),!z(e.positionals))return i.positionals=e.positionals,i;let[t,a,...o]=e.positionals;if(t.startsWith(`@`)){let e=u(t);return o.length>0?(i.positionals=[e,o.join(` `)],i.result={refLabel:a},i):(i.positionals=[e,a],i)}return i.positionals=[t,[a,...o].join(` `)],i}if(n===`get`){let e=r[0],t=r[1];return e===void 0||t===void 0?(i.positionals=r,i):t.startsWith(`@`)?(i.positionals=[e,u(t)],r[2]&&(i.result={refLabel:r[2]}),i):(i.positionals=[e,r.slice(1).join(` `)],i)}if(n===`swipe`||n===`type`){let e=d(n,r);return Object.assign(i.flags,e.flags),i.positionals=e.positionals,i}if(n===`record`){let e=[];for(let t=0;t<r.length;t+=1){let n=r[t];if(n===`--hide-touches`){i.flags.hideTouches=!0;continue}if(n===`--fps`&&t+1<r.length){let e=Number(r[t+1]);Number.isFinite(e)&&(i.flags.fps=Math.floor(e)),t+=1;continue}if(n===`--quality`&&t+1<r.length){let e=r[t+1],n=o(e);n!==void 0&&(i.flags.quality=n),t+=1;continue}if(n===`--max-size`&&t+1<r.length){let e=Number(r[t+1]);Number.isFinite(e)&&(i.flags.screenshotMaxSize=Math.floor(e)),t+=1;continue}e.push(n)}return i.positionals=e,i}if(n===`screenshot`){let e=[];for(let t=0;t<r.length;t+=1){let n=r[t],o=a({args:r,index:t,flags:i.flags});if(o.handled){t=o.nextIndex;continue}e.push(n)}return i.positionals=e,i}return i.positionals=n===`wait`||n===`longpress`?r.map(e=>u(e)):r,i}function z(e){return e.length>=2}function B(e){return e?!Number.isNaN(Number(e)):!1}function V(e){let t=[],n=0;for(;n<e.length&&(n=H(e,n),!(n>=e.length));){let r=e[n]===`"`?U(e,n):W(e,n);t.push(r.value),n=r.nextCursor}return t}function H(e,t){let n=t;for(;n<e.length&&/\s/.test(e.charAt(n));)n+=1;return n}function U(t,n){let r=n+1,i=!1,a=r;for(;a<t.length;a+=1){let e=t.charAt(a);if(e===`"`&&!i)break;if(i){i=!1;continue}i=e===`\\`}if(a>=t.length)throw new e(`INVALID_ARGS`,`Invalid replay script line: ${t}`);return{value:JSON.parse(t.slice(n,a+1)),nextCursor:a+1}}function W(e,t){let n=t;for(;n<e.length&&!/\s/.test(e.charAt(n));)n+=1;return{value:e.slice(t,n),nextCursor:n}}function G(e,n,r){let i=[];if(r){let e=r.device.kind?` kind=${r.device.kind}`:``,n=r.device.target?` target=${r.device.target}`:``;i.push(`context platform=${t(r.device)}${n} device=${l(r.device.name)}${e} theme=unknown`)}for(let e of n)i.push(K(e));let a=`${i.join(`
2
+ `)}\n`,o=`${e}.tmp-${process.pid}-${Date.now()}`;p.writeFileSync(o,a),p.renameSync(o,e)}function K(e){return ee(e,{runtimeIncludeAllPositionals:!0})}function q(t){let n=m(t);for(let t of n)if(t.errors.length>0)throw new e(`INVALID_ARGS`,`Invalid Maestro YAML flow: ${t.errors[0]?.message??`Invalid Maestro YAML flow.`}`);return n.map(e=>e.toJSON()).filter(e=>e!==null)}function J(e){return`${e.map(e=>h(e).trimEnd()).join(`
3
+ ---
4
+ `)}\n`}function Y(e,t=[],n){return{ts:Date.now(),command:e,positionals:t,flags:n??{}}}function X(e,t,n){let r=new Set(n),i=Object.keys(e).filter(e=>!r.has(e));if(i.length>0)throw $(`Maestro ${t} field "${i[0]}" is not supported yet.`)}function Z(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function re(t){return t.map((t,n)=>{if(typeof t==`string`||Z(t))return t;throw new e(`INVALID_ARGS`,`Unsupported Maestro command at index ${n+1}: expected a scalar or one-key map.`)})}function ie(e){if(e)return ue(e)}function ae(t,n){if(t==null)return{};if(!Z(t))throw new e(`INVALID_ARGS`,`${n} expects a map.`);let r={};for(let[e,n]of Object.entries(t))(typeof n==`string`||typeof n==`number`||typeof n==`boolean`)&&(r[e]=String(n));return r}function oe(e,t){return Z(e)&&typeof e.timeout==`number`&&Number.isFinite(e.timeout)?Math.max(0,Math.floor(e.timeout)):t}function se(t,n){if(t.appId)return t.appId;throw new e(`INVALID_ARGS`,`${n} requires appId in the Maestro flow config.`)}function Q(t,n){if(typeof n==`string`)return n;throw new e(`INVALID_ARGS`,`${t} expects a string value.`)}function ce(e,t){return e.replace(/\$\{([A-Za-z_][A-Za-z0-9_.]*)\}/g,(e,n)=>Object.prototype.hasOwnProperty.call(t.env,n)?String(t.env[n]):e)}function le(e){throw $(`Maestro command "${e}" is not supported yet.`)}function $(t){throw new e(`INVALID_ARGS`,`${t} See supported/unsupported Maestro compatibility at ${r}. If this syntax matters for your flows, comment there or open a focused issue at ${i}.`)}function ue(e){let t=e.trim().toLowerCase();if(t===`android`)return`android`;if(t===`ios`)return`ios`}function de(e,t){return`${e},${t}`}function fe(e){let t=e.match(/^(\d+),(\d+)$/);if(!t)throw $(`Only absolute Maestro point selectors like "100,200" are supported.`);return{x:Number(t[1]),y:Number(t[2])}}function pe(e){let t=e.match(/^\s*(\d+)\s*,\s*(\d+)\s*$/);if(t)return{kind:`absolute`,x:Number(t[1]),y:Number(t[2])};let n=e.match(/^\s*(\d+(?:\.\d+)?)%\s*,\s*(\d+(?:\.\d+)?)%\s*$/);if(n)return{kind:`percent`,x:Number(n[1]),y:Number(n[2])};throw $(`Only Maestro swipe coordinates like "100,200" or "50%,75%" are supported.`)}export{ne as C,T as D,C as E,b as S,S as T,J as _,X as a,G as b,ie as c,se as d,Q as f,q as g,$ as h,Y as i,ae as l,le as m,fe as n,Z as o,ce as p,pe as r,re as s,de as t,oe as u,j as v,x as w,te as x,M as y};
@@ -0,0 +1 @@
1
+ import e from"node:fs";import t from"node:path";function n(e){let t=i(e);return t?r(t):`auto`}function r(e){let t={...e.dependencies??{},...e.devDependencies??{}};return typeof t[`@callstack/repack`]==`string`?`repack`:typeof t.expo==`string`?`expo`:typeof t[`react-native`]==`string`?`react-native`:`auto`}function i(n){if(!n)return;let r=t.join(n,`package.json`);try{return JSON.parse(e.readFileSync(r,`utf8`))}catch{return}}export{r as n,i as r,n as t};
@@ -1 +1 @@
1
- import{createScopedProvider as r,createAgentBrowserWebProvider as e}from"./9722.js";let o=r(e());function t(r){return o.resolve(r)}async function n(r,e){return await o.run(r,e)}export{t as resolveWebProvider,n as withWebProvider};
1
+ import{t as e}from"./rolldown-runtime.js";import{t}from"./scoped-provider.js";import{t as n}from"./internal/daemon.js";var r=e({resolveWebProvider:()=>a,withWebProvider:()=>o});const i=t(n());function a(e){return i.resolve(e)}async function o(e,t){return await i.run(e,t)}export{a as n,r as t};
@@ -0,0 +1 @@
1
+ import{N as e}from"./sdk-contracts.js";import{yn as t}from"./tv-remote.js";import n from"node:crypto";function r(t){return t.startsWith(`@`)?e(t)?.base??t:t}const i=/^-?\d+(\.\d+)?$/,a=/^[^\s"\\]+$/,o=new Map([[`--count`,`count`],[`--interval-ms`,`intervalMs`],[`--hold-ms`,`holdMs`],[`--jitter-px`,`jitterPx`]]),s=new Map([[`--count`,`count`],[`--pause-ms`,`pauseMs`]]),c=new Map([[`--delay-ms`,`delayMs`]]);function l(e){return e===`click`||e===`press`}function u(e){return l(e)||e===`longpress`}function d(e){return e===`type`||e===`fill`}function f(e){return h(e,g)}function p(e){return JSON.stringify(e)}function m(e){return h(e,_)}function h(e,t){return t(e)?e:p(e)}function g(e){return _(e)&&e.startsWith(`@`)||i.test(e)}function _(e){return a.test(e)}function v(e){let t=(e.positionals??[]).map(e=>f(e));return[e.command,...t].join(` `)}function y(e,t){let n=t.flags??{};if(l(t.command)){typeof n.count==`number`&&e.push(`--count`,String(n.count)),typeof n.intervalMs==`number`&&e.push(`--interval-ms`,String(n.intervalMs)),typeof n.holdMs==`number`&&e.push(`--hold-ms`,String(n.holdMs)),typeof n.jitterPx==`number`&&e.push(`--jitter-px`,String(n.jitterPx)),n.doubleTap===!0&&e.push(`--double-tap`);let t=n.clickButton;t&&t!==`primary`&&e.push(`--button`,t);return}if(t.command===`swipe`){typeof n.count==`number`&&e.push(`--count`,String(n.count)),typeof n.pauseMs==`number`&&e.push(`--pause-ms`,String(n.pauseMs)),(n.pattern===`one-way`||n.pattern===`ping-pong`)&&e.push(`--pattern`,n.pattern);return}d(t.command)&&typeof n.delayMs==`number`&&e.push(`--delay-ms`,String(n.delayMs))}function b(e,t){t&&((t.platform===`ios`||t.platform===`android`)&&e.push(`--platform`,t.platform),typeof t.metroHost==`string`&&t.metroHost.length>0&&e.push(`--metro-host`,m(t.metroHost)),typeof t.metroPort==`number`&&e.push(`--metro-port`,String(t.metroPort)),typeof t.bundleUrl==`string`&&t.bundleUrl.length>0&&e.push(`--bundle-url`,m(t.bundleUrl)),typeof t.launchUrl==`string`&&t.launchUrl.length>0&&e.push(`--launch-url`,m(t.launchUrl)))}function x(e,t){let[n,...r]=t.positionals??[];n&&e.push(m(n));for(let t of r)e.push(f(t));typeof t.flags?.fps==`number`&&e.push(`--fps`,String(t.flags.fps)),typeof t.flags?.screenshotMaxSize==`number`&&e.push(`--max-size`,String(t.flags.screenshotMaxSize)),(typeof t.flags?.quality==`number`||typeof t.flags?.quality==`string`)&&e.push(`--quality`,String(t.flags.quality)),t.flags?.hideTouches&&e.push(`--hide-touches`)}function S(e,t){t.flags?.snapshotInteractiveOnly&&e.push(`-i`),typeof t.flags?.snapshotDepth==`number`&&e.push(`-d`,String(t.flags.snapshotDepth)),t.flags?.snapshotScope&&e.push(`-s`,f(t.flags.snapshotScope)),t.flags?.snapshotRaw&&e.push(`--raw`)}function C(e,n){for(let t of n.positionals??[])e.push(f(t));t(e,n.flags)}function w(e,t,n={}){let r=t.positionals??[],i=n.includeAllPositionals?r:r.slice(0,1);for(let t of i)e.push(m(t));b(e,t.flags)}function T(e,t){for(let n of t.positionals??[])e.push(f(t.command===`wait`?r(n):n));y(e,t)}function E(e,t){let n=[],r={},i=l(e)?o:e===`swipe`?s:d(e)?c:void 0;for(let a=0;a<t.length;a+=1){let o=t[a];if(l(e)&&o===`--double-tap`){r.doubleTap=!0;continue}let s=t[a+1];if(l(e)&&o===`--button`&&s!==void 0){let e=s;(e===`primary`||e===`secondary`||e===`middle`)&&(r.clickButton=e),a+=1;continue}let c=i?.get(o);if(c&&s!==void 0){let e=O(s);if(e!==null){r[c]=e,a+=1;continue}}if(e===`swipe`&&o===`--pattern`&&s!==void 0){let e=s;(e===`one-way`||e===`ping-pong`)&&(r.pattern=e),a+=1;continue}n.push(o)}return{positionals:n,flags:r}}function D(e){let t=[],n={};for(let r=0;r<e.length;r+=1){let i=e[r],a=e[r+1];if(i===`--platform`&&a!==void 0){let e=a;(e===`ios`||e===`android`)&&(n.platform=e),r+=1;continue}if(i===`--metro-host`&&a!==void 0){n.metroHost=a,r+=1;continue}if(i===`--metro-port`&&a!==void 0){let e=O(a);e!==null&&(n.metroPort=e),r+=1;continue}if(i===`--bundle-url`&&a!==void 0){n.bundleUrl=a,r+=1;continue}if(i===`--launch-url`&&a!==void 0){n.launchUrl=a,r+=1;continue}t.push(i)}return{positionals:t,flags:n}}function O(e){if(!e)return null;let t=Number(e);return!Number.isFinite(t)||t<0?null:Math.floor(t)}function k(e,t){for(let n of t.positionals??[])e.push(f(n));t.flags?.relaunch&&e.push(`--relaunch`),b(e,t.runtime)}function A(e){let t=[],n={};for(let r of e){if(r===`--relaunch`){n.relaunch=!0;continue}t.push(r)}let r=D(t);return{positionals:r.positionals,flags:n,runtime:j(r.flags)?r.flags:void 0}}function j(e){return!!(e.platform||e.metroHost||e.metroPort!==void 0||e.bundleUrl||e.launchUrl)}function M(e,t={}){let n=[e.command];return e.command===`snapshot`?S(n,e):e.command===`open`?k(n,e):e.command===`runtime`?w(n,e,{includeAllPositionals:t.runtimeIncludeAllPositionals}):e.command===`record`?x(n,e):e.command===`screenshot`?C(n,e):T(n,e),n.join(` `)}function N(e,t){let r=n.createHash(`sha256`).update(e).digest(),i=n.createHash(`sha256`).update(t).digest();return n.timingSafeEqual(r,i)}const P={browserStack:`browserstack`,awsDeviceFarm:`aws-device-farm`},F=new Set(Object.values(P));function I(e){return e!==void 0&&F.has(e)}export{A as a,f as c,u as d,D as f,M as i,p as l,r as m,I as n,y as o,E as p,N as r,v as s,P as t,l as u};
@@ -1 +1 @@
1
- import{dispatchCommand as e,noActiveSessionError as t,requireCommandSupported as i,errorResponse as a}from"./9722.js";import{stripUndefined as s,PUBLIC_COMMANDS as r}from"./1986.js";import{isSparseSnapshotQualityVerdict as n,analyzeReactNativeOverlay as o,successText as d}from"./2948.js";import{normalizeError as l}from"./485.js";import{interaction_snapshot_captureSnapshotForSession as c,readSnapshotNodesReferenceFrame as v,finalizeTouchInteraction as f}from"./8184.js";async function m(e){var s,v;let{req:f,sessionName:m,sessionStore:u}=e;if(f.command!==r.reactNative)return null;let p=1===(s=f.positionals??[]).length&&"dismiss-overlay"===s[0]?{ok:!0}:{ok:!1,response:a("INVALID_ARGS","react-native supports only: dismiss-overlay")};if(!p.ok)return p.response;let g=u.get(m);if(!g)return t();let h=i(r.reactNative,g.device,{message:"react-native dismiss-overlay is not supported on this device"});if(h)return h;try{let t=await c(g,f.flags,u,e.contextFromFlags,{interactiveOnly:!0});if(n(t.snapshotQuality)){return v=t.snapshotQuality,a("COMMAND_FAILED","React Native overlay state could not be determined because the accessibility tree is unreadable",{reason:v.reason,hint:"The snapshot quality verdict is sparse. Use screenshot as visual truth; if an overlay is visible, report it or navigate with coordinates, then retry snapshot or dismiss-overlay on a readable screen."})}let i=o(t.nodes),s=i.primaryAction;if(!s)return i.detected?a("COMMAND_FAILED","React Native overlay detected, but no safe dismiss target was found",{hint:"Use screenshot --overlay-refs for visual evidence and report the overlay instead of pressing the warning body."}):{ok:!0,data:{action:"dismiss-overlay",detected:!1,dismissed:!1,...d("No React Native overlay detected")}};return await y(e,g,t,s)}catch(e){return{ok:!1,error:l(e)}}}async function y(t,i,a,r){let{req:n,sessionStore:o}=t,l=Date.now(),c=await e(i.device,"press",[String(r.point.x),String(r.point.y)],n.flags?.out,t.contextFromFlags(n.flags,i.appBundleId,i.trace?.outPath))??{},m=Date.now(),y=await u(t,i),p=s({...v(a.nodes),...c,action:"dismiss-overlay",overlayAction:r.action,x:r.point.x,y:r.point.y,ref:r.ref,label:r.label,warning:r.warning,dismissed:!0,verified:y.verified,verificationRequired:!y.verified,verificationWarning:y.verificationWarning,nextCommand:y.nextCommand,...d(y.verified?"React Native overlay dismiss action sent and verified gone":"React Native overlay dismiss action sent, but verification still detects an overlay")});return f({session:i,sessionStore:o,command:n.command,positionals:n.positionals??[],flags:n.flags,result:p,responseData:p,actionStartedAt:l,actionFinishedAt:m})}async function u(e,t){let{req:i,sessionStore:a}=e,s=await c(t,i.flags,a,e.contextFromFlags,{interactiveOnly:!0});return n(s.snapshotQuality)?{verified:!1,verificationWarning:"React Native overlay dismissal could not be verified because the post-dismiss accessibility tree is unreadable. Use screenshot as visual truth.",nextCommand:"agent-device screenshot"}:o(s.nodes).detected?{verified:!1,verificationWarning:"React Native overlay is still detected after dismissal. Use screenshot --overlay-refs for visual evidence and report the overlay instead of pressing the warning body.",nextCommand:"agent-device screenshot --overlay-refs"}:{verified:!0}}export{m as handleReactNativeCommands};
1
+ import{B as e}from"./sdk-contracts.js";import{Qn as t,wn as n}from"./tv-remote.js";import{b as r}from"./sdk-batch-runner.js";import{t as i}from"./snapshot-quality.js";import{d as a}from"./runtime.js";import{$t as o,Gt as s,en as c,tn as l}from"./internal/daemon.js";import{i as u,n as d,t as f}from"./interaction-snapshot.js";async function p(n){let{req:r,sessionName:o,sessionStore:s}=n;if(r.command!==t.reactNative)return null;let u=m(r.positionals??[]);if(!u.ok)return u.response;let d=s.get(o);if(!d)return c();let p=l(t.reactNative,d.device,{message:`react-native dismiss-overlay is not supported on this device`});if(p)return p;try{let e=await f(d,r.flags,s,n.contextFromFlags,{interactiveOnly:!0});if(i(e.snapshotQuality))return g(e.snapshotQuality);let t=a(e.nodes),o=t.primaryAction;return o?await _(n,d,e,o):h(t.detected)}catch(t){return{ok:!1,error:e(t)}}}function m(e){return e.length===1&&e[0]===`dismiss-overlay`?{ok:!0}:{ok:!1,response:o(`INVALID_ARGS`,`react-native supports only: dismiss-overlay`)}}function h(e){return e?o(`COMMAND_FAILED`,`React Native overlay detected, but no safe dismiss target was found`,{hint:`Use screenshot --overlay-refs for visual evidence and report the overlay instead of pressing the warning body.`}):{ok:!0,data:{action:`dismiss-overlay`,detected:!1,dismissed:!1,...n(`No React Native overlay detected`)}}}function g(e){return o(`COMMAND_FAILED`,`React Native overlay state could not be determined because the accessibility tree is unreadable`,{reason:e.reason,hint:`The snapshot quality verdict is sparse. Use screenshot as visual truth; if an overlay is visible, report it or navigate with coordinates, then retry snapshot or dismiss-overlay on a readable screen.`})}async function _(e,t,i,a){let{req:o,sessionStore:c}=e,l=Date.now(),f=await s(t.device,`press`,[String(a.point.x),String(a.point.y)],o.flags?.out,e.contextFromFlags(o.flags,t.appBundleId,t.trace?.outPath))??{},p=Date.now(),m=await v(e,t),h=r({...d(i.nodes),...f,action:`dismiss-overlay`,overlayAction:a.action,x:a.point.x,y:a.point.y,ref:a.ref,label:a.label,warning:a.warning,dismissed:!0,verified:m.verified,verificationRequired:!m.verified,verificationWarning:m.verificationWarning,nextCommand:m.nextCommand,...n(y(m))});return u({session:t,sessionStore:c,command:o.command,positionals:o.positionals??[],flags:o.flags,result:h,responseData:h,actionStartedAt:l,actionFinishedAt:p})}async function v(e,t){let{req:n,sessionStore:r}=e,o=await f(t,n.flags,r,e.contextFromFlags,{interactiveOnly:!0});return i(o.snapshotQuality)?{verified:!1,verificationWarning:`React Native overlay dismissal could not be verified because the post-dismiss accessibility tree is unreadable. Use screenshot as visual truth.`,nextCommand:`agent-device screenshot`}:a(o.nodes).detected?{verified:!1,verificationWarning:`React Native overlay is still detected after dismissal. Use screenshot --overlay-refs for visual evidence and report the overlay instead of pressing the warning body.`,nextCommand:`agent-device screenshot --overlay-refs`}:{verified:!0}}function y(e){return e.verified?`React Native overlay dismiss action sent and verified gone`:`React Native overlay dismiss action sent, but verification still detects an overlay`}export{p as handleReactNativeCommands};