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.
2 lines • 1.36 kB
JavaScript
import{v as e}from"./sdk-contracts.js";import{printJson as t}from"./json.js";function n(e){return Object.freeze({setup:async t=>{let{setupManagedAgentBrowser:n}=await import(`./src14.js`).then(e=>e.i);return await n({...t,host:e})},doctor:async t=>{let{doctorManagedAgentBrowser:n}=await import(`./src14.js`).then(e=>e.i);return await n({...t,host:e})}})}const r=e=>n(e);async function i(t,n){let i=r(n.host);switch(t[0]){case`setup`:{a(n.flags.json);let e=await i.setup({stateDir:n.stateDir});return o(n.flags.json,e),0}case`doctor`:{let e=await i.doctor({stateDir:n.stateDir});return s(n.flags.json,e.exitCode===0?`Web backend is healthy.`:`Web backend doctor reported issues.`,e),e.exitCode}default:throw new e(`INVALID_ARGS`,`web requires setup or doctor`)}}function a(e){e||process.stdout.write(`Setting up managed agent-browser backend (downloads if needed)...
`)}function o(e,n){if(e){t({success:!0,data:{status:c(n)}});return}process.stdout.write(`Managed web backend installed.\nagent-browser available at: ${n.binaryPath}\n`)}function s(e,n,r){if(e){t({success:!0,data:l(r)});return}process.stdout.write(`${n}\n`)}function c(e){let{socketDir:t,...n}=e;return n}function l(e){let t=e.status;return u(t)?{...e,status:c(t)}:e}function u(e){return typeof e==`object`&&!!e&&`socketDir`in e&&`installDir`in e&&`binaryPath`in e}export{i as runWebCommand};