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 • 678 B
import{q as e}from"./sdk-io.js";import{t}from"./daemon-client-transport.js";import"./retry.js";import{_ as n}from"./daemon-lifecycle-errors.js";function r(e){return e.timedOut===!0||e.statusCode!==void 0}async function i(i){let{info:a,recovery:o,deadline:s,hint:c}=i,l=1,u=i.failedProbe;for(;o&&r(u)&&!o.signal?.aborted;){let r=s-performance.now();if(r<=0)throw n({daemonBaseUrl:a.baseUrl,attempts:l,healthRecoveryBudgetMs:o.budgetMs,hint:c});await e(Math.min(1e3,r),o.signal);let i=s-performance.now();if(!(i<=0||o.signal?.aborted)&&(l+=1,u=await t(a,i,o.signal),u.reachable))return u}throw n({daemonBaseUrl:a.baseUrl,attempts:l,hint:c})}export{i as recoverRemoteDaemonHealth};