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.
117 lines • 5.32 kB
TypeScript
import { S as DeviceInfo } from "./sdk-contracts.js";
import { r as CloudArtifactsResult } from "./cloud-artifacts.js";
import { r as CloudProviderProfileFields } from "./sdk-remote-config.js";
import { c as LeaseLifecycleContext, n as ProviderDeviceInstallResult, s as DeviceLease, t as ProviderDeviceInstallOptions } from "./provider-device-runtime.js";
//#region packages/contracts/src/provider-profile-fields.d.ts
type ProviderProfileField = keyof CloudProviderProfileFields;
/**
* What one lease provider does with every Cloud provider profile field. The record is total, so a
* field added to the profile fails to build until each provider says whether it consumes it; a
* field a provider neither reads nor refuses would otherwise ride the profile and be dropped.
*/
type ProviderProfileFieldDeclaration = Readonly<{
provider: string;
label: string;
fields: Readonly<Record<ProviderProfileField, 'consumed' | 'refused'>>;
}>;
//#endregion
//#region packages/provider-webdriver/src/capabilities.d.ts
type CloudWebDriverOperation = 'lease' | 'inventory' | 'install' | 'snapshot' | 'screenshot' | 'tap' | 'doubleTap' | 'longPress' | 'swipe' | 'scroll' | 'fill' | 'type' | 'keyboard' | 'back' | 'home' | 'orientation' | 'appSwitcher' | 'tvRemote' | 'volumeUp' | 'volumeDown' | 'power' | 'mute' | 'sleep' | 'wake' | 'mediaPlayPause' | 'mediaNext' | 'mediaPrevious' | 'mediaRewind' | 'mediaFastForward' | 'clipboard.read' | 'clipboard.write' | 'settings' | 'alert' | 'pinch' | 'rotateGesture' | 'transformGesture' | 'tapGesture' | 'logs' | 'record' | 'artifacts' | 'portReverse' | 'nativeSnapshotBackend';
type CloudWebDriverSupportLevel = 'supported' | 'partial' | 'unsupported';
type CloudWebDriverOperationCapability = {
support: CloudWebDriverSupportLevel;
note?: string;
};
type CloudWebDriverCapabilityOverrides = Partial<Record<CloudWebDriverOperation, CloudWebDriverSupportLevel | CloudWebDriverOperationCapability>>;
//#endregion
//#region packages/provider-webdriver/src/webdriver-transport.d.ts
type WebDriverAuth = {
username: string;
accessKey: string;
};
type WebDriverRequestPolicy = {
timeoutMs?: number;
retryAttempts?: number;
retryDelayMs?: number;
/**
* Budget for creating the session, consumed by `WebDriverClient.createSession`
* rather than the transport: a cloud provider allocates a physical device
* inside that one request, so it cannot share `timeoutMs`, which is sized for
* a settled session's round trips.
*/
sessionCreateTimeoutMs?: number;
};
//#endregion
//#region packages/provider-webdriver/src/runtime.d.ts
type CloudWebDriverPlatform = 'android' | 'ios';
type CloudWebDriverUploadResult = ProviderDeviceInstallResult & {
appReference: string;
};
type CloudWebDriverUploadApp = (params: {
provider: string;
lease: DeviceLease;
device: DeviceInfo;
app: string;
appPath: string;
options?: ProviderDeviceInstallOptions;
signal?: AbortSignal;
}) => Promise<CloudWebDriverUploadResult>;
type CloudWebDriverBaseSession = {
provider: string;
endpoint: string | URL;
platform: CloudWebDriverPlatform;
deviceName: string;
webdriverCapabilities: Record<string, unknown>;
auth?: WebDriverAuth;
headers?: Record<string, string>;
};
type CloudWebDriverPreparedSession = CloudWebDriverBaseSession & {
deviceId?: string;
providerSessionId?: string;
uploadApp?: CloudWebDriverUploadApp;
listArtifacts?: CloudWebDriverListArtifacts;
cleanup?: () => Promise<Record<string, unknown> | undefined>;
providerData?: Record<string, unknown>;
};
type CloudWebDriverListArtifacts = (params: {
provider: string;
lease?: DeviceLease;
device?: DeviceInfo;
webDriverSessionId?: string;
providerSessionId?: string;
}) => Promise<CloudArtifactsResult | undefined>;
type CloudWebDriverPrepareSession = (params: {
lease: DeviceLease;
req?: LeaseLifecycleContext;
base: CloudWebDriverBaseSession;
}) => Promise<CloudWebDriverPreparedSession>;
type CloudWebDriverRuntimeOptions = {
clientVersion: string;
provider: string;
endpoint: string | URL;
platform: CloudWebDriverPlatform;
deviceName: string;
webdriverCapabilities?: Record<string, unknown> | ((lease: DeviceLease) => Record<string, unknown>);
auth?: WebDriverAuth;
headers?: Record<string, string>;
requestPolicy?: WebDriverRequestPolicy;
uploadApp?: CloudWebDriverUploadApp;
listArtifacts?: CloudWebDriverListArtifacts;
deviceId?: (lease: DeviceLease) => string;
prepareSession?: CloudWebDriverPrepareSession;
capabilityOverrides?: CloudWebDriverCapabilityOverrides;
/** Profile fields this provider reads; any field it refuses fails lease allocation. */
profileFields: ProviderProfileFieldDeclaration;
/**
* Budget for a prepared session's `cleanup` on disposal and on a failed create, and for `listArtifacts`
* during teardown. Defaults to 30,000 ms. This budget does not bound `prepareSession`; release and
* shutdown still wait for preparation to finish.
*/
providerCallbackTimeoutMs?: number;
};
//#endregion
//#region packages/provider-webdriver/src/provider-plugin.d.ts
/** The engine options a provider contributes; the host supplies `clientVersion`. */
type CloudWebDriverProviderOptions = Omit<CloudWebDriverRuntimeOptions, 'clientVersion'>;
//#endregion
export { CloudWebDriverProviderOptions as t };