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.

93 lines • 4.33 kB
import { F as Rect, M as Point } from "./sdk-contracts.js"; //#region packages/contracts/src/gesture-plan-types.d.ts type GesturePointerCount = 1 | 2; /** Selects one-pointer release timing without changing semantic gesture intent. */ type GestureExecutionProfile = 'endpoint-hold' | 'timed-pan'; type PointerTrajectorySample = { offsetMs: number; point: Point; }; type TapPointerId = 0 | 1 | 2 | 3 | 4; type PointerTrajectory<PointerId extends number = 0 | 1> = { pointerId: PointerId; samples: readonly PointerTrajectorySample[]; }; type SinglePointerTrajectory = { pointerId: 0; samples: readonly [PointerTrajectorySample, PointerTrajectorySample, ...PointerTrajectorySample[]]; }; /** * Where a contact starts. `screen-edge` asks the platform to deliver the contact as a screen-edge * touch, which edge gesture recognizers require. */ type GestureContactOrigin = 'screen-edge'; type SinglePointerGesturePlan = { topology: 'single'; intent: 'fling' | 'pan'; executionProfile: GestureExecutionProfile; contactOrigin?: GestureContactOrigin; durationMs: number; viewport: Rect; pointers: readonly [SinglePointerTrajectory]; }; type TwoContactGesturePlan = { topology: 'multi'; intent: 'pan' | 'pinch' | 'rotate' | 'transform'; durationMs: number; viewport: Rect; pointers: readonly [PointerTrajectory, PointerTrajectory]; }; /** Stationary contacts that touch down together and lift together after `durationMs`. */ type TapGesturePlan = { topology: 'multi'; intent: 'tap'; durationMs: number; viewport: Rect; pointers: readonly [PointerTrajectory<TapPointerId>, PointerTrajectory<TapPointerId>, ...PointerTrajectory<TapPointerId>[]]; }; type MultiTouchGesturePlan = TwoContactGesturePlan | TapGesturePlan; type GesturePlan = SinglePointerGesturePlan | MultiTouchGesturePlan; //#endregion //#region packages/contracts/src/keyboard.d.ts /** A platform reports `unknown` when it cannot identify the action and `none` when it establishes there is no action. */ declare const KEYBOARD_RETURN_KEYS: readonly ['go', 'search', 'send', 'next', 'done', 'previous', 'join', 'route', 'continue', 'enter', 'none', 'unknown']; type KeyboardReturnKey = (typeof KEYBOARD_RETURN_KEYS)[number]; /** * Closed result of the `keyboard` command, grounded in the runtime operation * results projected by `packages/daemon/src/execution/keyboard-runtime.ts`. * * `platform` and `action` are always present; the remaining fields appear per * branch (`status` carries the keyboard-state fields, and a visible one its return key; `enter` * and iOS `dismiss` carry a `message`). It is kept as a flat closed shape rather * than a five-way `platform`×`action` union because the per-branch field sets * overlap heavily and the underlying Android keyboard-state types live in the * platform layer (below the public contract). The `Record` index signature of * the previous hand-written mirror is dropped, and the spurious `| null`s are * removed (the handler never returns `null` for these). */ type KeyboardCommandResult = { platform: 'android' | 'ios'; action: 'status' | 'dismiss' | 'enter'; visible?: boolean; wasVisible?: boolean; dismissed?: boolean; attempts?: number; inputType?: string; type?: 'text' | 'number' | 'email' | 'phone' | 'password' | 'datetime' | 'unknown'; inputMethodPackage?: string; focusedPackage?: string; focusedResourceId?: string; inputOwner?: 'app' | 'ime' | 'unknown'; /** `status` on a visible keyboard: what its return key offers. Omitted when the keyboard is not * visible — a hidden keyboard has no return key to report. */ returnKey?: KeyboardReturnKey; /** `status` on a visible keyboard whose platform reads the key's own wording: the label the key * shows with its surrounding whitespace trimmed, which can be an app's custom or a localized * string. Both producers read it from a dump or the accessibility tree, and trim it there. */ returnKeyLabel?: string; message?: string; /** The dismiss mechanism when the serving runtime reports one. */ mechanism?: 'dismissKey'; }; //#endregion export { MultiTouchGesturePlan as a, SinglePointerGesturePlan as c, GesturePointerCount as i, KeyboardReturnKey as n, PointerTrajectory as o, GesturePlan as r, PointerTrajectorySample as s, KeyboardCommandResult as t };