agent-device 0.21.5 → 0.21.6

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 (39) hide show
  1. package/android/ime-helper/dist/{agent-device-android-ime-helper-0.21.5.apk → agent-device-android-ime-helper-0.21.6.apk} +0 -0
  2. package/android/ime-helper/dist/agent-device-android-ime-helper-0.21.6.apk.sha256 +1 -0
  3. package/android/ime-helper/dist/{agent-device-android-ime-helper-0.21.5.manifest.json → agent-device-android-ime-helper-0.21.6.manifest.json} +4 -4
  4. package/android/snapshot-helper/dist/{agent-device-android-snapshot-helper-0.21.5.apk → agent-device-android-snapshot-helper-0.21.6.apk} +0 -0
  5. package/android/snapshot-helper/dist/agent-device-android-snapshot-helper-0.21.6.apk.sha256 +1 -0
  6. package/android/snapshot-helper/dist/{agent-device-android-snapshot-helper-0.21.5.manifest.json → agent-device-android-snapshot-helper-0.21.6.manifest.json} +6 -6
  7. package/apple/snapshot-bridge/SnapshotBridgeRuntime.m +8 -1
  8. package/dist/src/adapter.js +1 -1
  9. package/dist/src/adb-executor.js +2 -2
  10. package/dist/src/adb-transport.js +1 -0
  11. package/dist/src/agent-browser-tool.js +1 -1
  12. package/dist/src/android-adb.js +1 -1
  13. package/dist/src/android.js +1 -1
  14. package/dist/src/app-helpers.js +1 -1
  15. package/dist/src/app-lifecycle.js +3 -3
  16. package/dist/src/app-log-reconnect.js +1 -1
  17. package/dist/src/device-input-state.d.ts +3 -4
  18. package/dist/src/device-session.js +1 -1
  19. package/dist/src/file.js +1 -1
  20. package/dist/src/internal/bin.js +1 -1
  21. package/dist/src/internal/run-script-http-child.d.ts +1 -1
  22. package/dist/src/ios-snapshot-runtime.js +1 -1
  23. package/dist/src/limrun-runtime-dependencies.js +1 -1
  24. package/dist/src/logcat.js +1 -1
  25. package/dist/src/mechanics.js +16 -16
  26. package/dist/src/perf-runtime-plan.js +1 -1
  27. package/dist/src/platform-runtime-android-adb-host.js +1 -1
  28. package/dist/src/runner-cache-metadata.js +2 -2
  29. package/dist/src/runner-client.js +1 -1
  30. package/dist/src/runner-disposal.js +1 -1
  31. package/dist/src/semantic-index.js +1 -1
  32. package/dist/src/session2.js +5 -5
  33. package/dist/src/tree.js +1 -1
  34. package/dist/src/video.js +2 -2
  35. package/package.json +2 -2
  36. package/server.json +2 -2
  37. package/android/ime-helper/dist/agent-device-android-ime-helper-0.21.5.apk.sha256 +0 -1
  38. package/android/snapshot-helper/dist/agent-device-android-snapshot-helper-0.21.5.apk.sha256 +0 -1
  39. package/dist/src/adb-host.js +0 -1
package/dist/src/tree.js CHANGED
@@ -1 +1 @@
1
- import{Mr as e}from"./sdk-batch.js";function t(e){let t=new Map;for(let n of e){if(typeof n.parentIndex!=`number`)continue;let e=t.get(n.parentIndex)??[];e.push(n),t.set(n.parentIndex,e)}return t}const n=new WeakMap;function r(e,t){if(!e[t])return[];let n=o(e)[t]??t+1;return e.slice(t+1,n)}function i(e,t,n){let r=o(e)[t]??t+1;for(let i=t+1;i<r;i+=1){let t=e[i];if(t&&n(t))return t}}function a(e,t,n){let r=o(e)[t]??t+1;for(let i=t+1;i<r;i+=1){let t=e[i];t&&n(t)}}function o(e){let t=n.get(e);if(t)return t;let r=Array(e.length),i=[];for(let[t,n]of e.entries()){let e=n?.depth??0;for(;i.length>0&&e<=i.at(-1).depth;){let e=i.pop();r[e.position]=t}i.push({depth:e,position:t})}for(let t of i)r[t.position]=e.length;return n.set(e,r),r}function s(e,t){let n=[],r=typeof e.parentIndex==`number`?t.get(e.parentIndex):void 0,i=new Set;for(;r&&!i.has(r.index);)i.add(r.index),n.push(r),r=typeof r.parentIndex==`number`?t.get(r.parentIndex):void 0;return n}function c(e,t,n){for(let r of s(e,t))if(n(r))return r;return null}function l(e,t,n={}){return(n.includeSelf===!0&&p(e.type)?e:null)??c(e,t,e=>p(e.type))}function u(t,n){let r=e(t.type??``),i=t.label?.trim();return!!(f(t)||r===`other`&&!i&&!t.value||(r===`other`||r===`statictext`)&&i&&n.includes(i)||r===`image`)}function d(t){let n=e(t.type??``);return n===`button`||n===`link`||n===`switch`||n===`searchfield`||n===`textfield`}function f(t){return e(t.type??``)===`button`&&t.label?.trim()===`chevron`&&t.enabled===!1}function p(t){let n=e(t??``);return n===`collectionview`||n===`table`||n===`scrollview`||n===`scrollarea`}function m(t,n){let r=t.label?.trim();if(!r||r!==n)return!1;let i=e(t.type??``);return i===`other`||i===`statictext`||i===`link`}function h(e,t,n){e.set(t.index,{..._(e,t),...n})}function g(e,t,n){let r=_(e,t);e.set(t.index,{...r,...n(r)})}function _(e,t){return{...t,...e.get(t.index)}}function v(t){let n;for(let r of t){let t=e(r.type??``);(t===`application`||t===`window`)&&b(r.rect,n)&&(n=r.rect)}return n}function y(e,t,n=.8){let r=x(e),i=x(t);return r>0&&i>0&&r/i>=n}function b(e,t){return!!(e&&(!t||x(e)>x(t)))}function x(e){return e?e.width*e.height:0}function S(e,t,n){let r=new Map(n.map(e=>[e.index,e])),i=new Map;for(let[t,n]of e.entries())i.set(n.index,t);return e.map((e,n)=>{let a=typeof e.parentIndex==`number`?i.get(e.parentIndex):void 0;return a===void 0&&typeof e.parentIndex==`number`&&(a=C(e.parentIndex,t,r,i)),{...e,index:n,parentIndex:a}})}function C(e,t,n,r){let i=e,a=new Set;for(;typeof i==`number`&&!a.has(i);){if(a.add(i),!t.has(i))return r.get(i);i=n.get(i)?.parentIndex}}export{c as a,f as c,p as d,d as f,g,u as h,v as i,y as l,S as m,r as n,l as o,h as p,i as r,a as s,t,m as u};
1
+ import{Mr as e}from"./sdk-batch.js";function t(e){let t=new Map;for(let n of e){if(typeof n.parentIndex!=`number`)continue;let e=t.get(n.parentIndex)??[];e.push(n),t.set(n.parentIndex,e)}return t}const n=new WeakMap;function r(e,t){if(!e[t])return[];let n=o(e)[t]??t+1;return e.slice(t+1,n)}function i(e,t,n){let r=o(e)[t]??t+1;for(let i=t+1;i<r;i+=1){let t=e[i];if(t&&n(t))return t}}function a(e,t,n){let r=o(e)[t]??t+1;for(let i=t+1;i<r;i+=1){let t=e[i];t&&n(t)}}function o(e){let t=n.get(e);if(t)return t;let r=Array(e.length),i=[];for(let[t,n]of e.entries()){let e=n?.depth??0;for(;i.length>0&&e<=i.at(-1).depth;){let e=i.pop();r[e.position]=t}i.push({depth:e,position:t})}for(let t of i)r[t.position]=e.length;return n.set(e,r),r}function s(e,t){let n=[],r=typeof e.parentIndex==`number`?t.get(e.parentIndex):void 0,i=new Set;for(;r&&!i.has(r.index);)i.add(r.index),n.push(r),r=typeof r.parentIndex==`number`?t.get(r.parentIndex):void 0;return n}function c(e,t,n){for(let r of s(e,t))if(n(r))return r;return null}function l(e,t,n={}){return(n.includeSelf===!0&&p(e.type)?e:null)??c(e,t,e=>p(e.type))}function u(t,n){let r=e(t.type??``),i=t.label?.trim();return!!(f(t)||r===`other`&&!i&&!t.value||(r===`other`||r===`statictext`)&&i&&n.includes(i)||r===`image`)}function d(t){let n=e(t.type??``);return n===`button`||n===`link`||n===`switch`||n===`searchfield`||n===`textfield`}function f(t){return e(t.type??``)===`button`&&t.label?.trim()===`chevron`&&t.enabled===!1}function p(t){let n=e(t??``);return n===`collectionview`||n===`table`||n===`scrollview`||n===`scrollarea`}function m(t,n){let r=t.label?.trim();if(!r||r!==n)return!1;let i=e(t.type??``);return i===`other`||i===`statictext`||i===`link`}function h(e,t,n){e.set(t.index,_(v(e,t),n))}function g(e,t,n){let r=v(e,t);e.set(t.index,_(r,n(r)))}function _(e,t){let n={...e,...t};for(let[e,r]of Object.entries(t))r===void 0&&delete n[e];return n}function v(e,t){return e.get(t.index)??t}function y(t){let n;for(let r of t){let t=e(r.type??``);(t===`application`||t===`window`)&&x(r.rect,n)&&(n=r.rect)}return n}function b(e,t,n=.8){let r=S(e),i=S(t);return r>0&&i>0&&r/i>=n}function x(e,t){return!!(e&&(!t||S(e)>S(t)))}function S(e){return e?e.width*e.height:0}function C(e,t,n){let r=new Map(n.map(e=>[e.index,e])),i=new Map;for(let[t,n]of e.entries())i.set(n.index,t);return e.map((e,n)=>{let a=typeof e.parentIndex==`number`?i.get(e.parentIndex):void 0;return a===void 0&&typeof e.parentIndex==`number`&&(a=w(e.parentIndex,t,r,i)),{...e,index:n,parentIndex:a}})}function w(e,t,n,r){let i=e,a=new Set;for(;typeof i==`number`&&!a.has(i);){if(a.add(i),!t.has(i))return r.get(i);i=n.get(i)?.parentIndex}}export{c as a,f as c,p as d,d as f,g,u as h,y as i,b as l,C as m,r as n,l as o,h as p,i as r,a as s,t,m as u};
package/dist/src/video.js CHANGED
@@ -1,4 +1,4 @@
1
- import{C as e}from"./sdk-contracts.js";import{nr as t}from"./sdk-batch.js";import{x as n}from"./owner-identity.js";import{c as r}from"./exec.js";import{t as i}from"./timeouts.js";import{t as a}from"./file.js";import"./command.js";import"./retry.js";import"./process.js";import o from"node:path";import s from"node:fs";import{createHash as c}from"node:crypto";import l from"node:os";function u(e=process.env){let t=p(),n=o.join(t,`home`),r=o.join(t,`module-cache`);return s.mkdirSync(n,{recursive:!0}),s.mkdirSync(r,{recursive:!0}),{...e,HOME:n,CLANG_MODULE_CACHE_PATH:r}}async function d(e){let t=[e.sourcePath,...e.extraSourcePaths??[]],n=t.map(e=>({sourcePath:e,stat:s.statSync(e),source:s.readFileSync(e)})),r=_(e.cacheName??o.basename(e.sourcePath,o.extname(e.sourcePath))),i=v([`2`,process.platform,process.arch,...n.flatMap(({sourcePath:e,stat:t,source:n})=>[o.resolve(e),t.size,n])]),a=o.join(p(),`bin`,`${r}-${i}`);return await m({sourcePaths:t,executablePath:a,timeoutMs:e.timeoutMs}),a}async function f(e){let t=_(e.cacheName),n=v([`2`,process.platform,process.arch,e.source]),r=o.join(p(),`sources`,`${t}-${n}.swift`),i=o.join(p(),`bin`,`${t}-${n}`);return await m({sourcePaths:[r],executablePath:i,sourceText:e.source,timeoutMs:e.timeoutMs}),i}function p(){let e=process.env.AGENT_DEVICE_SWIFT_CACHE_DIR?.trim();return e?o.resolve(e):o.join(l.tmpdir(),`agent-device-swift-cache`)}async function m(e){if(g(e.executablePath))return;let t=o.dirname(e.executablePath);s.mkdirSync(t,{recursive:!0});let n=await h(`${e.executablePath}.lock`,e.executablePath,e.timeoutMs??12e4);if(!n)return;let i=s.mkdtempSync(o.join(t,`.${o.basename(e.executablePath)}.${process.pid}.`)),a=o.join(i,o.basename(e.executablePath));try{if(g(e.executablePath))return;let[t]=e.sourcePaths;e.sourceText!==void 0&&t&&!s.existsSync(t)&&(s.mkdirSync(o.dirname(t),{recursive:!0}),s.writeFileSync(t,e.sourceText)),await r(`xcrun`,[`swiftc`,...e.sourcePaths,`-o`,a],{timeoutMs:e.timeoutMs??12e4,env:u()}),s.renameSync(a,e.executablePath)}finally{s.rmSync(i,{recursive:!0,force:!0}),await n()}}async function h(t,r,i){if(g(r))return null;try{return await a({lockDirPath:t,owner:{pid:process.pid,startTime:n(process.pid),acquiredAtMs:Date.now()},timeoutMs:i,pollMs:25,ownerGraceMs:i,description:`Swift cache lock: ${t} (${i}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:i,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 g(e){try{return s.accessSync(e,s.constants.X_OK),s.statSync(e).isFile()}catch{return!1}}function _(e){return t(e.replaceAll(/[^A-Za-z0-9._-]/g,`-`))||`swift-helper`}function v(e){let t=c(`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 y={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 b(e){let t=x(e);if(!t)return!1;let{bytes:n,fileSize:r}=t,i=M(n,0,n.length,r);if(!i||i.id!==y.ebml||!i.complete||i.unknownSize||!S(n,i))return!1;let a=M(n,i.nextOffset,n.length,r);return!a||a.id!==y.segment||!I(a,r)?!1:C(n,a,r)}function x(e){try{let t=s.openSync(e,`r`);try{let e=s.fstatSync(t).size;if(e<=0)return;let n=Buffer.alloc(Math.min(e,1048576));return s.readSync(t,n,0,n.length,0)===n.length?{bytes:n,fileSize:e}:void 0}finally{s.closeSync(t)}}catch{return}}function S(e,t){let n=j(e,t)?.find(e=>e.id===y.documentType);return n!==void 0&&e.toString(`ascii`,n.dataStart,n.dataEnd)===`webm`}function C(e,t,n){let r=new Set,i=new Set;for(let a=t.dataStart;a<t.dataEnd;){let o=M(e,a,t.dataEnd,n);if(!o||!I(o,n))return!1;if(o.id===y.tracks&&w(e,o,r),o.id===y.cluster&&E(e,o,n,i),L(r,i))return!0;if(!o.complete||o.unknownSize)return!1;a=o.nextOffset}return!1}function w(e,t,n){let r=j(e,t);if(r){for(let t of r)if(t.id===y.trackEntry){let r=T(e,t);r!==void 0&&n.add(r)}}}function T(e,t){let n=j(e,t),r=A(e,n,y.trackNumber),i=A(e,n,y.trackType),a=n?.find(e=>e.id===y.codecId),o=a?e.toString(`ascii`,a.dataStart,a.dataEnd):void 0;return i===1&&o?.startsWith(`V_`)?r:void 0}function E(e,t,n,r){for(let i=t.dataStart;i<t.dataEnd;){let a=M(e,i,t.dataEnd,n);if(!a||!I(a,n)||(a.id===y.simpleBlock&&O(e,a,r),a.id===y.blockGroup&&D(e,a,r),!a.complete||a.unknownSize))return;i=a.nextOffset}}function D(e,t,n){let r=j(e,t)?.find(e=>e.id===y.block);r&&O(e,r,n)}function O(e,t,n){if(!t.complete||t.unknownSize)return;let r=P(e,t.dataStart);!r||r.unknown||t.dataEnd-t.dataStart<r.length+4||n.add(r.value)}function k(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 A(e,t,n){let r=t?.find(e=>e.id===n);return r?k(e,r):void 0}function j(e,t){if(!t.complete||t.unknownSize)return;let n=[];for(let r=t.dataStart;r<t.dataEnd;){let i=M(e,r,t.dataEnd,e.length);if(!i||!i.complete||i.unknownSize)return;n.push(i),r=i.nextOffset}return n}function M(e,t,n,r){let i=N(e,t);if(!i)return;let a=P(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 N(e,t){let n=F(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 P(e,t){let n=F(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 F(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 I(e,t){return e.unknownSize||e.nextOffset<=t}function L(e,t){for(let n of e)if(t.has(n))return!0;return!1}let R;async function z(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=s.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 B(e){let t=await K(e);if(!t)return!1;if(t===`webm`)return!0;try{let t=await V(),n=await r(t,[e],{allowFailure:!0,timeoutMs:1e4,env:u()});return n.exitCode===0||W(n.stderr,n.stdout)}catch(e){if(H(e))return!0;throw e}}async function V(){R??=f({source:`import Foundation
1
+ import{C as e}from"./sdk-contracts.js";import{nr as t}from"./sdk-batch.js";import{x 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"./retry.js";import"./process.js";import s from"node:path";import c from"node:fs";import{createHash as l}from"node:crypto";import u from"node:os";function d(e=process.env){let t=m(),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 f(e){let t=[e.sourcePath,...e.extraSourcePaths??[]],n=t.map(e=>({sourcePath:e,stat:c.statSync(e),source:c.readFileSync(e)})),r=v(e.cacheName??s.basename(e.sourcePath,s.extname(e.sourcePath))),i=y([`2`,process.platform,process.arch,...n.flatMap(({sourcePath:e,stat:t,source:n})=>[s.resolve(e),t.size,n])]),a=s.join(m(),`bin`,`${r}-${i}`);return await h({sourcePaths:t,executablePath:a,timeoutMs:e.timeoutMs}),a}async function p(e){let t=v(e.cacheName),n=y([`2`,process.platform,process.arch,e.source]),r=s.join(m(),`sources`,`${t}-${n}.swift`),i=s.join(m(),`bin`,`${t}-${n}`);return await h({sourcePaths:[r],executablePath:i,sourceText:e.source,timeoutMs:e.timeoutMs}),i}function m(){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 h(e){if(_(e.executablePath))return;let t=s.dirname(e.executablePath);c.mkdirSync(t,{recursive:!0});let n=e.timeoutMs??12e4;await a({acquire:()=>g(`${e.executablePath}.lock`,n),task:async()=>{if(_(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:d()}),c.renameSync(a,e.executablePath)}finally{c.rmSync(i,{recursive:!0,force:!0})}}})}async function g(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 _(e){try{return c.accessSync(e,c.constants.X_OK),c.statSync(e).isFile()}catch{return!1}}function v(e){return t(e.replaceAll(/[^A-Za-z0-9._-]/g,`-`))||`swift-helper`}function y(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 b={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 x(e){let t=S(e);if(!t)return!1;let{bytes:n,fileSize:r}=t,i=N(n,0,n.length,r);if(!i||i.id!==b.ebml||!i.complete||i.unknownSize||!C(n,i))return!1;let a=N(n,i.nextOffset,n.length,r);return!a||a.id!==b.segment||!L(a,r)?!1:w(n,a,r)}function S(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 C(e,t){let n=M(e,t)?.find(e=>e.id===b.documentType);return n!==void 0&&e.toString(`ascii`,n.dataStart,n.dataEnd)===`webm`}function w(e,t,n){let r=new Set,i=new Set;for(let a=t.dataStart;a<t.dataEnd;){let o=N(e,a,t.dataEnd,n);if(!o||!L(o,n))return!1;if(o.id===b.tracks&&T(e,o,r),o.id===b.cluster&&D(e,o,n,i),R(r,i))return!0;if(!o.complete||o.unknownSize)return!1;a=o.nextOffset}return!1}function T(e,t,n){let r=M(e,t);if(r){for(let t of r)if(t.id===b.trackEntry){let r=E(e,t);r!==void 0&&n.add(r)}}}function E(e,t){let n=M(e,t),r=j(e,n,b.trackNumber),i=j(e,n,b.trackType),a=n?.find(e=>e.id===b.codecId),o=a?e.toString(`ascii`,a.dataStart,a.dataEnd):void 0;return i===1&&o?.startsWith(`V_`)?r:void 0}function D(e,t,n,r){for(let i=t.dataStart;i<t.dataEnd;){let a=N(e,i,t.dataEnd,n);if(!a||!L(a,n)||(a.id===b.simpleBlock&&k(e,a,r),a.id===b.blockGroup&&O(e,a,r),!a.complete||a.unknownSize))return;i=a.nextOffset}}function O(e,t,n){let r=M(e,t)?.find(e=>e.id===b.block);r&&k(e,r,n)}function k(e,t,n){if(!t.complete||t.unknownSize)return;let r=F(e,t.dataStart);!r||r.unknown||t.dataEnd-t.dataStart<r.length+4||n.add(r.value)}function A(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 j(e,t,n){let r=t?.find(e=>e.id===n);return r?A(e,r):void 0}function M(e,t){if(!t.complete||t.unknownSize)return;let n=[];for(let r=t.dataStart;r<t.dataEnd;){let i=N(e,r,t.dataEnd,e.length);if(!i||!i.complete||i.unknownSize)return;n.push(i),r=i.nextOffset}return n}function N(e,t,n,r){let i=P(e,t);if(!i)return;let a=F(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 P(e,t){let n=I(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 F(e,t){let n=I(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 I(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 L(e,t){return e.unknownSize||e.nextOffset<=t}function R(e,t){for(let n of e)if(t.has(n))return!0;return!1}let z;async function B(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 V(e){let t=await q(e);if(!t)return!1;if(t===`webm`)return!0;try{let t=await H(),n=await r(t,[e],{allowFailure:!0,timeoutMs:1e4,env:d()});return n.exitCode===0||G(n.stderr,n.stdout)}catch(e){if(U(e))return!0;throw e}}async function H(){z??=p({source:`import Foundation
2
2
  import AVFoundation
3
3
 
4
4
  let url = URL(fileURLWithPath: CommandLine.arguments[1])
@@ -20,4 +20,4 @@ Task {
20
20
  }
21
21
 
22
22
  semaphore.wait()
23
- exit(exitCode)`,cacheName:`video-validator`,timeoutMs:3e4});try{return await R}catch(e){throw R=void 0,e}}function H(t){return t instanceof e?t.code===`TOOL_MISSING`||W(String(t.details?.stderr??``),String(t.details?.stdout??``)):!1}async function U(e,t={}){let n=t.pollMs??150,r=t.attempts??12;for(let t=0;t<r;t+=1){if(await B(e))return;await i(n)}}function W(e,t){let n=`${e}\n${t}`;return/\b(no such module ['"]AVFoundation['"]|unable to find utility ["']swiftc?["']|xcrun: error: unable to find utility ["']swiftc?["'])\b/i.test(n)}async function G(e){return await K(e)!==void 0}async function K(e){try{let t=s.statSync(e);if(!t.isFile()||t.size<=0)return}catch{return}return e.toLowerCase().endsWith(`.webm`)?b(e)?`webm`:void 0:await q(e)?`mp4`:void 0}async function q(e){let{findMp4Atom:t}=await import(`./mp4-atoms.js`).then(e=>e.n);return t(e,[`ftyp`])!==void 0&&t(e,[`moov`])!==void 0}export{u as a,z as i,B as n,d as o,U as r,G as t};
23
+ exit(exitCode)`,cacheName:`video-validator`,timeoutMs:3e4});try{return await z}catch(e){throw z=void 0,e}}function U(t){return t instanceof e?t.code===`TOOL_MISSING`||G(String(t.details?.stderr??``),String(t.details?.stdout??``)):!1}async function W(e,t={}){let n=t.pollMs??150,r=t.attempts??12;for(let t=0;t<r;t+=1){if(await V(e))return;await i(n)}}function G(e,t){let n=`${e}\n${t}`;return/\b(no such module ['"]AVFoundation['"]|unable to find utility ["']swiftc?["']|xcrun: error: unable to find utility ["']swiftc?["'])\b/i.test(n)}async function K(e){return await q(e)!==void 0}async function q(e){try{let t=c.statSync(e);if(!t.isFile()||t.size<=0)return}catch{return}return e.toLowerCase().endsWith(`.webm`)?x(e)?`webm`:void 0:await J(e)?`mp4`:void 0}async function J(e){let{findMp4Atom:t}=await import(`./mp4-atoms.js`).then(e=>e.n);return t(e,[`ftyp`])!==void 0&&t(e,[`moov`])!==void 0}export{d as a,B as i,V as n,f as o,W as r,K as t};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-device",
3
- "version": "0.21.5",
3
+ "version": "0.21.6",
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",
@@ -183,7 +183,7 @@
183
183
  "test-app:maestro:android": "pnpm test-app:maestro --platform android",
184
184
  "test": "pnpm test:unit",
185
185
  "test:unit": "vitest run --project unit-core --project fuzz-worker",
186
- "test:maestro-compat": "vitest run --project unit-core packages/maestro src/daemon/adapters/maestro src/compat/__tests__/replay-input.test.ts",
186
+ "test:maestro-compat": "vitest run --project unit-core packages/maestro src/compat/__tests__/replay-input.test.ts",
187
187
  "test:coverage": "vitest run --coverage --project=!fuzz-worker && pnpm test:fuzz-worker",
188
188
  "test:coverage:ci": "vitest run --coverage --project=!fuzz-worker && pnpm test:fuzz-worker",
189
189
  "test:fuzz-worker": "vitest run --project fuzz-worker",
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.5",
10
+ "version": "0.21.6",
11
11
  "packages": [
12
12
  {
13
13
  "registryType": "npm",
14
14
  "identifier": "agent-device",
15
- "version": "0.21.5",
15
+ "version": "0.21.6",
16
16
  "transport": {
17
17
  "type": "stdio"
18
18
  },
@@ -1 +0,0 @@
1
- 2b8fe19f9cf38877dbc4e0bd9400e4d1aebc7b8c2f6063e04f5f198d1564c08d agent-device-android-ime-helper-0.21.5.apk
@@ -1 +0,0 @@
1
- e77b65f51664e95680379cd1a5c8331926b63cf506261df56151854673787514 agent-device-android-snapshot-helper-0.21.5.apk
@@ -1 +0,0 @@
1
- import{AsyncLocalStorage as e}from"node:async_hooks";let t;const n=new e;function r(e){t=e}function i(){if(!t)throw Error(`Android adb host port is not bound; import the platform composition wiring (src/platform-runtime-android-adb-host.ts) before using the adb/IME cluster.`);return t}async function a(e,t){let r=i(),a=n.getStore(),o=r.coerceAdbResult(a?await a(e,t):await r.execHostAdb(e,{...t,allowFailure:!0}));if(!t?.allowFailure&&o.exitCode!==0){let{androidAdbResultError:t}=await import(`./adb-failure.js`).then(e=>e.t);throw t(`adb ${e.join(` `)} exited with code ${o.exitCode}`,o)}return o}async function o(e,t){return await n.run(e,t)}function s(e){i().emitDiagnostic(e)}export{o as a,a as i,s as n,i as r,r as t};