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 • 775 B
JavaScript
import{B as e}from"./sdk-contracts.js";import{n as t}from"./ime-state.js";function n(e){return Object.freeze({canShutdownTarget:r,shutdownTarget:async(t,n)=>await i(e.commands,t,n)})}function r(e){return e.platform===`android`&&e.kind===`emulator`}async function i(n,r,i){if(r.booted===!1)return a();i.throwIfAborted(),await t(r.id,i),i.throwIfAborted();try{let e=await n.run({executable:`adb`,args:[`-s`,r.id,`emu`,`kill`],allowFailure:!0,timeoutMs:15e3},i);i.throwIfAborted();let t=e.exitCode??-1;return{success:t===0,exitCode:t,stdout:e.stdout,stderr:e.stderr}}catch(t){i.throwIfAborted();let n=e(t);return{success:!1,exitCode:-1,stdout:``,stderr:n.message,error:n}}}function a(){return{success:!0,exitCode:0,stdout:``,stderr:``}}export{n as createAndroidShutdownRuntime};