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 • 589 B
JavaScript
import{C as e,v as t}from"./sdk-contracts.js";async function n(n,r,i=()=>{let n=r?.reason;return n instanceof t?n:n instanceof Error&&n.name===`TimeoutError`?new t(`COMMAND_FAILED`,`Operation deadline expired`,{reason:`operation_deadline_expired`},n):n instanceof Error&&n.name!==`AbortError`?n:e(void 0,n)}){return r?await new Promise((e,t)=>{let a=()=>{r.removeEventListener(`abort`,a);try{t(i())}catch(e){t(e)}};r.addEventListener(`abort`,a,{once:!0}),r.aborted&&a(),n.then(t=>{r.removeEventListener(`abort`,a),e(t)},e=>{r.removeEventListener(`abort`,a),t(e)})}):await n}export{n as t};