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 • 1.7 kB
import{w as e}from"./sdk-device.js";import{t}from"./platform-runtime-android-mechanics.js";import{resolveRequestedOpenSurface as n,resolveSessionAppBundleIdForTarget as r,validateOpenRelaunchTarget as i}from"./platform-runtime-open-target.js";let a;async function o(){if(a)return a;let{createAppleSessionObservation:e}=await import(`./session-observation.js`),{listLocalDeviceInventory:t,shouldPropagateDeviceInventoryProbeError:n}=await import(`./device-inventory-context.js`).then(e=>e.t);return a??=e({listLocalDevices:t,shouldPropagateProbeError:n}),a}const s=Object.freeze({async observeRunnerSession(e){return(await o()).observeRunnerSession(e)},async resolveSoleForegroundApp(e){return(await o()).resolveSoleForegroundApp(e)}}),c=Object.freeze({async observeBootTimeMs(t){if(e(t)&&t.kind===`simulator`){let{observeSimulatorBootTimeMs:e}=await import(`./simulator-boot.js`);return await e(t)}if(t.platform===`android`){let{observeAndroidBootTimeMs:e}=await import(`./device-boot.js`);return await e(t)}return{observed:!1,reason:`unsupported-device`}}});async function l(n,r){if(e(n)){if(n.kind===`simulator`){let{ensureBootedSimulator:e}=await import(`./simulator-facade.js`);return await e(n),!0}if(n.kind===`device`){let{resolveIosPhysicalDeviceControl:e}=await import(`./physical-device-facade.js`);return await e(n).ensureReady(n),!0}}if(n.platform===`android`){let{waitForAndroidBoot:e}=await t();return await e(n.id,void 0,r),!0}return!1}function u(){return Object.freeze({appleSessionObservation:s,deviceBootObservation:c,ensureLocalDeviceReady:l,resolveRequestedOpenSurface:n,validateOpenRelaunchTarget:i,resolveSessionAppBundleIdForTarget:r})}export{u as createDaemonPlatformServices};