agent-device
Version:
Open source device layer for AI coding agents: a CLI, MCP server, and typed Node.js API to control mobile, web, TV, and desktop apps on devices and simulators, locally or in the cloud.
1 lines • 1.4 kB
JavaScript
import{Ot as e,St as t}from"./sdk-io.js";import"./diagnostics.js";import{o as n}from"./adb-executor.js";import{F as r,N as i,h as a,l as o,s,t as c}from"./snapshot-helper-install.js";function l(e){return{packageName:e.manifest.packageName,runner:e.manifest.instrumentationRunner,helperVersion:e.manifest.version,helperVersionCode:e.manifest.versionCode,sha256:e.manifest.sha256}}async function u(o,s){s?.throwIfAborted();let l=n(o),u=l.snapshotHelperArtifact??await d(),f=i(o);await r({deviceKey:f,adb:l.exec,signal:s});let p=await e(`android_touch_helper_install`,async()=>await c({adb:l.exec,adbProvider:l,artifact:u,deviceKey:f,timeoutMs:3e4,signal:s}),{packageName:u.manifest.packageName,versionCode:u.manifest.versionCode});return t({phase:`android_touch_helper_install_decision`,data:p}),p.installed&&await a(f,{signal:s}),s?.throwIfAborted(),{adb:l.exec,adbProvider:l,artifact:u,install:p,deviceKey:f}}async function d(){return await s({helperDirName:`snapshot-helper`,manifestFileName:e=>`agent-device-android-snapshot-helper-${e}.manifest.json`,parseManifest:e=>{let t=o(e);return{...t,assetName:t.assetName??`agent-device-android-snapshot-helper-${t.version}.apk`}},unavailableMessage:`Android automation requires the bundled Android automation helper artifact, but it was not found or could not be read`})}export{l as androidAutomationHelperIdentity,u as prepareAndroidAutomationHelper};