agent-device 0.21.18 → 0.21.20

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 (205) hide show
  1. package/android/ime-helper/dist/{agent-device-android-ime-helper-0.21.18.apk → agent-device-android-ime-helper-0.21.20.apk} +0 -0
  2. package/android/ime-helper/dist/agent-device-android-ime-helper-0.21.20.apk.sha256 +1 -0
  3. package/android/ime-helper/dist/{agent-device-android-ime-helper-0.21.18.manifest.json → agent-device-android-ime-helper-0.21.20.manifest.json} +4 -4
  4. package/android/snapshot-helper/dist/{agent-device-android-snapshot-helper-0.21.18.apk → agent-device-android-snapshot-helper-0.21.20.apk} +0 -0
  5. package/android/snapshot-helper/dist/agent-device-android-snapshot-helper-0.21.20.apk.sha256 +1 -0
  6. package/android/snapshot-helper/dist/{agent-device-android-snapshot-helper-0.21.18.manifest.json → agent-device-android-snapshot-helper-0.21.20.manifest.json} +6 -6
  7. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunner/AgentDeviceRunnerApp.m +12 -0
  8. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+CommandJournal.swift +1 -14
  9. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Interaction.swift +14 -16
  10. package/dist/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Models.swift +40 -14
  11. package/dist/apple/snapshot-presentation/Sources/AgentDeviceSnapshotPresentation/SnapshotModels.swift +20 -5
  12. package/dist/apple/snapshot-presentation/Sources/AgentDeviceSnapshotPresentation/SnapshotPresentationProjection.swift +2 -15
  13. package/dist/apple/snapshot-presentation/Sources/AgentDeviceSnapshotPresentation/SnapshotVisibilityFold.swift +10 -25
  14. package/dist/apple/snapshot-presentation/Sources/AgentDeviceSnapshotPresentation/SnapshotVisibilityFoldProjection.swift +1 -18
  15. package/dist/src/adapter.js +1 -1
  16. package/dist/src/adb-executor.js +2 -2
  17. package/dist/src/adb-failure.js +2 -1
  18. package/dist/src/agent-browser-lifecycle.js +1 -1
  19. package/dist/src/agent-browser-process-record.js +1 -1
  20. package/dist/src/agent-browser-provider.js +1 -1
  21. package/dist/src/agent-browser-tool.js +1 -1
  22. package/dist/src/agent-device-client.js +2 -2
  23. package/dist/src/ai-sdk.js +1 -1
  24. package/dist/src/alert-runtime.js +1 -1
  25. package/dist/src/alert.js +1 -0
  26. package/dist/src/android-input-ownership.js +1 -1
  27. package/dist/src/android.js +1 -1
  28. package/dist/src/app-launch.js +2 -2
  29. package/dist/src/app-lifecycle.js +1 -1
  30. package/dist/src/app-log-runtime2.js +1 -1
  31. package/dist/src/app-resolution.js +2 -2
  32. package/dist/src/apple-runner-platform.js +1 -1
  33. package/dist/src/archive.js +2 -2
  34. package/dist/src/browser-launch.js +1 -1
  35. package/dist/src/cache.js +1 -1
  36. package/dist/src/catalog.js +1 -1
  37. package/dist/src/cli-config.js +1 -1
  38. package/dist/src/cli-help.js +287 -301
  39. package/dist/src/cli-runner.js +1 -1
  40. package/dist/src/cli.js +4 -4
  41. package/dist/src/client-metro-companion.js +1 -1
  42. package/dist/src/client-metro.js +1 -1
  43. package/dist/src/client-types.d.ts +25 -6
  44. package/dist/src/{scroll-command.d.ts → cloud-artifacts.d.ts} +242 -238
  45. package/dist/src/command-metadata.js +1 -1
  46. package/dist/src/command-schema.js +3 -3
  47. package/dist/src/command-tools.js +2 -2
  48. package/dist/src/command.js +1 -1
  49. package/dist/src/config.js +1 -1
  50. package/dist/src/connection-runtime.js +1 -1
  51. package/dist/src/contracts.js +1 -1
  52. package/dist/src/daemon-client-lease-beat.js +1 -1
  53. package/dist/src/daemon-client-lifecycle.js +1 -1
  54. package/dist/src/daemon-client-transport.js +1 -1
  55. package/dist/src/daemon-policy-file.js +1 -1
  56. package/dist/src/daemon-registration.js +1 -1
  57. package/dist/src/debug-symbols-facade.js +3 -3
  58. package/dist/src/device-claim-inspection.js +1 -1
  59. package/dist/src/device-claim-rule.js +1 -1
  60. package/dist/src/device-inventory-context.js +1 -1
  61. package/dist/src/device-rotation.js +1 -1
  62. package/dist/src/device-session.js +1 -1
  63. package/dist/src/devicectl.js +1 -1
  64. package/dist/src/diagnostics.js +1 -1
  65. package/dist/src/diagnostics2.js +1 -1
  66. package/dist/src/display-inventory.js +1 -1
  67. package/dist/src/durable-resource.js +1 -1
  68. package/dist/src/engine-eval-script.js +1 -1
  69. package/dist/src/error.js +1 -1
  70. package/dist/src/exec.js +1 -1
  71. package/dist/src/find.js +1 -1
  72. package/dist/src/finders.js +1 -1
  73. package/dist/src/generic-settle.js +1 -1
  74. package/dist/src/gesture-runtime.js +1 -1
  75. package/dist/src/hdc.js +1 -1
  76. package/dist/src/helper.js +2 -2
  77. package/dist/src/host.js +1 -1
  78. package/dist/src/index.d.ts +3 -3
  79. package/dist/src/index.js +1 -1
  80. package/dist/src/input-actions2.js +2 -2
  81. package/dist/src/install-source-network-transport.js +1 -1
  82. package/dist/src/interaction-positionals.js +1 -1
  83. package/dist/src/interaction-ref-policy.js +1 -1
  84. package/dist/src/interaction.js +1 -1
  85. package/dist/src/interaction2.js +1 -1
  86. package/dist/src/interactor.js +5 -5
  87. package/dist/src/interactor2.js +1 -1
  88. package/dist/src/internal/bin.js +1 -1
  89. package/dist/src/internal/daemon.js +2 -2
  90. package/dist/src/internal/png-worker.js +1 -1
  91. package/dist/src/ios-snapshot-acquisition.js +1 -1
  92. package/dist/src/ios-snapshot-engine.js +1 -1
  93. package/dist/src/launch-confirmation.js +1 -0
  94. package/dist/src/lease.js +1 -1
  95. package/dist/src/limrun-runtime-dependencies.js +1 -1
  96. package/dist/src/limrun.d.ts +50 -42
  97. package/dist/src/local-interactor-operation-set.js +1 -1
  98. package/dist/src/mechanics.js +16 -17
  99. package/dist/src/mobile-snapshot-semantics.js +1 -1
  100. package/dist/src/observe-until.js +1 -0
  101. package/dist/src/overlay.js +2 -2
  102. package/dist/src/owner-identity.js +1 -1
  103. package/dist/src/parameterized-recorded-fill.js +1 -1
  104. package/dist/src/perf-facade.js +1 -1
  105. package/dist/src/perf-runtime-operation-builder.js +1 -1
  106. package/dist/src/perf-runtime-plan.js +1 -1
  107. package/dist/src/perf-target.js +1 -1
  108. package/dist/src/physical-device-control.js +1 -1
  109. package/dist/src/platform-request-scope.js +1 -1
  110. package/dist/src/platform-runtime-android-adb-host.js +1 -1
  111. package/dist/src/platform-runtime-app-log-process.js +1 -1
  112. package/dist/src/platform-runtime-host.js +1 -1
  113. package/dist/src/platform-runtime-managed-owner.js +1 -1
  114. package/dist/src/platform-runtime-operation-host.js +2 -2
  115. package/dist/src/platform-runtime-runtime-hints.js +1 -1
  116. package/dist/src/platform-runtime-screen-recording-apple-simulator-host.js +1 -1
  117. package/dist/src/platform-runtime-screen-recording-finalizer-host.js +1 -1
  118. package/dist/src/platform-runtime-screen-recording-process-host.js +1 -1
  119. package/dist/src/platform-runtime.js +1 -1
  120. package/dist/src/platform-runtime2.js +1 -1
  121. package/dist/src/png-worker-client.js +1 -1
  122. package/dist/src/provider-device-admission.js +1 -0
  123. package/dist/src/provider-session-ownership.js +1 -1
  124. package/dist/src/provider-webdriver.js +1 -1
  125. package/dist/src/proxy.js +1 -1
  126. package/dist/src/react-native.js +1 -1
  127. package/dist/src/record-runtime.js +1 -1
  128. package/dist/src/registry.js +52 -36
  129. package/dist/src/replay-divergence.js +1 -1
  130. package/dist/src/replay.js +1 -1
  131. package/dist/src/request-admission.js +1 -1
  132. package/dist/src/request-runtime-binding.js +1 -1
  133. package/dist/src/result-serialization.js +1 -1
  134. package/dist/src/runner-cache-metadata.js +3 -3
  135. package/dist/src/runner-client.js +1 -1
  136. package/dist/src/runner-dev-tools-security.js +1 -1
  137. package/dist/src/runner-device-readiness.js +1 -1
  138. package/dist/src/runner-disposal.js +1 -1
  139. package/dist/src/runner-error-classification.js +3 -3
  140. package/dist/src/runner-exchange.js +1 -1
  141. package/dist/src/runner-operations-facade.js +1 -1
  142. package/dist/src/runner-session-types.js +1 -1
  143. package/dist/src/runner-start-budget.js +1 -1
  144. package/dist/src/runner-startup-transport.js +1 -1
  145. package/dist/src/runner-xctestrun.js +1 -1
  146. package/dist/src/runner.js +1 -1
  147. package/dist/src/runtime-admission.js +1 -0
  148. package/dist/src/runtime.js +1 -1
  149. package/dist/src/runtime10.js +2 -2
  150. package/dist/src/runtime2.js +2 -2
  151. package/dist/src/runtime3.js +1 -1
  152. package/dist/src/runtime4.js +5 -5
  153. package/dist/src/runtime5.js +1 -1
  154. package/dist/src/runtime6.js +1 -1
  155. package/dist/src/runtime7.js +1 -1
  156. package/dist/src/runtime8.js +1 -1
  157. package/dist/src/runtime9.js +1 -1
  158. package/dist/src/screen-recording-resource-recovery.js +1 -1
  159. package/dist/src/screenshot-result.js +1 -1
  160. package/dist/src/screenshot-runtime.js +1 -1
  161. package/dist/src/screenshot3.js +1 -1
  162. package/dist/src/script.js +1 -1
  163. package/dist/src/scroll-gesture.js +1 -1
  164. package/dist/src/sdk-batch-runner.js +2 -2
  165. package/dist/src/sdk-batch.js +1 -1
  166. package/dist/src/sdk-contracts.d.ts +18 -2
  167. package/dist/src/sdk-contracts.js +2 -2
  168. package/dist/src/sdk-finders.js +1 -1
  169. package/dist/src/sdk-selectors.d.ts +13 -4
  170. package/dist/src/sdk-selectors.js +1 -1
  171. package/dist/src/selection.js +0 -0
  172. package/dist/src/selector-pipeline-policy.js +1 -0
  173. package/dist/src/selector-runtime.js +1 -1
  174. package/dist/src/selectors.js +1 -1
  175. package/dist/src/server.js +1 -1
  176. package/dist/src/session-runtime-admission.js +1 -1
  177. package/dist/src/session-snapshot.js +1 -1
  178. package/dist/src/session-store.js +3 -3
  179. package/dist/src/session2.js +5 -5
  180. package/dist/src/simulator-boot.js +1 -1
  181. package/dist/src/simulator.js +1 -1
  182. package/dist/src/snapshot-desktop-projection.js +1 -1
  183. package/dist/src/snapshot-runtime-binding.js +1 -1
  184. package/dist/src/snapshot-runtime.js +1 -1
  185. package/dist/src/snapshot-state.js +1 -1
  186. package/dist/src/snapshot4.js +1 -1
  187. package/dist/src/src.js +1 -1
  188. package/dist/src/src7.js +1 -1
  189. package/dist/src/target-evidence.js +1 -1
  190. package/dist/src/text-entry-focus.js +1 -1
  191. package/dist/src/tool-provider.js +3 -3
  192. package/dist/src/tool-provider2.js +1 -1
  193. package/dist/src/tool-provider3.js +1 -1
  194. package/dist/src/toolchain-probe.js +1 -1
  195. package/dist/src/touch-runtime.js +1 -1
  196. package/dist/src/touch-runtime2.js +1 -0
  197. package/dist/src/tree.js +1 -1
  198. package/dist/src/type-text-runtime.js +1 -1
  199. package/dist/src/update-check.js +1 -1
  200. package/dist/src/video.js +1 -1
  201. package/package.json +1 -1
  202. package/server.json +2 -2
  203. package/android/ime-helper/dist/agent-device-android-ime-helper-0.21.18.apk.sha256 +0 -1
  204. package/android/snapshot-helper/dist/agent-device-android-snapshot-helper-0.21.18.apk.sha256 +0 -1
  205. package/dist/src/runner-command-traits.js +0 -1
package/dist/src/video.js CHANGED
@@ -1,4 +1,4 @@
1
- import{N as e}from"./sdk-contracts.js";import{or as t}from"./sdk-batch.js";import{C as n}from"./owner-identity.js";import{c as r}from"./exec.js";import{t as i}from"./timeouts.js";import{n as a,t as o}from"./file.js";import"./command.js";import"./process.js";import"./retry.js";import s from"node:path";import c from"node:fs";import{createHash as l}from"node:crypto";import u from"node:os";import{fileURLToPath as d}from"node:url";const f=`apple/runner/AgentDeviceRunner/RecordingScripts`;function p(e,t,n,r){let i=`${f}/${e}`,a=`dist/${i}`;return[s.resolve(t,e),s.resolve(n,i),s.resolve(t,`../${i}`),s.resolve(t,`../../${i}`),s.resolve(t,`../../../${i}`),s.resolve(n,a),s.resolve(r,i)]}function m(t,n,r=s.dirname(d(import.meta.url)),i=process.cwd()){let a=p(t,r,n,i);for(let e of a)if(c.existsSync(e))return e;throw new e(`COMMAND_FAILED`,`Missing recording helper script: ${t}`,{hint:`Ensure ${f} is present in this checkout or bundled under dist/${f} in the package.`,scriptName:t,searchedPaths:a})}function h(e=process.env){let t=v(),n=s.join(t,`home`),r=s.join(t,`module-cache`);return c.mkdirSync(n,{recursive:!0}),c.mkdirSync(r,{recursive:!0}),{...e,HOME:n,CLANG_MODULE_CACHE_PATH:r}}async function g(e){let t=[e.sourcePath,...e.extraSourcePaths??[]],n=t.map(e=>({sourcePath:e,stat:c.statSync(e),source:c.readFileSync(e)})),r=S(e.cacheName??s.basename(e.sourcePath,s.extname(e.sourcePath))),i=C([`2`,process.platform,process.arch,...n.flatMap(({sourcePath:e,stat:t,source:n})=>[s.resolve(e),t.size,n])]),a=s.join(v(),`bin`,`${r}-${i}`);return await y({sourcePaths:t,executablePath:a,timeoutMs:e.timeoutMs}),a}async function _(e){let t=S(e.cacheName),n=C([`2`,process.platform,process.arch,e.source]),r=s.join(v(),`sources`,`${t}-${n}.swift`),i=s.join(v(),`bin`,`${t}-${n}`);return await y({sourcePaths:[r],executablePath:i,sourceText:e.source,timeoutMs:e.timeoutMs}),i}function v(){let e=process.env.AGENT_DEVICE_SWIFT_CACHE_DIR?.trim();return e?s.resolve(e):s.join(u.tmpdir(),`agent-device-swift-cache`)}async function y(e){if(x(e.executablePath))return;let t=s.dirname(e.executablePath);c.mkdirSync(t,{recursive:!0});let n=e.timeoutMs??12e4;await a({acquire:()=>b(`${e.executablePath}.lock`,n),task:async()=>{if(x(e.executablePath))return;let i=c.mkdtempSync(s.join(t,`.${s.basename(e.executablePath)}.${process.pid}.`)),a=s.join(i,s.basename(e.executablePath));try{let[t]=e.sourcePaths;e.sourceText!==void 0&&t&&!c.existsSync(t)&&(c.mkdirSync(s.dirname(t),{recursive:!0}),c.writeFileSync(t,e.sourceText)),await r(`xcrun`,[`swiftc`,...e.sourcePaths,`-o`,a],{timeoutMs:n,env:h()}),c.renameSync(a,e.executablePath)}finally{c.rmSync(i,{recursive:!0,force:!0})}}})}async function b(t,r){try{return await o({lockDirPath:t,owner:{pid:process.pid,startTime:n(process.pid),acquiredAtMs:Date.now()},timeoutMs:r,pollMs:25,ownerGraceMs:r,description:`Swift cache lock: ${t} (${r}ms)`})}catch(n){throw n instanceof e&&n.message.startsWith(`Timed out waiting for Swift cache lock:`)?new e(`COMMAND_FAILED`,n.message,{...n.details,lockDir:t,timeoutMs:r,hint:`Another agent-device process may still be compiling this Swift helper. Retry shortly; if no agent-device process is active, remove "${t}" and retry.`}):n}}function x(e){try{return c.accessSync(e,c.constants.X_OK),c.statSync(e).isFile()}catch{return!1}}function S(e){return t(e.replaceAll(/[^A-Za-z0-9._-]/g,`-`))||`swift-helper`}function C(e){let t=l(`sha256`);for(let n of e)t.update(Buffer.isBuffer(n)?n:String(n)),t.update(`\0`);return t.digest(`hex`).slice(0,16)}const w={block:161,blockGroup:160,cluster:524531317,codecId:134,documentType:17026,ebml:440786851,segment:408125543,simpleBlock:163,trackEntry:174,trackNumber:215,tracks:374648427,trackType:131};function T(e){let t=E(e);if(!t)return!1;let{bytes:n,fileSize:r}=t,i=L(n,0,n.length,r);if(!i||i.id!==w.ebml||!i.complete||i.unknownSize||!D(n,i))return!1;let a=L(n,i.nextOffset,n.length,r);return!a||a.id!==w.segment||!V(a,r)?!1:O(n,a,r)}function E(e){try{let t=c.openSync(e,`r`);try{let e=c.fstatSync(t).size;if(e<=0)return;let n=Buffer.alloc(Math.min(e,1048576));return c.readSync(t,n,0,n.length,0)===n.length?{bytes:n,fileSize:e}:void 0}finally{c.closeSync(t)}}catch{return}}function D(e,t){let n=I(e,t)?.find(e=>e.id===w.documentType);return n!==void 0&&e.toString(`ascii`,n.dataStart,n.dataEnd)===`webm`}function O(e,t,n){let r=new Set,i=new Set;for(let a=t.dataStart;a<t.dataEnd;){let o=L(e,a,t.dataEnd,n);if(!o||!V(o,n))return!1;if(o.id===w.tracks&&k(e,o,r),o.id===w.cluster&&j(e,o,n,i),H(r,i))return!0;if(!o.complete||o.unknownSize)return!1;a=o.nextOffset}return!1}function k(e,t,n){let r=I(e,t);if(r){for(let t of r)if(t.id===w.trackEntry){let r=A(e,t);r!==void 0&&n.add(r)}}}function A(e,t){let n=I(e,t),r=F(e,n,w.trackNumber),i=F(e,n,w.trackType),a=n?.find(e=>e.id===w.codecId),o=a?e.toString(`ascii`,a.dataStart,a.dataEnd):void 0;return i===1&&o?.startsWith(`V_`)?r:void 0}function j(e,t,n,r){for(let i=t.dataStart;i<t.dataEnd;){let a=L(e,i,t.dataEnd,n);if(!a||!V(a,n)||(a.id===w.simpleBlock&&N(e,a,r),a.id===w.blockGroup&&M(e,a,r),!a.complete||a.unknownSize))return;i=a.nextOffset}}function M(e,t,n){let r=I(e,t)?.find(e=>e.id===w.block);r&&N(e,r,n)}function N(e,t,n){if(!t.complete||t.unknownSize)return;let r=z(e,t.dataStart);!r||r.unknown||t.dataEnd-t.dataStart<r.length+4||n.add(r.value)}function P(e,t){let n=t.dataEnd-t.dataStart;if(n<1||n>6)return;let r=0;for(let n=t.dataStart;n<t.dataEnd;n+=1)r=r*256+e[n];return Number.isSafeInteger(r)?r:void 0}function F(e,t,n){let r=t?.find(e=>e.id===n);return r?P(e,r):void 0}function I(e,t){if(!t.complete||t.unknownSize)return;let n=[];for(let r=t.dataStart;r<t.dataEnd;){let i=L(e,r,t.dataEnd,e.length);if(!i||!i.complete||i.unknownSize)return;n.push(i),r=i.nextOffset}return n}function L(e,t,n,r){let i=R(e,t);if(!i)return;let a=z(e,t+i.length);if(!a)return;let o=t+i.length+a.length;if(o>n)return;let s=a.unknown?r:o+a.value;if(!(!Number.isSafeInteger(s)||s<o))return{id:i.value,dataStart:o,dataEnd:Math.min(s,n),nextOffset:s,complete:s<=n,unknownSize:a.unknown}}function R(e,t){let n=B(e,t,4);if(!n)return;let r=0;for(let i=0;i<n;i+=1)r=r*256+e[t+i];return{length:n,value:r}}function z(e,t){let n=B(e,t,8);if(!n)return;let r=e[t],i=128>>n-1;if((r&i-1)==i-1&&e.subarray(t+1,t+n).every(e=>e===255))return{length:n,value:0,unknown:!0};let a=r&i-1;for(let r=1;r<n;r+=1)a=a*256+e[t+r];return Number.isSafeInteger(a)?{length:n,value:a,unknown:!1}:void 0}function B(e,t,n){let r=e[t];if(r===void 0||r===0)return;let i=128,a=1;for(;(r&i)===0;)i>>=1,a+=1;return a<=n&&t+a<=e.length?a:void 0}function V(e,t){return e.unknownSize||e.nextOffset<=t}function H(e,t){for(let n of e)if(t.has(n))return!0;return!1}let U;async function W(e,t={}){let n=t.pollMs??150,r=t.attempts??12,a,o=0;for(let t=0;t<r;t+=1){let t=0;try{t=c.statSync(e).size}catch{t=0}if(t>0&&t===a){if(o+=1,o>=2)return}else o=0;a=t,await i(n)}}async function G(e){let t=await Z(e);if(!t)return!1;if(t===`webm`)return!0;try{let t=await K(),n=await r(t,[e],{allowFailure:!0,timeoutMs:1e4,env:h()});return n.exitCode===0||Y(n.stderr,n.stdout)}catch(e){if(q(e))return!0;throw e}}async function K(){U??=_({source:`import Foundation
1
+ import{N as e}from"./sdk-contracts.js";import{sr as t}from"./sdk-batch.js";import{C as n}from"./owner-identity.js";import{l as r}from"./exec.js";import{t as i}from"./timeouts.js";import{n as a,t as o}from"./file.js";import"./command.js";import"./process.js";import"./retry.js";import s from"node:path";import c from"node:fs";import{createHash as l}from"node:crypto";import u from"node:os";import{fileURLToPath as d}from"node:url";const f=`apple/runner/AgentDeviceRunner/RecordingScripts`;function p(e,t,n,r){let i=`${f}/${e}`,a=`dist/${i}`;return[s.resolve(t,e),s.resolve(n,i),s.resolve(t,`../${i}`),s.resolve(t,`../../${i}`),s.resolve(t,`../../../${i}`),s.resolve(n,a),s.resolve(r,i)]}function m(t,n,r=s.dirname(d(import.meta.url)),i=process.cwd()){let a=p(t,r,n,i);for(let e of a)if(c.existsSync(e))return e;throw new e(`COMMAND_FAILED`,`Missing recording helper script: ${t}`,{hint:`Ensure ${f} is present in this checkout or bundled under dist/${f} in the package.`,scriptName:t,searchedPaths:a})}function h(e=process.env){let t=v(),n=s.join(t,`home`),r=s.join(t,`module-cache`);return c.mkdirSync(n,{recursive:!0}),c.mkdirSync(r,{recursive:!0}),{...e,HOME:n,CLANG_MODULE_CACHE_PATH:r}}async function g(e){let t=[e.sourcePath,...e.extraSourcePaths??[]],n=t.map(e=>({sourcePath:e,stat:c.statSync(e),source:c.readFileSync(e)})),r=S(e.cacheName??s.basename(e.sourcePath,s.extname(e.sourcePath))),i=C([`2`,process.platform,process.arch,...n.flatMap(({sourcePath:e,stat:t,source:n})=>[s.resolve(e),t.size,n])]),a=s.join(v(),`bin`,`${r}-${i}`);return await y({sourcePaths:t,executablePath:a,timeoutMs:e.timeoutMs}),a}async function _(e){let t=S(e.cacheName),n=C([`2`,process.platform,process.arch,e.source]),r=s.join(v(),`sources`,`${t}-${n}.swift`),i=s.join(v(),`bin`,`${t}-${n}`);return await y({sourcePaths:[r],executablePath:i,sourceText:e.source,timeoutMs:e.timeoutMs}),i}function v(){let e=process.env.AGENT_DEVICE_SWIFT_CACHE_DIR?.trim();return e?s.resolve(e):s.join(u.tmpdir(),`agent-device-swift-cache`)}async function y(e){if(x(e.executablePath))return;let t=s.dirname(e.executablePath);c.mkdirSync(t,{recursive:!0});let n=e.timeoutMs??12e4;await a({acquire:()=>b(`${e.executablePath}.lock`,n),task:async()=>{if(x(e.executablePath))return;let i=c.mkdtempSync(s.join(t,`.${s.basename(e.executablePath)}.${process.pid}.`)),a=s.join(i,s.basename(e.executablePath));try{let[t]=e.sourcePaths;e.sourceText!==void 0&&t&&!c.existsSync(t)&&(c.mkdirSync(s.dirname(t),{recursive:!0}),c.writeFileSync(t,e.sourceText)),await r(`xcrun`,[`swiftc`,...e.sourcePaths,`-o`,a],{timeoutMs:n,env:h()}),c.renameSync(a,e.executablePath)}finally{c.rmSync(i,{recursive:!0,force:!0})}}})}async function b(t,r){try{return await o({lockDirPath:t,owner:{pid:process.pid,startTime:n(process.pid),acquiredAtMs:Date.now()},timeoutMs:r,pollMs:25,ownerGraceMs:r,description:`Swift cache lock: ${t} (${r}ms)`})}catch(n){throw n instanceof e&&n.message.startsWith(`Timed out waiting for Swift cache lock:`)?new e(`COMMAND_FAILED`,n.message,{...n.details,lockDir:t,timeoutMs:r,hint:`Another agent-device process may still be compiling this Swift helper. Retry shortly; if no agent-device process is active, remove "${t}" and retry.`}):n}}function x(e){try{return c.accessSync(e,c.constants.X_OK),c.statSync(e).isFile()}catch{return!1}}function S(e){return t(e.replaceAll(/[^A-Za-z0-9._-]/g,`-`))||`swift-helper`}function C(e){let t=l(`sha256`);for(let n of e)t.update(Buffer.isBuffer(n)?n:String(n)),t.update(`\0`);return t.digest(`hex`).slice(0,16)}const w={block:161,blockGroup:160,cluster:524531317,codecId:134,documentType:17026,ebml:440786851,segment:408125543,simpleBlock:163,trackEntry:174,trackNumber:215,tracks:374648427,trackType:131};function T(e){let t=E(e);if(!t)return!1;let{bytes:n,fileSize:r}=t,i=L(n,0,n.length,r);if(!i||i.id!==w.ebml||!i.complete||i.unknownSize||!D(n,i))return!1;let a=L(n,i.nextOffset,n.length,r);return!a||a.id!==w.segment||!V(a,r)?!1:O(n,a,r)}function E(e){try{let t=c.openSync(e,`r`);try{let e=c.fstatSync(t).size;if(e<=0)return;let n=Buffer.alloc(Math.min(e,1048576));return c.readSync(t,n,0,n.length,0)===n.length?{bytes:n,fileSize:e}:void 0}finally{c.closeSync(t)}}catch{return}}function D(e,t){let n=I(e,t)?.find(e=>e.id===w.documentType);return n!==void 0&&e.toString(`ascii`,n.dataStart,n.dataEnd)===`webm`}function O(e,t,n){let r=new Set,i=new Set;for(let a=t.dataStart;a<t.dataEnd;){let o=L(e,a,t.dataEnd,n);if(!o||!V(o,n))return!1;if(o.id===w.tracks&&k(e,o,r),o.id===w.cluster&&j(e,o,n,i),H(r,i))return!0;if(!o.complete||o.unknownSize)return!1;a=o.nextOffset}return!1}function k(e,t,n){let r=I(e,t);if(r){for(let t of r)if(t.id===w.trackEntry){let r=A(e,t);r!==void 0&&n.add(r)}}}function A(e,t){let n=I(e,t),r=F(e,n,w.trackNumber),i=F(e,n,w.trackType),a=n?.find(e=>e.id===w.codecId),o=a?e.toString(`ascii`,a.dataStart,a.dataEnd):void 0;return i===1&&o?.startsWith(`V_`)?r:void 0}function j(e,t,n,r){for(let i=t.dataStart;i<t.dataEnd;){let a=L(e,i,t.dataEnd,n);if(!a||!V(a,n)||(a.id===w.simpleBlock&&N(e,a,r),a.id===w.blockGroup&&M(e,a,r),!a.complete||a.unknownSize))return;i=a.nextOffset}}function M(e,t,n){let r=I(e,t)?.find(e=>e.id===w.block);r&&N(e,r,n)}function N(e,t,n){if(!t.complete||t.unknownSize)return;let r=z(e,t.dataStart);!r||r.unknown||t.dataEnd-t.dataStart<r.length+4||n.add(r.value)}function P(e,t){let n=t.dataEnd-t.dataStart;if(n<1||n>6)return;let r=0;for(let n=t.dataStart;n<t.dataEnd;n+=1)r=r*256+e[n];return Number.isSafeInteger(r)?r:void 0}function F(e,t,n){let r=t?.find(e=>e.id===n);return r?P(e,r):void 0}function I(e,t){if(!t.complete||t.unknownSize)return;let n=[];for(let r=t.dataStart;r<t.dataEnd;){let i=L(e,r,t.dataEnd,e.length);if(!i||!i.complete||i.unknownSize)return;n.push(i),r=i.nextOffset}return n}function L(e,t,n,r){let i=R(e,t);if(!i)return;let a=z(e,t+i.length);if(!a)return;let o=t+i.length+a.length;if(o>n)return;let s=a.unknown?r:o+a.value;if(!(!Number.isSafeInteger(s)||s<o))return{id:i.value,dataStart:o,dataEnd:Math.min(s,n),nextOffset:s,complete:s<=n,unknownSize:a.unknown}}function R(e,t){let n=B(e,t,4);if(!n)return;let r=0;for(let i=0;i<n;i+=1)r=r*256+e[t+i];return{length:n,value:r}}function z(e,t){let n=B(e,t,8);if(!n)return;let r=e[t],i=128>>n-1;if((r&i-1)==i-1&&e.subarray(t+1,t+n).every(e=>e===255))return{length:n,value:0,unknown:!0};let a=r&i-1;for(let r=1;r<n;r+=1)a=a*256+e[t+r];return Number.isSafeInteger(a)?{length:n,value:a,unknown:!1}:void 0}function B(e,t,n){let r=e[t];if(r===void 0||r===0)return;let i=128,a=1;for(;(r&i)===0;)i>>=1,a+=1;return a<=n&&t+a<=e.length?a:void 0}function V(e,t){return e.unknownSize||e.nextOffset<=t}function H(e,t){for(let n of e)if(t.has(n))return!0;return!1}let U;async function W(e,t={}){let n=t.pollMs??150,r=t.attempts??12,a,o=0;for(let t=0;t<r;t+=1){let t=0;try{t=c.statSync(e).size}catch{t=0}if(t>0&&t===a){if(o+=1,o>=2)return}else o=0;a=t,await i(n)}}async function G(e){let t=await Z(e);if(!t)return!1;if(t===`webm`)return!0;try{let t=await K(),n=await r(t,[e],{allowFailure:!0,timeoutMs:1e4,env:h()});return n.exitCode===0||Y(n.stderr,n.stdout)}catch(e){if(q(e))return!0;throw e}}async function K(){U??=_({source:`import Foundation
2
2
  import AVFoundation
3
3
 
4
4
  let url = URL(fileURLWithPath: CommandLine.arguments[1])
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-device",
3
- "version": "0.21.18",
3
+ "version": "0.21.20",
4
4
  "description": "Mobile app automation and verification for AI coding agents. CLI, MCP server, and typed Node.js API for iOS, Android, HarmonyOS, TV, web, macOS, and Linux.",
5
5
  "mcpName": "io.github.callstack/agent-device",
6
6
  "license": "MIT",
package/server.json CHANGED
@@ -7,12 +7,12 @@
7
7
  "url": "https://github.com/callstack/agent-device",
8
8
  "source": "github"
9
9
  },
10
- "version": "0.21.18",
10
+ "version": "0.21.20",
11
11
  "packages": [
12
12
  {
13
13
  "registryType": "npm",
14
14
  "identifier": "agent-device",
15
- "version": "0.21.18",
15
+ "version": "0.21.20",
16
16
  "transport": {
17
17
  "type": "stdio"
18
18
  },
@@ -1 +0,0 @@
1
- 00d2204c16819a569c8e657a353b165e3bf12971176078ddfdea069d0702adf9 agent-device-android-ime-helper-0.21.18.apk
@@ -1 +0,0 @@
1
- ea1eeb62917f37fa08228e609c5270279de095db2e222577e7588ef23364c046 agent-device-android-snapshot-helper-0.21.18.apk
@@ -1 +0,0 @@
1
- const e={readOnly:!1,readinessProbe:!1,readinessPreflightExempt:!1,readinessPreflightSkipEligibleAfterHealthyMutation:!1},t={...e,readinessPreflightExempt:!0},n={...e,readOnly:!0},r={...n,readinessProbe:!0},i={...e,readinessPreflightSkipEligibleAfterHealthyMutation:!0},a={tap:i,mouseClick:e,longPress:i,drag:i,remotePress:e,type:e,swipe:i,scroll:i,desktopScroll:i,findText:n,querySelector:n,readText:n,snapshot:n,screenshot:n,backInApp:e,backSystem:e,home:e,rotate:e,gesture:i,gestureViewport:n,appSwitcher:e,actionButton:e,keyboardDismiss:e,keyboardReturn:e,alert:t=>(t.action??`get`).toLowerCase()===`get`?n:e,sequence:i,recordStart:e,recordStop:e,status:r,uptime:r,appState:n,pasteboardWrite:e,activate:t,terminate:t,targetReset:t,shutdown:e};function o(e){return u(e).readOnly}function s(e){return u(e).readinessProbe}function c(e){return u(e).readinessPreflightExempt}function l(e){return u(e).readinessPreflightSkipEligibleAfterHealthyMutation}function u(e){let t=a[e.command];return typeof t==`function`?t(e):t}export{s as i,o as n,c as r,l as t};