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.
83 lines • 5.67 kB
TypeScript
import { S as DeviceInfo } from "./sdk-contracts.js";
import { t as AppsFilter } from "./app-inventory.js";
import { t as AppStateRuntimeResult } from "./app-state-runtime.js";
import { a as readAndroidClipboardWithAdb, c as AndroidAdbExecutor, d as AndroidAdbProvider, f as AndroidPortReverseEndpoint, i as getAndroidKeyboardStatusWithAdb, l as AndroidAdbExecutorOptions, n as AndroidKeyboardState, o as writeAndroidClipboardWithAdb, p as AndroidPortReverseProvider, r as dismissAndroidKeyboardWithAdb, t as AndroidKeyboardDismissResult, u as AndroidAdbExecutorResult } from "./device-input-state.js";
//#region packages/platform-android/src/adb-port-reverse.d.ts
type AndroidExecPortReverseOptions = Readonly<{
/**
* Refuses to replace any existing device mapping, including one this provider created
* (`adb reverse --no-rebind`), for a device that other adb clients also drive. When
* `adb reverse --list` shows the endpoint after a refusal, the provider throws `COMMAND_FAILED`
* with `details.reason: 'android_port_reverse_rebind_refused'`; otherwise it throws the adb
* failure.
*/
noRebind?: boolean;
}>;
declare function createAndroidPortReverseManager(provider: AndroidAdbProvider | AndroidAdbExecutor): AndroidPortReverseProvider;
/** Options reach only the exec-backed provider the manager builds over a bare executor. */
declare function createAndroidPortReverseManager(adb: AndroidAdbExecutor, options: AndroidExecPortReverseOptions): AndroidPortReverseProvider;
//#endregion
//#region packages/kernel/src/device-shell.d.ts
declare const shellFragmentBrand: unique symbol;
/**
* A shell-script fragment the author wrote and quoted themselves (a pipeline, redirection, or
* `&` background job). The device shell parses it verbatim, so every interpolated value inside
* it must go through `shellQuote`.
*/
type ShellFragment = Readonly<{
readonly [shellFragmentBrand]: true;
script: string;
}>;
/** One element of a device-shell command: a value (quoted for the device shell) or a fragment. */
type ShellWord = string | number | ShellFragment;
//#endregion
//#region packages/platform-android/src/adb-provider-scope.d.ts
/** Runs `adb shell <words>` through an executor; every word is quoted for the device shell. */
declare function runAdbShell(adb: AndroidAdbExecutor, words: readonly ShellWord[], options?: AndroidAdbExecutorOptions): Promise<AndroidAdbExecutorResult>;
/** Runs `adb exec-out <words>` (raw stdout) through an executor. */
declare function runAdbExecOut(adb: AndroidAdbExecutor, words: readonly ShellWord[], options?: AndroidAdbExecutorOptions): Promise<AndroidAdbExecutorResult>;
//#endregion
//#region packages/platform-android/src/app-helpers.d.ts
type AndroidAppListFilter = AppsFilter;
type AndroidAppListTarget = 'mobile' | 'tv' | 'auto';
type AndroidAppListOptions = {
filter?: AndroidAppListFilter;
target?: AndroidAppListTarget;
};
declare function listAndroidAppsWithAdb$1(adb: AndroidAdbExecutor, options?: AndroidAppListOptions): Promise<Array<{
package: string;
name: string;
}>>;
//#endregion
//#region packages/platform-android/src/logcat.d.ts
type AndroidLogcatCaptureOptions = {
lines?: number;
timeoutMs?: number;
signal?: AbortSignal;
};
declare function captureAndroidLogcatWithAdb$1(adb: AndroidAdbExecutor, options?: AndroidLogcatCaptureOptions): Promise<string>;
//#endregion
//#region packages/platform-android/src/adb.d.ts
/** Runs `adb shell <words>` for the device; every word is quoted for the device shell. */
declare function runAndroidShell$1(device: DeviceInfo, words: readonly ShellWord[], options?: AndroidAdbExecutorOptions): Promise<AndroidAdbExecutorResult>;
/** Runs `adb exec-out <words>` (raw stdout) for the device. */
declare function runAndroidExecOut$1(device: DeviceInfo, words: readonly ShellWord[], options?: AndroidAdbExecutorOptions): Promise<AndroidAdbExecutorResult>;
//#endregion
//#region packages/platform-android/src/app-control.d.ts
type AndroidOpenAppWithAdbOptions = {
activity?: string;
category?: string;
};
declare function forceStopAndroidAppWithAdb(adb: AndroidAdbExecutor, packageName: string): Promise<void>;
declare function openAndroidAppWithAdb(adb: AndroidAdbExecutor, packageName: string, options?: AndroidOpenAppWithAdbOptions): Promise<void>;
//#endregion
//#region packages/platform-android/src/mechanics.d.ts
declare function listAndroidAppsWithAdb(...args: Parameters<typeof listAndroidAppsWithAdb$1>): Promise<Awaited<ReturnType<typeof listAndroidAppsWithAdb$1>>>;
declare function captureAndroidLogcatWithAdb(...args: Parameters<typeof captureAndroidLogcatWithAdb$1>): Promise<Awaited<ReturnType<typeof captureAndroidLogcatWithAdb$1>>>;
//#endregion
//#region src/sdk/android-adb.d.ts
declare function runAndroidShell(...args: Parameters<typeof runAndroidShell$1>): Promise<AndroidAdbExecutorResult>;
declare function runAndroidExecOut(...args: Parameters<typeof runAndroidExecOut$1>): Promise<AndroidAdbExecutorResult>;
declare function getAndroidAppStateWithAdb(adb: AndroidAdbExecutor, signal?: AbortSignal): Promise<AppStateRuntimeResult>;
//#endregion
export { type AndroidAdbExecutor, type AndroidAdbExecutorOptions, type AndroidAdbProvider, type AndroidKeyboardDismissResult, type AndroidKeyboardState, type AndroidPortReverseEndpoint, type ShellWord, captureAndroidLogcatWithAdb, createAndroidPortReverseManager, dismissAndroidKeyboardWithAdb, forceStopAndroidAppWithAdb, getAndroidAppStateWithAdb, getAndroidKeyboardStatusWithAdb, listAndroidAppsWithAdb, openAndroidAppWithAdb, readAndroidClipboardWithAdb, runAdbExecOut, runAdbShell, runAndroidExecOut, runAndroidShell, writeAndroidClipboardWithAdb };