//#region src/kernel/device.d.ts declare const APPLE_OS_VALUES: readonly ['ios', 'ipados', 'tvos', 'watchos', 'visionos', 'macos']; type AppleOS = (typeof APPLE_OS_VALUES)[number]; declare const PLATFORMS: readonly ['apple', 'android', 'linux', 'web']; type Platform = (typeof PLATFORMS)[number]; declare const PUBLIC_PLATFORMS: readonly ['ios', 'macos', 'android', 'linux', 'web']; type PublicPlatform = (typeof PUBLIC_PLATFORMS)[number]; declare const PLATFORM_SELECTORS: readonly ["apple", "android", "linux", "web", "ios", "macos"]; type PlatformSelector = (typeof PLATFORM_SELECTORS)[number]; declare const DEVICE_KINDS: readonly ['simulator', 'emulator', 'device']; type DeviceKind = (typeof DEVICE_KINDS)[number]; declare const DEVICE_TARGETS: readonly ['mobile', 'tv', 'desktop']; type DeviceTarget = (typeof DEVICE_TARGETS)[number]; //#endregion //#region src/kernel/errors.d.ts type KnownAppErrorCode = 'INVALID_ARGS' | 'DEVICE_NOT_FOUND' | 'DEVICE_IN_USE' | 'TOOL_MISSING' | 'APP_NOT_INSTALLED' | 'UNSUPPORTED_PLATFORM' | 'UNSUPPORTED_OPERATION' | 'NOT_IMPLEMENTED' | 'COMMAND_FAILED' | 'SESSION_NOT_FOUND' | 'UNAUTHORIZED' | 'AMBIGUOUS_MATCH' | 'UNKNOWN'; type AppErrorCode = KnownAppErrorCode | (string & {}); /** * Details bag for AppError. Free-form context is allowed, but these keys carry * meaning at normalize/render time and must keep their types: * - `hint` — overrides `defaultHintForCode`; re-wraps preserve an existing hint. * - `diagnosticId` / `logPath` — lifted onto the normalized error, stripped from details. * - `processExitError` + `stdout`/`stderr`/`exitCode` — marks a wrap of a real * process exit so normalizeError can surface the first meaningful stderr line; * build these via `execFailureDetails`/`requireExecSuccess` in src/utils/exec.ts * rather than by hand. * - `retriable` — typed retry signal hoisted to the wire error shape. * - `reason` — machine-dispatchable sub-classification within a code. */ type AppErrorDetails = Record & { hint?: string; diagnosticId?: string; logPath?: string; retriable?: boolean; supportedOn?: string; processExitError?: boolean; stdout?: string; stderr?: string; exitCode?: number | null; reason?: string; }; type NormalizedError = { code: string; message: string; hint?: string; diagnosticId?: string; logPath?: string; /** * Lifted from `details.retriable` when a throw site classified the failure as * clearly transient (or clearly not). Included only when set, so the default * error wire shape is unchanged. */ retriable?: boolean; supportedOn?: string; details?: Record; }; declare class AppError extends Error { code: AppErrorCode; details?: AppErrorDetails; cause?: unknown; constructor(code: AppErrorCode, message: string, details?: AppErrorDetails, cause?: unknown); } declare function isAgentDeviceError(err: unknown): err is AppError; declare function normalizeAgentDeviceError(err: unknown, context?: { diagnosticId?: string; logPath?: string; }): NormalizedError; declare function normalizeError(err: unknown, context?: { diagnosticId?: string; logPath?: string; }): NormalizedError; declare function defaultHintForCode(code: string): string | undefined; //#endregion //#region src/contracts/debug-symbols.d.ts type DebugSymbolsOptions = { action?: 'symbols'; artifact: string; dsym?: string; searchPath?: string; out?: string; cwd?: string; }; type DebugSymbolsImage = { name: string; uuid: string; arch?: string; dsymPath: string; binaryPath: string; }; type DebugSymbolsCrashFrame = { index: number; image: string; address: string; symbol?: string; }; type DebugSymbolsCrashSummary = { format: 'ips' | 'text'; appName?: string; bundleId?: string; version?: string; incident?: string; timestamp?: string; exceptionType?: string; exceptionCodes?: string; terminationReason?: string; crashedThread?: number; topFrames: DebugSymbolsCrashFrame[]; findings: string[]; }; type DebugSymbolsResult = { kind: 'debugSymbols'; platform: 'apple'; artifactPath: string; outPath: string; crash: DebugSymbolsCrashSummary; matchedImages: DebugSymbolsImage[]; symbolicatedFrames: number; skippedImages: number; warnings?: string[]; message: string; }; //#endregion //#region src/kernel/snapshot.d.ts /** * Structured quality verdict computed once by the iOS runner's snapshot capture plan. * The daemon renders it; it never re-derives degradation from node shapes. * * Defined here (the foundational snapshot type module) rather than in * snapshot-quality.ts so SnapshotNode can reference it without a cyclic import; * snapshot-quality.ts (the validation logic) re-exports it for existing callers. */ type SnapshotQualityVerdict = { state: 'healthy' | 'recovered' | 'sparse'; backend: 'tree' | 'queries' | 'private-ax'; reason?: string; reasonCode?: 'ax-rejected' | 'sparse-tree' | 'budget' | 'no-nodes' | 'capture-failed'; effectiveDepth?: number; collapsedLeafIndexes?: number[]; }; type Rect = { x: number; y: number; width: number; height: number; }; type Point = { x: number; y: number; }; type RawSnapshotNode = { index: number; type?: string; role?: string; subrole?: string; label?: string; value?: string; identifier?: string; rect?: Rect; enabled?: boolean; selected?: boolean; focused?: boolean; visibleToUser?: boolean; hittable?: boolean; depth?: number; parentIndex?: number; pid?: number; bundleId?: string; appName?: string; windowTitle?: string; surface?: string; hiddenContentAbove?: boolean; hiddenContentBelow?: boolean; interactionBlocked?: 'covered'; presentationHints?: string[]; }; type SnapshotNode = RawSnapshotNode & { ref: string; /** * Output-only marker set by client-serialization dedup (see * ../snapshot/snapshot-label-dedup.ts) when `label`/`identifier` was omitted * because it string-equals the nearest ancestor's value in the parent chain. * Never set on the in-daemon session tree used by selectors/wait/replay. */ inheritsLabel?: true; inheritsIdentifier?: true; }; type SnapshotBackend = 'xctest' | 'android' | 'macos-helper' | 'linux-atspi' | 'web'; type SnapshotState = { nodes: SnapshotNode[]; createdAt: number; truncated?: boolean; backend?: SnapshotBackend; snapshotQuality?: SnapshotQualityVerdict; comparisonSafe?: boolean; presentationKey?: string; }; type SnapshotUnchanged = { ageMs: number; nodeCount: number; interactiveOnly?: boolean; scope?: string; }; type SnapshotVisibilityReason = 'offscreen-nodes' | 'scroll-hidden-above' | 'scroll-hidden-below'; type SnapshotVisibility = { partial: boolean; visibleNodeCount: number; totalNodeCount: number; reasons: SnapshotVisibilityReason[]; }; type ScreenshotOverlayRef = { ref: string; label?: string; rect: Rect; overlayRect: Rect; center: Point; }; declare function centerOfRect(rect: Rect): Point; //#endregion //#region src/kernel/contracts.d.ts type SessionRuntimeHints = { platform?: 'ios' | 'android'; metroHost?: string; metroPort?: number; bundleUrl?: string; launchUrl?: string; }; type DaemonInstallSource = { kind: 'url'; url: string; headers?: Record; } | { kind: 'path'; path: string; } | ({ kind: 'github-actions-artifact'; owner: string; repo: string; } & ({ artifactId: number; } | { runId: number; artifactName: string; } | { artifactName: string; })); declare const DAEMON_LOCK_POLICIES: readonly ['reject', 'strip']; type DaemonLockPolicy = (typeof DAEMON_LOCK_POLICIES)[number]; declare const LEASE_BACKENDS: readonly ['ios-simulator', 'ios-instance', 'android-instance']; type LeaseBackend = (typeof LEASE_BACKENDS)[number]; declare const DAEMON_SERVER_MODES: readonly ['socket', 'http', 'dual']; type DaemonServerMode = (typeof DAEMON_SERVER_MODES)[number]; declare const DAEMON_TRANSPORT_PREFERENCES: readonly ['auto', 'socket', 'http']; type DaemonTransportPreference = (typeof DAEMON_TRANSPORT_PREFERENCES)[number]; declare const SESSION_ISOLATION_MODES: readonly ['none', 'tenant']; type SessionIsolationMode = (typeof SESSION_ISOLATION_MODES)[number]; declare const NETWORK_INCLUDE_MODES: readonly ['summary', 'headers', 'body', 'all']; type NetworkIncludeMode = (typeof NETWORK_INCLUDE_MODES)[number]; declare const RESPONSE_LEVELS: readonly ['digest', 'default', 'full']; type ResponseLevel = (typeof RESPONSE_LEVELS)[number]; type DaemonRequestMeta = { requestId?: string; debug?: boolean; includeCost?: boolean; responseLevel?: ResponseLevel; cwd?: string; sessionExplicit?: boolean; tenantId?: string; runId?: string; leaseId?: string; leaseTtlMs?: number; leaseBackend?: LeaseBackend; leaseProvider?: string; deviceKey?: string; clientId?: string; sessionIsolation?: SessionIsolationMode; uploadedArtifactId?: string; clientArtifactPaths?: Record; installSource?: DaemonInstallSource; retainMaterializedPaths?: boolean; materializedPathRetentionMs?: number; materializationId?: string; lockPolicy?: DaemonLockPolicy; lockPlatform?: PlatformSelector; requestProgress?: 'replay-test' | 'command'; }; type DaemonRequest = { token?: string; session?: string; command: string; positionals: string[]; flags?: Record; runtime?: SessionRuntimeHints; meta?: DaemonRequestMeta; }; type DaemonArtifactKnownType = 'screenshot' | 'screenshot-diff' | 'screen-recording' | 'screen-recording-chunk' | 'screen-recording-telemetry' | 'trace-log'; type DaemonArtifactType = DaemonArtifactKnownType | (string & {}); type DaemonArtifact = { field: string; artifactType?: DaemonArtifactType; artifactId?: string; fileName?: string; localPath?: string; path?: string; }; type ResponseCost = { wallClockMs: number; runnerRoundTrips: number; nodeCount?: number; }; type DaemonResponseData = Record & { artifacts?: DaemonArtifact[]; cost?: ResponseCost; }; type DaemonError = { code: string; message: string; hint?: string; diagnosticId?: string; logPath?: string; details?: Record; /** * Machine-readable typed-error signals (Phase 2). Additive: present only when * derivable, so the default error wire shape is unchanged. * * `retriable` flags a transient failure an agent should retry (vs. a * deterministic one where a retry is wasted). `supportedOn` lists the platform * families that DO support the command (derived from the capability matrix), * surfaced on platform-mismatch errors so an agent self-corrects without a * wasted round-trip. */ retriable?: boolean; supportedOn?: string; }; type DaemonResponse = { ok: true; data?: DaemonResponseData; } | { ok: false; error: DaemonError; }; type LeaseAllocatePayload = { token?: string; session?: string; tenantId?: string; tenant?: string; runId?: string; ttlMs?: number; backend?: LeaseBackend; leaseProvider?: string; deviceKey?: string; clientId?: string; }; type LeaseHeartbeatPayload = { token?: string; session?: string; tenantId?: string; tenant?: string; runId?: string; leaseId?: string; ttlMs?: number; backend?: LeaseBackend; leaseProvider?: string; deviceKey?: string; clientId?: string; }; type LeaseReleasePayload = { token?: string; session?: string; tenantId?: string; tenant?: string; runId?: string; leaseId?: string; backend?: LeaseBackend; leaseProvider?: string; deviceKey?: string; clientId?: string; }; type JsonRpcId = string | number | null; type JsonRpcRequestEnvelope = { jsonrpc?: string; id?: JsonRpcId; method?: string; params?: TParams; }; //#endregion export { AppError as A, PlatformSelector as B, SnapshotQualityVerdict as C, centerOfRect as D, SnapshotVisibility as E, normalizeError as F, AppleOS as I, DeviceKind as L, defaultHintForCode as M, isAgentDeviceError as N, DebugSymbolsOptions as O, normalizeAgentDeviceError as P, DeviceTarget as R, SnapshotNode as S, SnapshotUnchanged as T, PublicPlatform as V, ResponseLevel as _, DaemonRequest as a, Point as b, DaemonServerMode as c, JsonRpcRequestEnvelope as d, LeaseAllocatePayload as f, NetworkIncludeMode as g, LeaseReleasePayload as h, DaemonLockPolicy as i, NormalizedError as j, DebugSymbolsResult as k, DaemonTransportPreference as l, LeaseHeartbeatPayload as m, DaemonError as n, DaemonResponse as o, LeaseBackend as p, DaemonInstallSource as r, DaemonResponseData as s, DaemonArtifactType as t, JsonRpcId as u, SessionIsolationMode as v, SnapshotState as w, ScreenshotOverlayRef as x, SessionRuntimeHints as y, Platform as z };