import { B as SnapshotNode, E as PlatformSelector, F as Rect, M as Point, O as HostEnvironment, P as RawSnapshotNode, Q as AppErrorDetails, X as AppError, Y as centerOfRect, Z as AppErrorCode, at as normalizeAgentDeviceError, b as AppleOS, et as ErrorCause, it as isAgentDeviceError, nt as NormalizedError, tt as KnownAppErrorCode } from "./sdk-contracts.js";
import { t as BatchRunResult } from "./sdk-batch-runner.js";
import { x as SnapshotState } from "./sdk-selectors.js";
import { i as CloudProviderSessionResult, t as AgentArtifactsResult } from "./cloud-artifacts.js";
import { r as ReplaySuiteResult, t as ReplayCommandResult } from "./replay.js";
import { c as MetroPrepareOptions, d as MetroReloadResult, l as MetroPrepareResult, m as MetroBridgeScope, u as MetroReloadOptions } from "./sdk-remote-config.js";
import { t as AgentDevicePlugin } from "./contract.js";
import { t as AppsFilter } from "./app-inventory.js";
import { $ as RecordOptions, $t as CloudArtifactsOptions, A as AlertAction, An as DaemonBinding, At as PressOptions, B as IsStatePredicateOptions, Bt as ElementTarget, C as PrepareCommandOptions, Cn as isRecord, Ct as FocusOptions, D as ViewportCommandOptions, Dn as AgentDeviceIdentifiers, Dt as PanOptions, E as TvRemoteCommandOptions, En as AgentDeviceDaemonTransportContext, Et as LongPressOptions, F as SessionSaveScriptResult, Fn as EnsureDaemonOptions, Ft as SwipeGestureOptions, G as BatchStep, Gt as CaptureAuditOptions, H as RecordControlOptions, Ht as PointTarget, I as FindBaseOptions, It as SwipeOptions, J as AudioOptions, Jt as CaptureScreenshotResult, K as ReplayRunOptions, Kt as CaptureDiffOptions, L as FindOptions, Lt as TapGestureOptions, M as SettingsUpdateOptions, Mn as DaemonIdentity, Mt as RotateGestureOptions, N as SessionCloseResult, Nn as DaemonLifecycle, Nt as ScrollOptions, O as WaitCommandOptions, On as AgentDeviceRequestOverrides, Ot as PinchOptions, P as SessionSaveScriptOptions, Pn as DeviceCommandBaseOptions, Pt as SettleCommandOptions, Q as PerfOptions, Qt as SelectorSnapshotCommandOptions, R as GetOptions, Rt as TransformGestureOptions, S as OrientationCommandOptions, Sn as JsonValue, St as FlingOptions, T as TelephonyCommandOptions, Tn as AgentDeviceDaemonTransport, Tt as HoverOptions, U as CommandRequestResult, Ut as RefTarget, V as IsTextPredicateOptions, Vt as InteractionTarget, W as BatchRunOptions, Wt as SelectorTarget, X as LogsOptions, Xt as CaptureSnapshotResult, Y as EventsOptions, Yt as CaptureSnapshotOptions, Z as NetworkOptions, Zt as FindSnapshotCommandOptions, _ as DoctorCommandOptions, _n as TargetShutdownResult, _t as MaterializationReleaseOptions, a as WaitCommandResult, an as LeaseAllocateOptions, at as AppInstallFromSourceOptions, b as HomeCommandOptions, bn as JsonObject, bt as DragOptions, c as DoctorCommandResult, cn as LeaseOptions, ct as AppListOptions, d as ActionButtonCommandOptions, dn as AgentDeviceDevice, dt as AppPushOptions, en as EndedLease, et as TraceOptions, f as AlertCommandOptions, fn as AgentDeviceSession, ft as AppTriggerEventOptions, g as ClipboardCommandOptions, gn as StartupPerfSample, gt as DeviceSelectionSource, h as BackCommandOptions, hn as DeviceShutdownOptions, ht as DeviceSelectionReason, i as TraceCommandResult, in as Lease, it as AppDeployResult, j as PermissionTarget, jn as DaemonConnection, jt as RepeatedPressOptions, k as WaitCommandTarget, kn as AgentDeviceSelectionOptions, kt as PostGestureStabilizationOptions, l as DebugSymbolsOptions, ln as LeaseScopedOptions, lt as AppOpenOptions, m as AppSwitcherCommandOptions, mn as DeviceBootOptions, mt as DeviceSelectionMetadata, n as AgentDeviceCommandClient, nn as HumanControlHoldOptions, nt as AppCloseResult, o as TriggerAppEventCommandResult, on as LeaseDevice, ot as AppInstallFromSourceResult, p as AppStateCommandOptions, pn as AgentDeviceSessionDevice, pt as AppUninstallOptions, q as ReplayTestOptions, qt as CaptureScreenshotOptions, r as RecordingCommandResult, rn as HumanControlHoldScope, rt as AppDeployOptions, s as DiffSnapshotCommandResult, sn as LeaseDeviceSpec, st as AppInstallOptions, t as AgentDeviceClient, tn as HumanControlHold, tt as AppCloseOptions, u as DebugSymbolsResult, un as AgentDeviceCapabilitiesResult, ut as AppOpenResult, v as FoldCommandOptions, vn as PushCommandResult, vt as MaterializationReleaseResult, w as ReactNativeCommandOptions, wn as AgentDeviceClientConfig, wt as GestureOptions, x as KeyboardCommandOptions, xn as JsonPrimitive, xt as FillOptions, y as HardwareButtonCommandOptions, yn as PrepareCommandResult, yt as ClickOptions, z as IsOptions, zt as TypeTextOptions } from "./client-port.js";
import { t as createLocalArtifactAdapter } from "./local-artifact-adapter.js";
//#region packages/contracts/src/device-pin.d.ts
type DevicePinSelector = {
  platform?: PlatformSelector;
  device?: string;
  udid?: string;
  serial?: string;
};
type DevicePin = {
  selector: DevicePinSelector;
  source: {
    kind: 'user' | 'project' | 'explicit';
    path: string;
  };
};
//#endregion
//#region packages/contracts/src/android-snapshot-quality.d.ts
/**
 * True when a thrown Android capture failure is a content verdict rather than a
 * mechanism failure. Wait and replay polling may ride out these states; helper
 * timeouts, adb failures, and missing artifacts remain fail-fast.
 */
declare function isUnreadableCaptureContentError(error: unknown): boolean;
//#endregion
//#region packages/contracts/src/plugin-inventory.d.ts
type PluginSource = 'builtin' | 'store' | 'embedder';
type PluginInventoryError = Readonly<{
  code: string;
  message: string;
  reason?: string;
  hint?: string;
}>;
/** One step of a plugin's cleanup: it completed, or it threw this typed error. */
type PluginCleanupStep = Readonly<{
  status: 'ok';
}> | Readonly<{
  status: 'failed';
  error: PluginInventoryError;
}>;
/**
 * What closing the registry did for one registered plugin. A plugin without `dispose` has nothing to
 * dispose, which reads as `ok`.
 */
type PluginCleanupOutcome = Readonly<{
  provider: string;
  source: PluginSource;
  shutdown: PluginCleanupStep;
  dispose: PluginCleanupStep;
}>;
//#endregion
//#region packages/daemon/src/server/http/server-shutdown.d.ts
/** What a closed daemon runtime leaves behind, by kind of resource. */
type ShutdownReport = {
  /** Provider lease releases, by lease id. `unknown` was still in flight when the budget ran out. */
  providerReleases: {
    completed: string[];
    pending: string[];
    unknown: string[];
  };
  /** Device runners, by device id: `handedOff` was left running for the next daemon. */
  runners: {
    stopped: string[];
    handedOff: string[];
  };
  /**
   * Requests in flight at close. `abandoned` ones ignored cancellation past the drain budget and may
   * still be running, so the registration stays held while this process lives.
   */
  requests: {
    drained: number;
    abandoned: number;
  };
  sessions: {
    closed: number;
    failed: number;
  };
  /** `pending` exceeded the shutdown budget; `failed` settled with an owner error. Both retain registration. */
  platformOwners: 'closed' | 'pending' | 'failed';
  /** `pending` plugins were still shutting down when the budget ran out. */
  plugins: {
    disposed: string[];
    failed: {
      provider: string;
      source?: PluginCleanupOutcome['source'];
      step: 'shutdown' | 'dispose';
      error: NormalizedError;
    }[];
    pending: string[];
  };
};
//#endregion
//#region src/sdk/host-types.d.ts
type StartAgentDeviceOptions = Readonly<{
  /** Required state directory to own, resolved against the host working directory. */
  stateDir: string;
  /** The environment and working directory to run with. Defaults to one captured copy of this process's. */
  host?: HostEnvironment;
  /** Imported plugins to register after the built-ins. The plugin store is not read. */
  plugins?: readonly AgentDevicePlugin[];
}>;
type AgentDeviceHost = Readonly<{
  /** A client pinned to this instance. */
  client: AgentDeviceClient;
  /** Serializable attach config containing this instance's bearer token. Keep it inside the host. */
  clientConfig: AgentDeviceClientConfig;
  /**
   * Reports teardown outcomes. `platformOwners` is `closed`, `pending` when the shutdown budget
   * expires, or `failed` when an owner rejects. Pending or failed owners retain the daemon
   * registration until this process exits. Repeated calls share one close; never exits the process.
   */
  close: () => Promise<ShutdownReport>;
}>;
//#endregion
//#region packages/client/src/index.d.ts
declare function createAgentDeviceClient(config?: AgentDeviceClientConfig, deps?: {
  transport?: AgentDeviceDaemonTransport;
  host?: HostEnvironment;
  /** The operator-configured device selector enforced on every request. */
  devicePin?: DevicePin;
}): AgentDeviceClient;
//#endregion
//#region src/sdk/ensure-daemon.d.ts
/**
 * Starts the local daemon on a state directory if none is usable, and replaces an incompatible one
 * only when it holds no request, session, repair session or live lease. See `DaemonLifecycle`.
 *
 * Loaded on first call: a client that only attaches never pays for the startup and replacement
 * machinery.
 */
declare function ensureDaemon(options?: EnsureDaemonOptions): Promise<DaemonConnection>;
//#endregion
//#region src/sdk/index.d.ts
/** Starts an in-process daemon, loading its runtime only when called. */
declare function startAgentDevice(options: StartAgentDeviceOptions): Promise<AgentDeviceHost>;
//#endregion
export { type ActionButtonCommandOptions, type AgentArtifactsResult, type AgentDeviceCapabilitiesResult, type AgentDeviceClient, type AgentDeviceClientConfig, type AgentDeviceCommandClient, type AgentDeviceDaemonTransport, type AgentDeviceDaemonTransportContext, type AgentDeviceDevice, type AgentDeviceHost, type AgentDeviceIdentifiers, type AgentDeviceRequestOverrides, type AgentDeviceSelectionOptions, type AgentDeviceSession, type AgentDeviceSessionDevice, type AlertAction, type AlertCommandOptions, type AppCloseOptions, type AppCloseResult, type AppDeployOptions, type AppDeployResult, AppError, type AppErrorCode, type AppErrorDetails, type AppInstallFromSourceOptions, type AppInstallFromSourceResult, type AppInstallOptions, type AppListOptions, type AppOpenOptions, type AppOpenResult, type AppPushOptions, type AppStateCommandOptions, type AppSwitcherCommandOptions, type AppTriggerEventOptions, type AppUninstallOptions, type AppleOS, type AppsFilter, type AudioOptions, type BackCommandOptions, type BatchRunOptions, type BatchRunResult, type BatchStep, type CaptureAuditOptions, type CaptureDiffOptions, type CaptureScreenshotOptions, type CaptureScreenshotResult, type CaptureSnapshotOptions, type CaptureSnapshotResult, type ClickOptions, type ClipboardCommandOptions, type CloudArtifactsOptions, type CloudProviderSessionResult, type CommandRequestResult, type DaemonBinding, type DaemonConnection, type DaemonIdentity, type DaemonLifecycle, type DebugSymbolsOptions, type DebugSymbolsResult, type DeviceBootOptions, type DeviceCommandBaseOptions, type DeviceSelectionMetadata, type DeviceSelectionReason, type DeviceSelectionSource, type DeviceShutdownOptions, type DiffSnapshotCommandResult, type DoctorCommandOptions, type DoctorCommandResult, type DragOptions, type ElementTarget, type EndedLease, type EnsureDaemonOptions, type ErrorCause, type EventsOptions, type FillOptions, type FindBaseOptions, type FindOptions, type FindSnapshotCommandOptions, type FlingOptions, type FocusOptions, type FoldCommandOptions, type GestureOptions, type GetOptions, type HardwareButtonCommandOptions, type HomeCommandOptions, type HoverOptions, type HumanControlHold, type HumanControlHoldOptions, type HumanControlHoldScope, type InteractionTarget, type IsOptions, type IsStatePredicateOptions, type IsTextPredicateOptions, type JsonObject, type JsonPrimitive, type JsonValue, type KeyboardCommandOptions, type KnownAppErrorCode, type Lease, type LeaseAllocateOptions, type LeaseDevice, type LeaseDeviceSpec, type LeaseOptions, type LeaseScopedOptions, type LogsOptions, type LongPressOptions, type MaterializationReleaseOptions, type MaterializationReleaseResult, type MetroBridgeScope, type MetroPrepareOptions, type MetroPrepareResult, type MetroReloadOptions, type MetroReloadResult, type NetworkOptions, type NormalizedError, type OrientationCommandOptions, type PanOptions, type PerfOptions, type PermissionTarget, type PinchOptions, type Point, type PointTarget, type PostGestureStabilizationOptions, type PrepareCommandOptions, type PrepareCommandResult, type PressOptions, type PushCommandResult, type RawSnapshotNode, type ReactNativeCommandOptions, type RecordControlOptions, type RecordOptions, type RecordingCommandResult, type Rect, type RefTarget, type RepeatedPressOptions, type ReplayCommandResult, type ReplayRunOptions, type ReplaySuiteResult, type ReplayTestOptions, type RotateGestureOptions, type ScrollOptions, type SelectorSnapshotCommandOptions, type SelectorTarget, type SessionCloseResult, type SessionSaveScriptOptions, type SessionSaveScriptResult, type SettingsUpdateOptions, type SettleCommandOptions, type SnapshotNode, type SnapshotState, type StartAgentDeviceOptions, type StartupPerfSample, type SwipeGestureOptions, type SwipeOptions, type TapGestureOptions, type TargetShutdownResult, type TelephonyCommandOptions, type TraceCommandResult, type TraceOptions, type TransformGestureOptions, type TriggerAppEventCommandResult, type TvRemoteCommandOptions, type TypeTextOptions, type ViewportCommandOptions, type WaitCommandOptions, type WaitCommandResult, type WaitCommandTarget, centerOfRect, createAgentDeviceClient, createLocalArtifactAdapter, ensureDaemon, isAgentDeviceError, type isRecord, isUnreadableCaptureContentError, normalizeAgentDeviceError, startAgentDevice };