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.28 kB
const e={selectorNotFound:`selector_not_found`,predicateFailed:`predicate_failed`,refNotFound:`ref_not_found`,refUnlabeled:`ref_unlabeled`,targetBoundsInvalid:`target_bounds_invalid`,targetCovered:`target_covered`,targetNotHittable:`target_not_hittable`,targetDisabled:`target_disabled`,targetStillMoving:`target_still_moving`};function t(t,r={}){let i=t.coveredBy;return{reason:e.targetCovered,hint:n(i),...r.selector?{selector:r.selector}:{},ref:`@${t.ref}`,interactionBlocked:t.interactionBlocked,...i?{coveredBy:i}:{}}}function n(e){return e?e.persistentBar?`Covered by ${r(e)}. Use a different visible target, or inspect with snapshot/screenshot before retrying.`:`Covered by ${r(e)}. Dismiss or close that element, scroll the target clear of it, or inspect with snapshot/screenshot before retrying.`:`Use a different visible target, scroll it clear of the overlay, or inspect with snapshot/screenshot before retrying.`}function r(e){let t=i(e),n=e.rect;return n?`the ${t} at ${a(n)}`:`the ${t}`}function i(e){let t=e.label?e.label.replaceAll(/[\r\n]+/g,` `).replaceAll(/\s+/g,` `).replaceAll(`"`,``).trim():``;return t?`${e.kind} "${t}"`:e.kind}function a(e){return`(${Math.round(e.x)}, ${Math.round(e.y)} ${Math.round(e.width)}x${Math.round(e.height)})`}export{t as n,e as t};