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 • 4.61 kB
JavaScript
import{An as e,jn as t,wn as n}from"./sdk-batch.js";import{v as r}from"./sdk-contracts.js";import{l as i}from"./tv-remote.js";import{n as a,t as o}from"./application-lifecycle-runtime.js";import{r as s}from"./gesture-admission.js";import{C as c,R as l,_ as u,r as d}from"./tv-remote-runtime.js";import{r as f}from"./application-lifecycle-interaction.js";import{t as p}from"./interactor-operation-catalog.js";import{r as m}from"./platform-runtime-unavailable.js";const h=n(`vega`),g=Object.freeze({available:!0}),_=t(`unsupported-platform-leaf`),v=t(`unsupported-platform-leaf`,`Runtime hints are supported only for local iOS-family simulators and Android devices.`),y=t(`unsupported-platform-leaf`,`Apple runner preparation is supported only for Apple targets.`),b=t(`unsupported-provider-mode`,`Port reverse is supported only by an owning provider runtime.`),x=t(`unsupported-device-kind`,`open currently supports only Vega Virtual Devices.`),S=t(`unsupported-device-kind`,`close currently supports only Vega Virtual Devices.`);function C(t){return Object.freeze({owner:h,ownsDevice:e=>e.platform===`vega`,inspectFacts:async e=>W(e),bind:async n=>{if(n.intent.kind===`exact-owner`&&!e(n.intent.owner,h))throw new r(`UNSUPPORTED_OPERATION`,`Vega runtime owner identity does not match`);if(n.device.platform!==`vega`)throw new r(`UNSUPPORTED_PLATFORM`,`Vega runtime cannot bind this device`);let i=W(n.device),o=f({owner:`Vega`,openTargetIdentity:`app-name`,host:t.localInteractors,device:n.device,signal:n.scope.signal});return Object.freeze({device:n.device,owner:h,facts:i,operations:Object.freeze({...a(o,i.operations),...p({device:n.device,signal:n.scope.signal,resolveInteractor:t.localInteractors.resolve,facts:i.operations})}),[Symbol.asyncDispose]:async()=>void 0})},shutdown:async()=>void 0})}const w=t(`unsupported-platform-leaf`,`screenshot is not supported on Vega OS: the Vega runtime exposes remote navigation only.`),T=t(`unsupported-platform-leaf`,`focus is not supported on Vega OS: the Vega runtime exposes remote navigation only.`),E=t(`unsupported-platform-leaf`,`type is not supported on Vega OS: the Vega runtime exposes remote navigation only.`),D=t(`unsupported-platform-leaf`,`Gestures are not supported on Vega OS: the Vega runtime exposes remote navigation only.`),O=t(`unsupported-platform-leaf`,`scroll is not supported on Vega OS: the Vega runtime exposes remote navigation only.`),k=t(`unsupported-platform-leaf`),A=t(`unsupported-platform-leaf`,s),j=t(`unsupported-platform-leaf`,`orientation is not supported on Vega OS.`),M=t(`unsupported-platform-leaf`,`keyboard is not supported on Vega OS.`),N=t(`unsupported-platform-leaf`,`alert is not supported on Vega OS.`),P=t(`unsupported-platform-leaf`,`settings is not supported on Vega OS.`),F=t(`unsupported-platform-leaf`,`trigger-app-event is not supported on Vega OS.`),I=t(`unsupported-platform-leaf`,`System buttons other than home are not supported on Vega OS.`),L=t(`unsupported-platform-leaf`,`fold is not supported on Vega OS.`),R=t(`unsupported-platform-leaf`,`telephony is not supported on Vega OS.`),z=t(`unsupported-platform-leaf`,`clipboard is not supported on Vega OS.`),B=t(`unsupported-device-kind`,`back currently supports only Vega Virtual Devices.`),V=t(`unsupported-device-kind`,`home currently supports only Vega Virtual Devices.`),H=t(`unsupported-device-kind`,`tv-remote currently supports only Vega Virtual Devices.`),U=t(`unsupported-platform-leaf`,`audio is supported for web browser sessions, macOS sessions, iOS simulators, and Android emulators on macOS hosts`);function W(e){let t=e.kind===`emulator`&&e.target===`tv`,n=t?g:x,r=t?g:S,a=m(e,h,{appLog:_,network:_,screenshot:w,snapshot:_,viewport:_,focus:T,gesture:D,scroll:O,typeText:E,touch:_,elementText:_,back:B,orientation:j,tvRemote:H,clipboard:z,systemButton:I,fold:L,telephony:R,triggerAppEvent:F,settings:P,readAlert:N,awaitAlert:N,acceptAlert:N,dismissAlert:N,keyboard:M,audioProbeCapture:U,audioProbeQuery:U,perf:_,readiness:_,lifecycle:o({resolveOpenTarget:n,prepareApplicationOpen:n,openApplication:n,applyRuntimeHints:v,clearRuntimeHints:v,closeApplication:r,finalizeApplicationClose:r,prepareAppleRunner:y,configureProviderPortReverse:b})});return Object.freeze({device:a.device,operations:{...a.operations,...c({back:t?g:B}),...u({unsupported:I,home:t?g:V}),...d({tvRemote:t?g:H,buttonSupport:{supported:i(`vega`),unsupported:{available:!1,reason:`unsupported-platform-leaf`,hint:`This TV remote button is not supported on Vega OS.`}}}),...l({unsupported:D,multiTouch:k,targetAuthoredDrag:A})}})}export{C as createVegaPlatformRuntime};