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 • 959 B
JavaScript
import{v as e}from"./sdk-contracts.js";import{R as t,S as n,W as r,a as i,l as a}from"./host2.js";async function o(n,o){if(await r(n))return;let c;try{let e=await t(i(n,[`list`,`devices`,`-j`]),{allowFailure:!0,timeoutMs:5e3,signal:o});c=e.exitCode===0?s(e.stdout,n.id):void 0}catch(e){o?.throwIfAborted(),a({level:`warn`,phase:`ios_runner_startup_simulator_listing_failed`,data:{deviceId:n.id,error:String(e)}});return}if(c===!1)throw new e(`DEVICE_NOT_FOUND`,`iOS simulator ${n.id} no longer exists`,{deviceId:n.id,...n.simulatorSetPath?{simulatorSetPath:n.simulatorSetPath}:{},dispatched:`no`,hint:`The simulator this session targets was deleted. Close this session, then open the app on an existing simulator (run devices to list them).`})}function s(e,t){let r;try{r=JSON.parse(e)}catch{return}if(!(!n(r)||!n(r.devices)))return Object.values(r.devices).some(e=>Array.isArray(e)&&e.some(e=>n(e)&&e.udid===t))}export{o as assertBootedSimulatorStillListed};