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.29 kB
JavaScript
import{v as e}from"./sdk-contracts.js";const t=1e4,n=.65;function r(e,t){return{...e,releaseBehavior:t===void 0?`controlled`:`inertial`}}function i(t,n=`scroll accepts either a relative amount or --pixels, not both`){if(t.amount!==void 0&&t.pixels!==void 0)throw new e(`INVALID_ARGS`,n)}function a(t){if(t.maxPasses!==void 0){if(t.until===void 0)throw new e(`INVALID_ARGS`,`scroll maxPasses requires until`,{reason:`scroll_max_passes_requires_until`});if(!Number.isInteger(t.maxPasses)||t.maxPasses<1||t.maxPasses>200)throw new e(`INVALID_ARGS`,`scroll maxPasses must be an integer from 1 to 200`,{reason:`scroll_max_passes_invalid`})}if(t.until!==void 0&&t.edge!==void 0)throw new e(`INVALID_ARGS`,`scroll ${t.edge} already scrolls to the ${t.edge} edge and cannot take --until`,{hint:`Use scroll ${t.edge===`bottom`?`down`:`up`} --until <selector> to stop at the target, or scroll ${t.edge} to reach the edge.`})}function o(t,n={}){if(t===void 0)return;let r=n.field??`scroll durationMs`,i=n.max??1e4,a=n.invalidMessage??`${r} must be a non-negative integer`;if(!Number.isFinite(t)||!Number.isInteger(t)||t<0)throw new e(`INVALID_ARGS`,a);if(t>i)throw new e(`INVALID_ARGS`,`${r} must be a non-negative integer at most ${i}`);return t}export{o as a,a as i,t as n,r as o,i as r,n as t};