import { type CacheDirContext } from "./cacheDir.js"; export interface XcodeVersion { /** e.g. "16.4" */ version: string; /** e.g. "16F6" — distinguishes two images shipping the same marketing version. */ build: string; } /** * Minimum Xcode major for the WDA prebuild. Below this the * `build-for-testing` invocation against the generic iOS Simulator * destination (and the appium-xcuitest-driver versions we install) are not * supported — skip with upgrade guidance instead of attempting a doomed * build. Floor per the design doc's "likely 14+"; revisit against the live * macOS leg if it ever disagrees. */ export declare const MIN_XCODE_MAJOR = 14; /** * Parse `xcodebuild -version` output: * * Xcode 16.4 * Build version 16F6 * * Returns null when the output doesn't look like full Xcode (e.g. the * Command Line Tools error text) — only full Xcode can build WDA. */ export declare function parseXcodebuildVersion(output: unknown): XcodeVersion | null; export declare function xcodeMajor(xcode: XcodeVersion): number; /** The managed WDA root: /ios/wda. */ export declare function getWdaRoot(ctx?: CacheDirContext): string; export interface WdaFs { existsSync(p: string): boolean; readFileSync(p: string): string | Buffer; writeFileSync(p: string, data: string): void; mkdirSync(p: string, opts?: { recursive?: boolean; }): unknown; renameSync(from: string, to: string): void; rmSync(p: string, opts?: { recursive?: boolean; force?: boolean; }): void; readdirSync(p: string): string[]; statSync(p: string): { mtimeMs: number; }; } /** * The cache key a WDA build is valid for: Xcode marketing version + build id * (two runner images can ship the same marketing version) + the exact * appium-xcuitest-driver version whose bundled WDA source was compiled. */ export declare function computeWdaKey(xcode: XcodeVersion, driverVersion: string): string; /** Where xcodebuild's products land inside a key dir. */ export declare const RUNNER_APP_RELATIVE: string; export declare const PRODUCTS_MARKER = "products.json"; export declare const LAST_USED_STAMP = "last-used"; /** The writer's advisory-lock dir name under the WDA root — one name shared * by the acquire call and the prune pass's skip check so they can't drift. */ export declare const WDA_LOCK_DIRNAME = ".lock"; export interface WdaProductsMarker { key: string; driverVersion: string; /** Diagnostic metadata — validated shape only, never consumed by readers. */ xcode?: XcodeVersion; runnerApp?: string; builtAt?: string; } /** * Read and validate a key dir's completeness marker. Null on any miss: * absent/corrupt marker (a crashed half-built dir never wrote one — that is * the lock-free correctness story for readers) or a key dir whose Runner app * is gone. The Runner check uses the layout-relative path, NOT the absolute * path recorded in the marker, so a relocated cache root (moved home dir, * container bind-mount, CI cache restored under a different path) keeps its * valid products instead of misreading them all as stale. */ export declare function readProductsMarker(keyDir: string, fs: WdaFs): WdaProductsMarker | null; /** * Touch a key dir's last-used stamp — the prune-freshness signal shared by * the installer (writes it at build time, stats it when pruning) and the * session locator (touches it on every valid hit). Best-effort: a failed * stamp only risks an early prune much later. */ export declare function touchLastUsed(keyDir: string, fs: WdaFs, now: () => number): void; /** * Minimum appium-xcuitest-driver MAJOR whose prebuilt-WDA consumption * (`appium:usePrebuiltWDA` + `appium:derivedDataPath`) this locator has been * validated against (the live macOS fixture legs run the 10.x line that * doc-detective's declared range installs). Prebuilt handling is * driver-version-sensitive across older majors (`prebuiltWDAPath` / * `useXctestrunFile` variants, differing .xctestrun handling), so anything * below the floor gets a plain fallback — today's build-in-session behavior — * never a guess. */ export declare const MIN_PREBUILT_WDA_DRIVER_MAJOR = 10; export interface LocateManagedWdaOptions { ctx?: CacheDirContext; fs?: WdaFs; platform?: NodeJS.Platform; probeXcode?: () => XcodeVersion | null; resolveDriverVersion?: (name: string, ctx: CacheDirContext) => string | null; /** Test override for the managed WDA root (default: /ios/wda). */ wdaRootDir?: string; now?: () => number; } export interface ManagedWdaHit { key: string; /** Value for appium:derivedDataPath — the keyed DerivedData dir. */ derivedDataPath: string; } /** * Pure managed-products locator for iOS session capability builders: find * the prebuilt WDA products matching the CURRENT toolchain (installed * driver version × host Xcode). On a valid hit, touch the last-used stamp * (the prune signal) and return the derivedDataPath to consume read-only * with `appium:usePrebuiltWDA`. Any miss — wrong platform, unresolvable * driver, driver below the supported floor, no full Xcode, absent/stale * marker — returns null and the session builds WDA itself, exactly today's * behavior. Never throws. */ export declare function locateManagedWda(options?: LocateManagedWdaOptions): ManagedWdaHit | null; /** * Apply the WDA derived-data capabilities for an iOS XCUITest session — the * ONE place the env-override-vs-managed-products precedence and the exact * capability pair live, shared by the app-surface and mobile-web builders so * the two cannot drift (the pair is driver-version-sensitive; see * MIN_PREBUILT_WDA_DRIVER_MAJOR). * * Precedence: DOC_DETECTIVE_IOS_WDA_DERIVED_DATA_PATH set → exactly the * historical behavior (`derivedDataPath` only, caller owns semantics; the * managed locator is not consulted). Otherwise a managed-products hit sets * both `appium:derivedDataPath` (the keyed DerivedData) and * `appium:usePrebuiltWDA` (read-only consumption — the concurrency answer). * No locator or a miss → no capabilities change (today's behavior: the * session builds WDA itself in a throwaway per-session temp dir). */ export declare function applyManagedWdaCapabilities(capabilities: Record, locateWda?: () => ManagedWdaHit | null): void; /** * Locate the WebDriverAgent source bundled with the installed * appium-xcuitest-driver: walk up from the driver's resolved entry looking * for a `node_modules/appium-webdriveragent` that actually contains the * Xcode project. The walk (rather than a hardcoded relative path) is what * absorbs npm's hoisting variability — nested under the driver on some * installs, hoisted to the runtime root on others. */ export declare function findWdaSource(driverEntryPath: string, fs: Pick): string | null; //# sourceMappingURL=wdaProducts.d.ts.map