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 • 487 B
JavaScript
const e=/^\s*(\d+(?:\.\d+)?)/;async function t(e){let t=Date.now(),r=await n(e);return r===void 0?{observed:!1,reason:`unobserved`}:{observed:!0,bootedAtMs:t-r*1e3}}async function n(t){try{let{runAndroidShell:n}=await import(`./adb.js`).then(e=>e.t),r=await n(t,[`cat`,`/proc/uptime`],{allowFailure:!0,timeoutMs:3e3});if(r.exitCode!==0)return;let i=Number.parseFloat(e.exec(r.stdout)?.[1]??``);return Number.isFinite(i)&&i>=0?i:void 0}catch{return}}export{t as observeAndroidBootTimeMs};