UNPKG

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 • 326 B
import{AsyncLocalStorage as e}from"node:async_hooks";const t=new e,n=new Map;function r(e,r,i){let a=t.getStore()??n;return a.has(e)||a.set(e,{value:r(),dispose:i}),a.get(e).value}function i(){let e=new Map;return{run:n=>t.run(e,n),dispose:()=>{for(let{value:t,dispose:n}of e.values())n?.(t);e.clear()}}}export{r as n,i as t};