/** * DeviceManager -- thin orchestrator that delegates to platform adapters. * * D9.1 split: was a 688-LOC file that mixed routing, default adapter * factory, kernel↔adapter bridging, and device resolution. Now a pure * facade composing helpers from src/device/: * - client-cache — default 5-platform adapter factory * - kernel-device-locator — KernelHandleView bridge * - device-resolver — listDevices aggregation + deviceId lookup * * D9.1b split: ~25 thin delegation methods (tap/swipe/launchApp/perms/ * logs/screenshot/...) extracted into capability proxies under * src/device/proxies/. * * D9.1c split: desktop lifecycle and device selection extracted into * - desktop-facade — launch/stop/cleanup/getClient/isRunning + browser accessor * - device-facade — listAll, setDevice, getActive, getTarget, target tracking * The orchestrator now only owns getAdapter() (with FIX #8 auto-detect), * legacy raw client accessors, and webview inspector caching. * * Public API of `DeviceManager` and re-exported types (`Platform`, * `BuiltinPlatform`, `Device`, `KernelHandleView`, …) is unchanged so * the ~125 existing import sites keep compiling. * * FIX #8: auto-detect device when no deviceId is selected -- see getAdapter(). */ import type { CorePlatformAdapter } from "./adapters/platform-adapter.js"; import { BrowserAdapter } from "./adapters/browser-adapter.js"; import { AdbClient } from "./adb/client.js"; import { IosClient } from "./ios/client.js"; import { DesktopClient } from "./desktop/client.js"; import type { AuroraClient } from "./aurora/index.js"; import type { CompressOptions } from "./utils/image.js"; import type { RawLaunchOptions } from "./desktop/types.js"; import { WebViewInspector } from "./adb/webview.js"; import type { Device, Platform } from "./platform-types.js"; import { type KernelHandleView } from "./device/kernel-device-locator.js"; export type { BuiltinPlatform, Platform, Device } from "./platform-types.js"; export { BUILTIN_PLATFORMS, isBuiltinPlatform, assertNever, } from "./platform-types.js"; export type { KernelHandleView } from "./device/kernel-device-locator.js"; export interface DeviceManagerConfig { adapters: Map; activeTarget?: Platform; } export declare class DeviceManager { private adapters; private webViewInspector?; private readonly inputProxy; private readonly appProxy; private readonly permissionProxy; private readonly logProxy; private readonly screenProxy; private readonly desktopFacade; private readonly deviceFacade; /** * Build a DeviceManager whose adapters come from the microkernel registry. * See `kernel-device-locator.ts` for the bridging logic. */ static fromKernel(handle: KernelHandleView, activeTarget?: Platform): DeviceManager; constructor(config?: DeviceManagerConfig); /** * Resolve a platform's CorePlatformAdapter. * * FIX #8: If the adapter has no selected device, attempt auto-detection. * When deviceId is provided, auto-detect is skipped and global state is * NOT mutated. */ getAdapter(platform?: Platform, deviceId?: string): CorePlatformAdapter; setTarget(target: Platform): void; getTarget(): { target: Platform; status: string; }; getAllDevicesWithErrors(): { devices: Device[]; errors: { platform: Platform; error: Error; }[]; }; getAllDevices(): Device[]; getDevices(platform?: Platform): Device[]; setDevice(deviceId: string, platform?: Platform): Device; getActiveDevice(): Device | undefined; getCurrentPlatform(): Platform; launchDesktopApp(options: RawLaunchOptions): Promise; stopDesktopApp(): Promise; cleanup(): Promise; getBrowserAdapter(): BrowserAdapter; getDesktopClient(): DesktopClient; isDesktopRunning(): boolean; screenshot(platform?: Platform, compress?: boolean, options?: CompressOptions & { monitorIndex?: number; }, deviceId?: string): Promise<{ data: string; mimeType: string; }>; getScreenshotBuffer(platform?: Platform, deviceId?: string): Promise; screenshotRaw(platform?: Platform): string; screenshotAsync(platform?: Platform, compress?: boolean, options?: CompressOptions & { monitorIndex?: number; }, deviceId?: string): Promise<{ data: string; mimeType: string; }>; getScreenshotBufferAsync(platform?: Platform, deviceId?: string): Promise; getUiHierarchy(platform?: Platform, deviceId?: string, turbo?: boolean): Promise; getUiHierarchyAsync(platform?: Platform, deviceId?: string, turbo?: boolean): Promise; tap(x: number, y: number, platform?: Platform, targetPid?: number, deviceId?: string): Promise; doubleTap(x: number, y: number, intervalMs?: number, platform?: Platform, deviceId?: string): Promise; longPress(x: number, y: number, durationMs?: number, platform?: Platform, deviceId?: string): Promise; swipe(x1: number, y1: number, x2: number, y2: number, durationMs?: number, platform?: Platform, deviceId?: string): Promise; swipeDirection(direction: "up" | "down" | "left" | "right", platform?: Platform, deviceId?: string): Promise; inputText(text: string, platform?: Platform, targetPid?: number, deviceId?: string): Promise; pressKey(key: string, platform?: Platform, targetPid?: number, deviceId?: string): Promise; launchApp(packageOrBundleId: string, platform?: Platform, deviceId?: string): Promise; stopApp(packageOrBundleId: string, platform?: Platform, deviceId?: string): void; installApp(path: string, platform?: Platform, deviceId?: string): string; grantPermission(packageOrBundleId: string, permission: string, platform?: Platform, deviceId?: string): string; revokePermission(packageOrBundleId: string, permission: string, platform?: Platform, deviceId?: string): string; resetPermissions(packageOrBundleId: string, platform?: Platform, deviceId?: string): string; shell(command: string, platform?: Platform, deviceId?: string): string; getLogs(options?: { platform?: Platform; level?: string; tag?: string; lines?: number; package?: string; deviceId?: string; }): string; clearLogs(platform?: Platform, deviceId?: string): string; getSystemInfo(platform?: Platform, deviceId?: string): Promise; /** @deprecated Use `getAdapter("android", deviceId)` + capability type guards from `adapters/platform-adapter.ts`. */ getAndroidClient(deviceId?: string): AdbClient; /** @deprecated Use `getAdapter("ios", deviceId)` + capability type guards. */ getIosClient(deviceId?: string): IosClient; /** @deprecated Use `getAdapter("aurora")` + capability type guards. */ getAuroraClient(): AuroraClient; getWebViewInspector(): WebViewInspector; } /** Factory for full DeviceManager with all 5 adapters (backward compat). */ export declare function createFullDeviceManager(): DeviceManager; //# sourceMappingURL=device-manager.d.ts.map