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.31 kB
JavaScript
import{v as e}from"./sdk-contracts.js";import{t}from"./config.js";import{t as n}from"./display-inventory.js";import{n as r}from"./orientation.js";function i(t,n){return new e(`COMMAND_FAILED`,n,{deviceId:t.id,reason:`panel-table-unreadable`,runnerErrorCode:`APP_SCREEN_UNRESOLVED`,dispatched:`no`,hint:`The panel table is unreadable, so no lit panel can be named and nothing was sent. Retry; if it persists, run xcrun devicectl device info displays --device <udid>.`})}async function a(e,a){let o=await r(e,{signal:a.signal,timeoutMs:Math.min(a.requestTimeoutMs??5e3,t)});if(o.kind===`unreadable`)throw i(e,`The panel table of ${e.name} did not answer, so the lit panel cannot be named`);return o.kind===`multi-panel`?n(o.inventory):void 0}async function o(t,n,r){let i=Date.now(),o=await a(t,{signal:r,requestTimeoutMs:n.timeoutMs});if(!o)return n;if(n.timeoutMs===void 0)return{...n,litPanel:o};let s=n.timeoutMs-(Date.now()-i);if(s<1)throw new e(`COMMAND_FAILED`,`Reading the panel table of ${t.name} spent the request's ${n.timeoutMs} ms, so nothing was sent`,{deviceId:t.id,reason:`panel-probe-budget-exhausted`,dispatched:`no`,hint:`Increase the request timeout to leave time for the command after reading the panel table.`});return{...n,litPanel:o,timeoutMs:s}}export{o as nameRunnerRequestLitPanel};