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.27 kB
JavaScript
import{r as e}from"./rolldown-runtime.js";import{F as t,v as n}from"./sdk-contracts.js";import{AsyncLocalStorage as r}from"node:async_hooks";var i=e({listDeviceInventory:()=>u,listLocalDeviceInventory:()=>f,readAppDeviceResolver:()=>l,readDeviceInventory:()=>d,readInstalledAppProbe:()=>c,shouldPropagateDeviceInventoryProbeError:()=>h,withDeviceInventoryContext:()=>s});const a=`device_inventory_context_unavailable`,o=new r;async function s(e,t){return await o.run(e,t)}function c(){return o.getStore()?.findInstalledApp}function l(){return o.getStore()?.resolveAppDevice}async function u(e){return await p(`providerFirst`,e)}async function d(e){let t=m(),n=await t.providerFirst.discoverWithSource(e,t.requestScope);return{devices:n.devices.map(e=>({...e})),source:n.source}}async function f(e){return await p(`localOnly`,e)}async function p(e,t){let n=m();return(await n[e].discover(t,n.requestScope)).map(e=>({...e}))}function m(){let e=o.getStore();if(!e)throw new n(`COMMAND_FAILED`,`Device inventory gateway is unavailable outside request execution`,{reason:a});return e}function h(e){return t(e)||e instanceof n&&e.code===`COMMAND_FAILED`&&e.details?.reason===a?!0:e instanceof Error&&e.name===`AbortError`}export{d as a,l as i,u as n,h as o,f as r,s,i as t};