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 • 1.97 kB
import{v as e}from"./sdk-contracts.js";import{a as t,s as n}from"./sdk-remote-config.js";import{m as r}from"./runtime13.js";const i=[{field:`providerDeviceOrientation`,capability:`deviceOrientation`,type:`enum`,enumValues:t},{field:`providerGeoLocation`,capability:`geoLocation`,type:`string`},{field:`providerTimezone`,capability:`timezone`,type:`string`},{field:`providerAppiumVersion`,capability:`appiumVersion`,type:`string`},{field:`providerLanguage`,capability:`language`,type:`string`},{field:`providerLocale`,capability:`locale`,type:`string`},{field:`providerNetworkProfile`,capability:`networkProfile`,type:`string`},{field:`providerCustomNetwork`,capability:`customNetwork`,type:`string`},{field:`providerNoResignApp`,capability:`resignApp`,type:`negated-boolean`,platform:`ios`}].map(e=>({...e,flag:n[e.field]}));function a(e,t){l(e);let n={};for(let r of i){let i=e[r.field];i!==void 0&&i!==!1&&i!==``&&(c(r,t),n[r.capability]=r.type!==`negated-boolean`&&i)}return n}function o(e){let t={};for(let n of i){let r=e?.[n.field];if(n.type===`negated-boolean`){r===!0&&(t.providerNoResignApp=!0);continue}typeof r==`string`&&r.length!==0&&s(t,n,r)}return t}function s(e,t,n){if(t.field===`providerDeviceOrientation`){e.providerDeviceOrientation=r(t,n);return}t.field!==`providerNoResignApp`&&(e[t.field]=n)}function c(t,n){if(!(!t.platform||t.platform===n))throw new e(`INVALID_ARGS`,`${t.flag} applies to ${t.platform} sessions only, but the session platform is ${n}.`,{hint:`Drop ${t.flag} or connect with --platform ${t.platform}.`,flag:t.flag,capability:t.capability,platform:n})}function l(t){if(!(!t.providerNetworkProfile||!t.providerCustomNetwork))throw new e(`INVALID_ARGS`,`BrowserStack accepts either a named network profile or a custom network shape, not both.`,{hint:`Pass only one of --provider-network-profile or --provider-custom-network.`,networkProfile:t.providerNetworkProfile,customNetwork:t.providerCustomNetwork})}export{o as n,a as t};