spana-test 0.6.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.agents/skills/spana-testing/SKILL.md +19 -15
- package/dist/agent/index.d.ts +2 -2
- package/dist/agent/index.js +3 -3
- package/dist/{app-DcLXtpv4.d.ts → app-D_UyZBsl.d.ts} +9 -2
- package/dist/{chunk-S4JVAHBR.js → chunk-2IXXEXTL.js} +2 -2
- package/dist/{chunk-4K3FZTSV.js → chunk-54ASKII6.js} +6 -2
- package/dist/chunk-54ASKII6.js.map +1 -0
- package/dist/{chunk-KEUZLBQS.js → chunk-6B5Y75V4.js} +544 -79
- package/dist/chunk-6B5Y75V4.js.map +1 -0
- package/dist/{chunk-KBRLIQRA.js → chunk-JYFPZRCN.js} +6 -3
- package/dist/chunk-JYFPZRCN.js.map +1 -0
- package/dist/{chunk-WBBMEAHU.js → chunk-KNSAHEXI.js} +3 -3
- package/dist/{chunk-C4E4XULT.js → chunk-RURZVMZ7.js} +3 -3
- package/dist/{chunk-LCV673G3.js → chunk-T3EBOYLS.js} +154 -26
- package/dist/chunk-T3EBOYLS.js.map +1 -0
- package/dist/{chunk-PWUJT5HE.js → chunk-T5CROOR7.js} +3 -3
- package/dist/cli.js +8 -8
- package/dist/config-loader-NIDQGP3K.js +9 -0
- package/dist/{doctor-command-WEHFANT7.js → doctor-command-WPEVZEZ4.js} +3 -3
- package/dist/{flow-C2JQ7gUu.d.ts → flow-g6AICPAl.d.ts} +1 -1
- package/dist/gherkin/steps.d.ts +2 -2
- package/dist/{html-F3X3XPSX.js → html-IKCTZH2U.js} +194 -3
- package/dist/html-IKCTZH2U.js.map +1 -0
- package/dist/index.d.ts +228 -7
- package/dist/index.js +161 -7
- package/dist/index.js.map +1 -1
- package/dist/{screenshot-compare-5NINZVOK.js → screenshot-compare-POTXVUTL.js} +2 -2
- package/dist/{server-OANRDAHN.js → server-EBPYK3VE.js} +4 -4
- package/dist/{server-3MGZNK67.js → server-IGLBFEU7.js} +2 -2
- package/dist/{session-Q3QYHT4Q.js → session-QRWH3SPW.js} +4 -4
- package/dist/{session-Daq0mE_a.d.ts → session-cJ_tZjCL.d.ts} +1 -1
- package/dist/{studio-command-RJYLJT4I.js → studio-command-FLA5HKRK.js} +2 -2
- package/dist/{test-command-ALH5ZQY5.js → test-command-P5W7UD52.js} +7 -7
- package/package.json +2 -1
- package/dist/chunk-4K3FZTSV.js.map +0 -1
- package/dist/chunk-KBRLIQRA.js.map +0 -1
- package/dist/chunk-KEUZLBQS.js.map +0 -1
- package/dist/chunk-LCV673G3.js.map +0 -1
- package/dist/config-loader-J4Z2PMUQ.js +0 -9
- package/dist/html-F3X3XPSX.js.map +0 -1
- /package/dist/{chunk-S4JVAHBR.js.map → chunk-2IXXEXTL.js.map} +0 -0
- /package/dist/{chunk-WBBMEAHU.js.map → chunk-KNSAHEXI.js.map} +0 -0
- /package/dist/{chunk-C4E4XULT.js.map → chunk-RURZVMZ7.js.map} +0 -0
- /package/dist/{chunk-PWUJT5HE.js.map → chunk-T5CROOR7.js.map} +0 -0
- /package/dist/{config-loader-J4Z2PMUQ.js.map → config-loader-NIDQGP3K.js.map} +0 -0
- /package/dist/{doctor-command-WEHFANT7.js.map → doctor-command-WPEVZEZ4.js.map} +0 -0
- /package/dist/{screenshot-compare-5NINZVOK.js.map → screenshot-compare-POTXVUTL.js.map} +0 -0
- /package/dist/{server-OANRDAHN.js.map → server-EBPYK3VE.js.map} +0 -0
- /package/dist/{server-3MGZNK67.js.map → server-IGLBFEU7.js.map} +0 -0
- /package/dist/{session-Q3QYHT4Q.js.map → session-QRWH3SPW.js.map} +0 -0
- /package/dist/{studio-command-RJYLJT4I.js.map → studio-command-FLA5HKRK.js.map} +0 -0
- /package/dist/{test-command-ALH5ZQY5.js.map → test-command-P5W7UD52.js.map} +0 -0
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/api/flow.ts","../src/schemas/element.ts","../src/schemas/device.ts","../src/api/fixtures.ts","../src/core/replay-cache.ts"],"sourcesContent":["import type { ExtendedSelector, Platform } from \"../schemas/selector.js\";\nimport type { ArtifactConfig } from \"../schemas/config.js\";\nimport type { LaunchOptions } from \"../drivers/raw-driver.js\";\nimport type { PromiseApp } from \"./app.js\";\nimport type { PromiseExpectation } from \"./expect.js\";\nimport type { Sessions } from \"../core/session-manager.js\";\n\nexport interface WhenCondition {\n /** Only run on these platforms */\n platform?: Platform | Platform[];\n /** Only run when this environment variable is set */\n env?: string;\n}\n\nexport interface FlowDefaults {\n waitTimeout?: number;\n pollInterval?: number;\n settleTimeout?: number;\n waitForIdleTimeout?: number;\n typingDelay?: number;\n /** Starting poll interval for adaptive backoff. Default: 50ms. */\n initialPollInterval?: number;\n /** Hierarchy cache TTL in ms. Default: 100. Set to 0 to disable. */\n hierarchyCacheTtl?: number;\n}\n\nexport interface FlowConfig<R extends string = string> {\n tags?: string[];\n platforms?: Platform[];\n timeout?: number;\n autoLaunch?: boolean; // default true\n /** Per-flow launch defaults. Merged with project launchOptions and manual app.launch() calls. */\n launchOptions?: LaunchOptions<R>;\n artifacts?: ArtifactConfig;\n when?: WhenCondition;\n /** Per-flow overrides for timing defaults. Merged with global defaults. */\n defaults?: FlowDefaults;\n}\n\nexport interface FlowContext<T extends string = string, R extends string = string> {\n app: PromiseApp<T, R>;\n expect: (selector: ExtendedSelector<T>) => PromiseExpectation<T>;\n platform: Platform;\n sessions: Sessions;\n}\n\nexport type FlowFn<T extends string = string, R extends string = string> = (\n ctx: FlowContext<T, R>,\n) => Promise<void>;\n\nexport interface FlowDefinition<T extends string = string, R extends string = string> {\n name: string;\n fn: FlowFn<T, R>;\n config: FlowConfig<R>;\n sourcePath?: string;\n}\n\n// Overloads: flow(name, fn) and flow(name, config, fn)\nexport function flow<T extends string = string, R extends string = string>(\n name: string,\n fn: FlowFn<T, R>,\n): FlowDefinition<T, R>;\nexport function flow<T extends string = string, R extends string = string>(\n name: string,\n config: FlowConfig<R>,\n fn: FlowFn<T, R>,\n): FlowDefinition<T, R>;\nexport function flow<T extends string = string, R extends string = string>(\n name: string,\n configOrFn: FlowConfig<R> | FlowFn<T, R>,\n maybeFn?: FlowFn<T, R>,\n): FlowDefinition<T, R> {\n if (typeof configOrFn === \"function\") {\n return { name, fn: configOrFn, config: {} };\n }\n return { name, fn: maybeFn!, config: configOrFn };\n}\n\n/** Helper to create a typed flow function for your project. */\nexport function createFlow<T extends string = string, R extends string = string>() {\n return flow<T, R>;\n}\n","import { Schema } from \"effect\";\n\nexport const Bounds = Schema.Struct({\n x: Schema.Number,\n y: Schema.Number,\n width: Schema.Number,\n height: Schema.Number,\n});\nexport type Bounds = typeof Bounds.Type;\n\nexport const Element = Schema.Struct({\n id: Schema.optional(Schema.String),\n text: Schema.optional(Schema.String),\n value: Schema.optional(Schema.String),\n accessibilityLabel: Schema.optional(Schema.String),\n resourceId: Schema.optional(Schema.String),\n elementType: Schema.optional(Schema.String),\n bounds: Bounds,\n enabled: Schema.optional(Schema.Boolean),\n visible: Schema.optional(Schema.Boolean),\n clickable: Schema.optional(Schema.Boolean),\n focused: Schema.optional(Schema.Boolean),\n attributes: Schema.optional(Schema.Record({ key: Schema.String, value: Schema.String })),\n children: Schema.optional(\n Schema.Array(Schema.suspend((): Schema.Schema<any, any, never> => Element)),\n ),\n});\nexport type Element = typeof Element.Type;\n\nexport const ViewHierarchy = Schema.Struct({\n root: Element,\n timestamp: Schema.Number,\n});\nexport type ViewHierarchy = typeof ViewHierarchy.Type;\n","import { Schema } from \"effect\";\n\nexport const DeviceInfo = Schema.Struct({\n platform: Schema.Literal(\"android\", \"ios\", \"web\", \"electron\", \"electrobun\"),\n deviceId: Schema.String,\n name: Schema.String,\n isEmulator: Schema.Boolean,\n screenWidth: Schema.Number,\n screenHeight: Schema.Number,\n driverType: Schema.Literal(\n \"playwright\",\n \"uiautomator2\",\n \"wda\",\n \"appium\",\n \"electron\",\n \"electrobun\",\n ),\n});\nexport type DeviceInfo = typeof DeviceInfo.Type;\n","import type { DomClearStorageOptions, DomStorageEntries } from \"../channels/dom-channel.js\";\nimport type { FlowConfig, FlowContext, FlowDefinition } from \"./flow.js\";\nimport type { PromiseApp } from \"./app.js\";\n\n/**\n * Declarative named setup state (e.g. `\"admin\"`, `\"authenticated\"`, `\"seeded-cart\"`).\n * Automatically uses `spana-bridge` storage injection on mobile/desktop/bridge-web\n * and Playwright `loadAuthState` / `evaluate` on web.\n */\nexport interface NamedSetupDefinition<T extends string = string, R extends string = string> {\n name: string;\n /** Clear storage before restoring state (default: true). */\n clearBefore?: boolean | DomClearStorageOptions;\n /** Storage entries injected via `app.setStorage(...)` (localStorage/sessionStorage/cookies/Preferences). */\n storage?: DomStorageEntries;\n /** Optional Playwright storageState JSON file path for web runs. */\n storageStatePath?: string;\n /** Optional URL/route to navigate to after injecting state (or `reload` when omitted and storage was injected). */\n navigateTo?: R;\n /** Whether to reload the WebView/page after injecting storage when `navigateTo` is omitted (default: true). */\n reloadAfterStorage?: boolean;\n /** Optional custom setup hook for seeding API state or performing extra actions. */\n run?: (ctx: FlowContext<T, R>) => Promise<void>;\n}\n\n/** Define a reusable named setup state for `{ session: \"<name>\" }` flows. */\nexport function defineSetup<T extends string = string, R extends string = string>(\n name: string,\n config: Omit<NamedSetupDefinition<T, R>, \"name\">,\n): NamedSetupDefinition<T, R> {\n return { name, ...config };\n}\n\n/** Apply a named setup state to the active `FlowContext`. */\nexport async function applyNamedSetup<T extends string = string, R extends string = string>(\n setup: NamedSetupDefinition<T, R>,\n ctx: FlowContext<T, R>,\n): Promise<void> {\n const app = ctx.app as PromiseApp<T, R>;\n\n if (setup.storageStatePath && ctx.platform === \"web\") {\n await app.loadAuthState(setup.storageStatePath);\n }\n\n if (setup.clearBefore !== false && setup.storage) {\n const clearOpts = typeof setup.clearBefore === \"object\" ? setup.clearBefore : undefined;\n try {\n await app.clearStorage(clearOpts);\n } catch {\n // Fallback for plain web without spana-bridge\n if (ctx.platform === \"web\") {\n await app.evaluate(\"localStorage.clear(); sessionStorage.clear();\");\n }\n }\n }\n\n if (setup.storage) {\n try {\n await app.setStorage(setup.storage);\n } catch {\n // Fallback for web without spana-bridge\n if (ctx.platform === \"web\") {\n const serialized = JSON.stringify(setup.storage);\n await app.evaluate(\n `(() => { const entries = ${serialized}; if (entries.localStorage) { for (const [k, v] of Object.entries(entries.localStorage)) localStorage.setItem(k, v); } if (entries.sessionStorage) { for (const [k, v] of Object.entries(entries.sessionStorage)) sessionStorage.setItem(k, v); } })()`,\n );\n } else {\n throw new Error(\n `Named setup \"${setup.name}\" requires spana-bridge or a DOM channel to inject storage on ${ctx.platform}.`,\n );\n }\n }\n\n if (setup.navigateTo) {\n await app.openLink(setup.navigateTo);\n } else if (setup.reloadAfterStorage !== false) {\n try {\n await app.resetFast();\n } catch {\n if (ctx.platform === \"web\") {\n await app.evaluate(\"window.location.reload();\");\n }\n }\n }\n } else if (setup.navigateTo) {\n await app.openLink(setup.navigateTo);\n }\n\n if (setup.run) {\n await setup.run(ctx);\n }\n}\n\n// ── Composable Lazy Fixtures ────────────────────────────────────────────────\n\nexport type FixtureFn<\n Value,\n Deps extends Record<string, unknown>,\n T extends string = string,\n R extends string = string,\n> = (ctx: FlowContext<T, R> & Deps, use: (value: Value) => Promise<void>) => Promise<void>;\n\nexport type FixtureDefinition<\n Value,\n Deps extends Record<string, unknown>,\n T extends string = string,\n R extends string = string,\n> =\n | FixtureFn<Value, Deps, T, R>\n | {\n setup: FixtureFn<Value, Deps, T, R>;\n /** When true, always runs for every flow even if not destructured. */\n auto?: boolean;\n /** Explicit fixture dependency names (optional — also inferred from parameter destructuring). */\n deps?: Array<keyof Deps & string>;\n };\n\nexport type FixtureMap<\n Fixtures extends Record<string, unknown>,\n T extends string = string,\n R extends string = string,\n> = {\n [K in keyof Fixtures]: FixtureDefinition<Fixtures[K], Omit<Fixtures, K>, T, R>;\n};\n\nexport interface ExtendedFlowConfig<\n R extends string = string,\n SessionName extends string = string,\n> extends FlowConfig<R> {\n /** Optional named setup state applied before any lazy fixtures run. */\n session?: SessionName;\n /** Optional explicit fixture names to activate (in addition to destructured params). */\n uses?: string[];\n}\n\n/**\n * Extract top-level destructured parameter names from the first argument of a function:\n * `async ({ app, project, task: t }) => ...` -> `[\"app\", \"project\", \"task\"]`\n */\nexport function extractDestructuredParamNames(fn: (...args: any[]) => unknown): string[] {\n const src = fn.toString().trim();\n const openParen = src.indexOf(\"(\");\n if (openParen < 0) return [];\n\n // Find first parameter token\n let i = openParen + 1;\n while (i < src.length && /\\s/.test(src[i]!)) i++;\n if (src[i] !== \"{\") return [];\n\n // Extract balanced `{ ... }`\n let depth = 0;\n const start = i + 1;\n let end = -1;\n for (; i < src.length; i++) {\n const ch = src[i];\n if (ch === \"{\") depth++;\n else if (ch === \"}\") {\n depth--;\n if (depth === 0) {\n end = i;\n break;\n }\n }\n }\n if (end < 0) return [];\n\n const inner = src.slice(start, end);\n const names: string[] = [];\n // Split top-level commas only (ignore nested destructuring/defaults)\n let token = \"\";\n let nested = 0;\n for (let j = 0; j < inner.length; j++) {\n const ch = inner[j]!;\n if (ch === \"{\" || ch === \"[\" || ch === \"(\") nested++;\n else if (ch === \"}\" || ch === \"]\" || ch === \")\") nested--;\n else if (ch === \",\" && nested === 0) {\n const parsed = parseDestructuredKey(token);\n if (parsed) names.push(parsed);\n token = \"\";\n continue;\n }\n token += ch;\n }\n const last = parseDestructuredKey(token);\n if (last) names.push(last);\n return names;\n}\n\nfunction parseDestructuredKey(raw: string): string | null {\n const cleaned = raw.trim();\n if (!cleaned || cleaned.startsWith(\"...\")) return null;\n // Strip default value (`foo = 1`) and alias (`foo: bar`)\n const keyMatch = cleaned.match(/^([A-Za-z_$][A-Za-z0-9_$]*)/);\n return keyMatch?.[1] ?? null;\n}\n\ninterface NormalizedFixture<T extends string, R extends string> {\n name: string;\n setup: FixtureFn<unknown, Record<string, unknown>, T, R>;\n auto: boolean;\n deps: string[];\n}\n\nexport interface CreateFixturesOptions<\n Fixtures extends Record<string, unknown>,\n SessionName extends string = string,\n T extends string = string,\n R extends string = string,\n> {\n fixtures?: FixtureMap<Fixtures, T, R>;\n setups?: Record<SessionName, NamedSetupDefinition<T, R>>;\n}\n\n/**\n * Create a `flow()` builder enhanced with lazy composable fixtures and named\n * setup states (`{ session: \"admin\" }`), inspired by Playwright and `e2e`.\n *\n * - Fixtures only run when destructured by the flow (or marked `{ auto: true }`).\n * - Fixtures can depend on other fixtures; cycles are detected immediately.\n * - Teardown runs in strict reverse (LIFO) order even when the flow throws.\n */\nexport function createFlowWithFixtures<\n Fixtures extends Record<string, unknown> = Record<string, never>,\n SessionName extends string = string,\n T extends string = string,\n R extends string = string,\n>(options: CreateFixturesOptions<Fixtures, SessionName, T, R>) {\n const fixtureMap = new Map<string, NormalizedFixture<T, R>>();\n const rawFixtures = options.fixtures ?? ({} as FixtureMap<Fixtures, T, R>);\n const setups = (options.setups ?? {}) as Record<string, NamedSetupDefinition<T, R>>;\n\n for (const [name, def] of Object.entries(rawFixtures)) {\n const fn = typeof def === \"function\" ? def : def.setup;\n const auto = typeof def === \"function\" ? false : Boolean(def.auto);\n const explicitDeps = typeof def === \"function\" ? undefined : def.deps;\n const inferredDeps = explicitDeps ?? extractDestructuredParamNames(fn);\n fixtureMap.set(name, { name, setup: fn, auto, deps: inferredDeps });\n }\n\n function resolveFixtureOrder(requested: string[]): NormalizedFixture<T, R>[] {\n const ordered: NormalizedFixture<T, R>[] = [];\n const visiting = new Set<string>();\n const visited = new Set<string>();\n\n const visit = (name: string) => {\n if (visited.has(name)) return;\n const fix = fixtureMap.get(name);\n if (!fix) return;\n if (visiting.has(name)) {\n throw new Error(`Circular fixture dependency detected involving \"${name}\"`);\n }\n visiting.add(name);\n for (const dep of fix.deps) {\n if (fixtureMap.has(dep)) {\n visit(dep);\n }\n }\n visiting.delete(name);\n visited.add(name);\n ordered.push(fix);\n };\n\n // Always run `auto: true` fixtures first\n for (const fix of fixtureMap.values()) {\n if (fix.auto) visit(fix.name);\n }\n for (const name of requested) {\n visit(name);\n }\n return ordered;\n }\n\n function extendedFlow(\n name: string,\n fn: (ctx: FlowContext<T, R> & Fixtures) => Promise<void>,\n ): FlowDefinition<T, R>;\n function extendedFlow(\n name: string,\n config: ExtendedFlowConfig<R, SessionName>,\n fn: (ctx: FlowContext<T, R> & Fixtures) => Promise<void>,\n ): FlowDefinition<T, R>;\n function extendedFlow(\n name: string,\n configOrFn:\n | ExtendedFlowConfig<R, SessionName>\n | ((ctx: FlowContext<T, R> & Fixtures) => Promise<void>),\n maybeFn?: (ctx: FlowContext<T, R> & Fixtures) => Promise<void>,\n ): FlowDefinition<T, R> {\n const isFnOnly = typeof configOrFn === \"function\";\n const extConfig: ExtendedFlowConfig<R, SessionName> = isFnOnly ? {} : configOrFn;\n const userFn = isFnOnly ? configOrFn : maybeFn!;\n\n const requestedNames = [\n ...(extConfig.uses ?? []),\n ...extractDestructuredParamNames(userFn).filter((n) => fixtureMap.has(n)),\n ];\n\n const wrappedFn = async (baseCtx: FlowContext<T, R>): Promise<void> => {\n // 1. Restore named session setup before fixtures run\n if (extConfig.session) {\n const setup = setups[extConfig.session];\n if (!setup) {\n throw new Error(\n `Unknown setup session \"${extConfig.session}\". Registered setups: ${\n Object.keys(setups).join(\", \") || \"(none)\"\n }`,\n );\n }\n await applyNamedSetup(setup, baseCtx);\n }\n\n // 2. Resolve lazy fixture graph & run nested setup -> use -> LIFO teardown\n const orderedFixtures = resolveFixtureOrder(requestedNames);\n const mergedCtx: Record<string, unknown> = { ...baseCtx };\n\n const runChain = async (idx: number): Promise<void> => {\n if (idx >= orderedFixtures.length) {\n await userFn(mergedCtx as FlowContext<T, R> & Fixtures);\n return;\n }\n const fix = orderedFixtures[idx]!;\n let useCalled = false;\n let flowError: unknown;\n let hasFlowError = false;\n\n await fix.setup(mergedCtx as FlowContext<T, R> & Record<string, unknown>, async (val) => {\n useCalled = true;\n mergedCtx[fix.name] = val;\n try {\n await runChain(idx + 1);\n } catch (err) {\n flowError = err;\n hasFlowError = true;\n }\n });\n\n if (!useCalled) {\n throw new Error(`Fixture \"${fix.name}\" finished without calling use(value).`);\n }\n if (hasFlowError) {\n throw flowError;\n }\n };\n\n await runChain(0);\n };\n\n const { session: _session, uses: _uses, ...baseFlowConfig } = extConfig;\n return {\n name,\n config: baseFlowConfig,\n fn: wrappedFn,\n };\n }\n\n return extendedFlow;\n}\n\n// ── First-Class API Setup Client & Per-Persona Auth Cache ───────────────────\n\nexport interface ApiClientOptions {\n /** Base URL for API/test-control endpoints (e.g. `\"http://localhost:3000/api\"`). */\n baseUrl: string;\n /** Default headers attached to every request (e.g. `{ Authorization: \"Bearer ...\" }`). */\n headers?: Record<string, string>;\n /** Optional custom fetch implementation for testing. */\n fetchFn?: typeof fetch;\n}\n\nexport interface ApiRequestOptions {\n headers?: Record<string, string>;\n query?: Record<string, string | number | boolean | undefined>;\n signal?: AbortSignal;\n}\n\nexport interface ApiResponse<T = unknown> {\n status: number;\n ok: boolean;\n headers: Headers;\n data: T;\n}\n\nexport interface ApiClient {\n get<T = unknown>(path: string, opts?: ApiRequestOptions): Promise<ApiResponse<T>>;\n post<T = unknown>(\n path: string,\n body?: unknown,\n opts?: ApiRequestOptions,\n ): Promise<ApiResponse<T>>;\n put<T = unknown>(path: string, body?: unknown, opts?: ApiRequestOptions): Promise<ApiResponse<T>>;\n patch<T = unknown>(\n path: string,\n body?: unknown,\n opts?: ApiRequestOptions,\n ): Promise<ApiResponse<T>>;\n delete<T = unknown>(path: string, opts?: ApiRequestOptions): Promise<ApiResponse<T>>;\n /** Register an automatic teardown callback (runs in strict LIFO order on `cleanup()`). */\n onCleanup(fn: () => Promise<void> | void): void;\n /** Run all registered cleanup callbacks in reverse (LIFO) order and clear the queue. */\n cleanup(): Promise<void>;\n}\n\n/**\n * First-class HTTP client for seeding and tearing down test data via API/test-control\n * endpoints inside Spana flows and lazy fixtures (far faster than UI setup).\n */\nexport function createApiClient(options: ApiClientOptions): ApiClient {\n const baseUrl = options.baseUrl.replace(/\\/+$/, \"\");\n const defaultHeaders = options.headers ?? {};\n const fetchFn = options.fetchFn ?? fetch;\n const cleanups: Array<() => Promise<void> | void> = [];\n\n const request = async <T = unknown>(\n method: string,\n path: string,\n body?: unknown,\n opts?: ApiRequestOptions,\n ): Promise<ApiResponse<T>> => {\n const cleanPath =\n path.startsWith(\"http://\") || path.startsWith(\"https://\")\n ? path\n : `${baseUrl}/${path.replace(/^\\/+/, \"\")}`;\n const url = new URL(cleanPath);\n if (opts?.query) {\n for (const [k, v] of Object.entries(opts.query)) {\n if (v !== undefined) url.searchParams.set(k, String(v));\n }\n }\n\n const headers: Record<string, string> = {\n ...defaultHeaders,\n ...(body !== undefined ? { \"content-type\": \"application/json\" } : {}),\n ...opts?.headers,\n };\n\n const res = await fetchFn(url.toString(), {\n method,\n headers,\n ...(body !== undefined\n ? { body: typeof body === \"string\" ? body : JSON.stringify(body) }\n : {}),\n ...(opts?.signal ? { signal: opts.signal } : {}),\n });\n\n const contentType = res.headers.get(\"content-type\") ?? \"\";\n let data: unknown;\n if (contentType.includes(\"application/json\")) {\n data = await res.json().catch(() => null);\n } else {\n const text = await res.text().catch(() => \"\");\n try {\n data = text ? JSON.parse(text) : text;\n } catch {\n data = text;\n }\n }\n\n return {\n status: res.status,\n ok: res.ok,\n headers: res.headers,\n data: data as T,\n };\n };\n\n return {\n get: <T = unknown>(path: string, opts?: ApiRequestOptions) =>\n request<T>(\"GET\", path, undefined, opts),\n post: <T = unknown>(path: string, body?: unknown, opts?: ApiRequestOptions) =>\n request<T>(\"POST\", path, body, opts),\n put: <T = unknown>(path: string, body?: unknown, opts?: ApiRequestOptions) =>\n request<T>(\"PUT\", path, body, opts),\n patch: <T = unknown>(path: string, body?: unknown, opts?: ApiRequestOptions) =>\n request<T>(\"PATCH\", path, body, opts),\n delete: <T = unknown>(path: string, opts?: ApiRequestOptions) =>\n request<T>(\"DELETE\", path, undefined, opts),\n onCleanup: (fn) => {\n cleanups.push(fn);\n },\n cleanup: async () => {\n const pending = cleanups.splice(0, cleanups.length).toReversed();\n const errors: unknown[] = [];\n for (const fn of pending) {\n try {\n await fn();\n } catch (err) {\n errors.push(err);\n }\n }\n if (errors.length > 0) {\n throw errors[0];\n }\n },\n };\n}\n\n/**\n * Convenience lazy fixture builder for `createFlowWithFixtures`:\n * provides a fresh `ApiClient` to each flow and automatically executes all\n * `api.onCleanup(...)` hooks in LIFO order even when the flow throws.\n */\nexport function createApiFixture<\n Deps extends Record<string, unknown> = Record<string, never>,\n T extends string = string,\n R extends string = string,\n>(\n options: ApiClientOptions | ((ctx: FlowContext<T, R> & Deps) => ApiClientOptions),\n): FixtureFn<ApiClient, Deps, T, R> {\n return async (ctx, use) => {\n const resolved = typeof options === \"function\" ? options(ctx) : options;\n const api = createApiClient(resolved);\n try {\n await use(api);\n } finally {\n await api.cleanup();\n }\n };\n}\n\nexport interface PersonaDefinition<T extends string = string, R extends string = string> {\n name: string;\n /** Sign in once (via API, virtual passkey, or UI) and return storage entries or a saved storageStatePath. */\n signIn: (\n ctx: FlowContext<T, R>,\n ) => Promise<{ storage?: DomStorageEntries; storageStatePath?: string } | void>;\n /** Optional cache key discriminator (e.g. base URL or tenant ID). */\n cacheKey?: string;\n /** Optional route to navigate to after restoring cached auth state. */\n navigateTo?: R;\n}\n\n/** Define a reusable authenticated persona for `PersonaAuthCache`. */\nexport function definePersona<T extends string = string, R extends string = string>(\n name: string,\n config: Omit<PersonaDefinition<T, R>, \"name\">,\n): PersonaDefinition<T, R> {\n return { name, ...config };\n}\n\nexport interface CachedPersonaState {\n storage?: DomStorageEntries;\n storageStatePath?: string;\n cachedAt: number;\n}\n\n/**\n * In-memory per-persona auth state cache (single-flight safe across parallel workers).\n * Signs a persona in ONCE (including passkey / WebAuthn flows), caches its auth state,\n * and restores it in milliseconds across all remaining flows.\n */\nexport class PersonaAuthCache {\n private readonly cache = new Map<string, CachedPersonaState>();\n private readonly inflight = new Map<string, Promise<CachedPersonaState>>();\n\n private keyFor(persona: PersonaDefinition<any, any>): string {\n return `${persona.name}::${persona.cacheKey ?? \"default\"}`;\n }\n\n get(name: string, cacheKey = \"default\"): CachedPersonaState | undefined {\n return this.cache.get(`${name}::${cacheKey}`);\n }\n\n invalidate(name?: string, cacheKey = \"default\"): void {\n if (!name) {\n this.cache.clear();\n return;\n }\n this.cache.delete(`${name}::${cacheKey}`);\n }\n\n /**\n * Ensure `persona` is authenticated in `ctx`. On cache miss, executes `persona.signIn(ctx)`\n * once (coalescing concurrent callers); on cache hit, restores cookies/storageState directly.\n */\n async authenticate<T extends string = string, R extends string = string>(\n persona: PersonaDefinition<T, R>,\n ctx: FlowContext<T, R>,\n ): Promise<CachedPersonaState> {\n const key = this.keyFor(persona);\n let state = this.cache.get(key);\n let wasMiss = false;\n\n if (!state) {\n wasMiss = true;\n let pending = this.inflight.get(key);\n if (!pending) {\n pending = (async () => {\n const produced = (await persona.signIn(ctx)) ?? {};\n const entry: CachedPersonaState = {\n storage: produced.storage,\n storageStatePath: produced.storageStatePath,\n cachedAt: Date.now(),\n };\n this.cache.set(key, entry);\n return entry;\n })().finally(() => {\n this.inflight.delete(key);\n });\n this.inflight.set(key, pending);\n }\n state = await pending;\n }\n\n const app = ctx.app as PromiseApp<T, R>;\n if (!wasMiss) {\n if (state.storageStatePath && ctx.platform === \"web\") {\n await app.loadAuthState(state.storageStatePath);\n }\n if (state.storage) {\n await app.setStorage(state.storage);\n }\n }\n if (persona.navigateTo) {\n await app.openLink(persona.navigateTo);\n }\n return state;\n }\n}\n","import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from \"node:fs\";\nimport { dirname, join } from \"node:path\";\nimport { createHash } from \"node:crypto\";\nimport type { ExtendedSelector } from \"../schemas/selector.js\";\nimport type { PromiseApp } from \"../api/app.js\";\n\n/** A deterministic action recorded from an `agent.act(goal)` execution. */\nexport type RecordedAction =\n | { kind: \"tap\"; selector: ExtendedSelector }\n | { kind: \"doubleTap\"; selector: ExtendedSelector }\n | { kind: \"longPress\"; selector: ExtendedSelector }\n | { kind: \"inputText\"; text: string }\n | { kind: \"pressKey\"; key: string }\n | { kind: \"scroll\"; direction: \"up\" | \"down\" | \"left\" | \"right\" }\n | { kind: \"scrollUntilVisible\"; selector: ExtendedSelector }\n | { kind: \"openLink\"; url: string };\n\nexport interface ReplayCacheEntry {\n schemaVersion: 1;\n key: string;\n goal: string;\n flowName: string;\n platform: string;\n actions: RecordedAction[];\n recordedAt: string;\n verifiedBy: string;\n}\n\nexport type ReplayCacheMode = \"read-write\" | \"strict\" | \"off\";\n\nexport type CacheWriteStatus = \"saved\" | \"kept\" | \"unconfirmed\" | \"evicted\" | \"skipped\";\n\nexport interface ReplayStepOutcome {\n goal: string;\n key: string;\n status: \"replayed\" | \"handed-off\" | \"missed\" | \"live\";\n writeStatus?: CacheWriteStatus;\n actionCount: number;\n error?: string;\n}\n\nexport interface ReplayCacheSummary {\n replayed: number;\n handedOff: number;\n missed: number;\n saved: number;\n evicted: number;\n unconfirmed: number;\n}\n\n/**\n * Pluggable agent executor called ONLY on cache miss or self-healing handoff.\n * Returns the deterministic list of actions it executed to achieve `goal`.\n */\nexport interface AgentActExecutor {\n act(input: {\n goal: string;\n app: PromiseApp;\n handoffReason?: string;\n }): Promise<{ actions: RecordedAction[] }>;\n}\n\n/** Compute a stable cache key for a `(flowName, platform, goal)` tuple. */\nexport function buildReplayCacheKey(flowName: string, platform: string, goal: string): string {\n const hash = createHash(\"sha256\")\n .update(`${flowName}\\0${platform}\\0${goal.trim()}`)\n .digest(\"hex\")\n .slice(0, 16);\n const slug = flowName\n .toLowerCase()\n .replaceAll(/[^a-z0-9]+/g, \"-\")\n .replaceAll(/^-|-$/g, \"\")\n .slice(0, 40);\n return `${slug || \"flow\"}-${platform}-${hash}`;\n}\n\n/** Disk-backed replay cache store (default directory: `.spana/cache`). */\nexport class ReplayCacheStore {\n readonly cacheDir: string;\n\n constructor(cacheDir: string = \".spana/cache\") {\n this.cacheDir = cacheDir;\n }\n\n private filePath(key: string): string {\n return join(this.cacheDir, `${key}.json`);\n }\n\n get(key: string): ReplayCacheEntry | null {\n const p = this.filePath(key);\n if (!existsSync(p)) return null;\n try {\n const raw = readFileSync(p, \"utf-8\");\n const parsed = JSON.parse(raw) as ReplayCacheEntry;\n if (parsed.schemaVersion !== 1 || !Array.isArray(parsed.actions)) return null;\n return parsed;\n } catch {\n return null;\n }\n }\n\n set(entry: ReplayCacheEntry): void {\n const p = this.filePath(entry.key);\n mkdirSync(dirname(p), { recursive: true });\n writeFileSync(p, JSON.stringify(entry, null, 2), \"utf-8\");\n }\n\n delete(key: string): boolean {\n const p = this.filePath(key);\n if (!existsSync(p)) return false;\n rmSync(p, { force: true });\n return true;\n }\n}\n\n/** Execute a single recorded deterministic action against `PromiseApp`. */\nexport async function replayRecordedAction(app: PromiseApp, action: RecordedAction): Promise<void> {\n switch (action.kind) {\n case \"tap\":\n await app.tap(action.selector);\n break;\n case \"doubleTap\":\n await app.doubleTap(action.selector);\n break;\n case \"longPress\":\n await app.longPress(action.selector);\n break;\n case \"inputText\":\n await app.inputText(action.text);\n break;\n case \"pressKey\":\n await app.pressKey(action.key);\n break;\n case \"scroll\":\n await app.scroll(action.direction);\n break;\n case \"scrollUntilVisible\":\n await app.scrollUntilVisible(action.selector);\n break;\n case \"openLink\":\n await app.openLink(action.url);\n break;\n }\n}\n\nexport interface ReplaySessionOptions {\n flowName: string;\n platform: string;\n app: PromiseApp;\n store?: ReplayCacheStore;\n mode?: ReplayCacheMode;\n executor?: AgentActExecutor;\n}\n\n/**\n * Verified Replay Cache session inspired by `e2e-inc/e2e`:\n *\n * - On cache hit: replays deterministic `{ testID }` / `systemUI()` actions with ZERO LLM calls.\n * - In `strict` mode (`--strict-cache`): fails deterministically if a recording is missing or no longer matches.\n * - In `read-write` mode: hands off to `executor` on miss or mismatch (self-healing), and ONLY commits\n * new/healed recordings to `.spana/cache/` after `markVerified(verifierName)` is called by a real assertion!\n */\nexport class ReplaySession {\n private readonly flowName: string;\n private readonly platform: string;\n private readonly app: PromiseApp;\n private readonly store: ReplayCacheStore;\n private readonly mode: ReplayCacheMode;\n private readonly executor?: AgentActExecutor;\n\n private pendingWrites: Array<{\n entry: ReplayCacheEntry;\n outcomeIndex: number;\n wasExisting: boolean;\n }> = [];\n private replayedKeys: Array<{ key: string; outcomeIndex: number }> = [];\n private outcomes: ReplayStepOutcome[] = [];\n\n constructor(options: ReplaySessionOptions) {\n this.flowName = options.flowName;\n this.platform = options.platform;\n this.app = options.app;\n this.store = options.store ?? new ReplayCacheStore();\n this.mode = options.mode ?? \"read-write\";\n this.executor = options.executor;\n }\n\n /** Execute a natural-language goal using replay cache first, falling back to `executor`. */\n async act(goal: string): Promise<ReplayStepOutcome> {\n const key = buildReplayCacheKey(this.flowName, this.platform, goal);\n const cached = this.mode === \"off\" ? null : this.store.get(key);\n\n // 1. Try deterministic replay first (zero LLM calls)\n if (cached && cached.actions.length > 0) {\n try {\n for (const action of cached.actions) {\n await replayRecordedAction(this.app, action);\n }\n const outcome: ReplayStepOutcome = {\n goal,\n key,\n status: \"replayed\",\n writeStatus: \"kept\",\n actionCount: cached.actions.length,\n };\n const idx = this.outcomes.push(outcome) - 1;\n this.replayedKeys.push({ key, outcomeIndex: idx });\n return outcome;\n } catch (err) {\n const errMsg = err instanceof Error ? err.message : String(err);\n if (this.mode === \"strict\") {\n throw new Error(\n `Strict replay cache mismatch for \"${goal}\" (${key}): ${errMsg}. Re-run locally without --strict-cache to self-heal and update .spana/cache/.`,\n { cause: err },\n );\n }\n // Hand off to executor for self-healing\n return this.runLiveAndQueue(goal, key, true, errMsg);\n }\n }\n\n // 2. Cache miss\n if (this.mode === \"strict\") {\n throw new Error(\n `Strict replay cache miss for \"${goal}\" (${key}). No verified recording found in ${this.store.cacheDir}.`,\n );\n }\n\n return this.runLiveAndQueue(goal, key, false);\n }\n\n private async runLiveAndQueue(\n goal: string,\n key: string,\n wasExisting: boolean,\n handoffReason?: string,\n ): Promise<ReplayStepOutcome> {\n if (!this.executor) {\n throw new Error(\n `No agent executor configured for goal \"${goal}\" and no cached replay exists.`,\n );\n }\n\n const result = await this.executor.act({\n goal,\n app: this.app,\n handoffReason,\n });\n\n const outcome: ReplayStepOutcome = {\n goal,\n key,\n status: wasExisting ? \"handed-off\" : this.mode === \"off\" ? \"live\" : \"missed\",\n writeStatus: this.mode === \"off\" ? \"skipped\" : \"unconfirmed\",\n actionCount: result.actions.length,\n };\n const idx = this.outcomes.push(outcome) - 1;\n\n if (this.mode === \"read-write\" && result.actions.length > 0) {\n this.pendingWrites.push({\n wasExisting,\n outcomeIndex: idx,\n entry: {\n schemaVersion: 1,\n key,\n goal,\n flowName: this.flowName,\n platform: this.platform,\n actions: result.actions,\n recordedAt: new Date().toISOString(),\n verifiedBy: \"\",\n },\n });\n }\n\n return outcome;\n }\n\n /**\n * Call when a real post-action assertion (`expect(...).toBeVisible()`, `toHaveText()`, etc.)\n * succeeds. Flushes all preceding pending recordings to disk in `read-write` mode.\n */\n markVerified(verifierName: string): number {\n if (this.mode !== \"read-write\") return 0;\n let saved = 0;\n for (const pending of this.pendingWrites) {\n pending.entry.verifiedBy = verifierName;\n this.store.set(pending.entry);\n this.outcomes[pending.outcomeIndex]!.writeStatus = \"saved\";\n saved += 1;\n }\n this.pendingWrites = [];\n return saved;\n }\n\n /**\n * Call when the flow attempt fails: evicts any replayed recordings involved in the\n * failure (in `read-write` mode) and discards unconfirmed recordings so broken paths\n * are never persisted.\n */\n markFailed(): number {\n let evicted = 0;\n if (this.mode === \"read-write\") {\n for (const replayed of this.replayedKeys) {\n if (this.store.delete(replayed.key)) {\n this.outcomes[replayed.outcomeIndex]!.writeStatus = \"evicted\";\n evicted += 1;\n }\n }\n for (const pending of this.pendingWrites) {\n if (pending.wasExisting && this.store.delete(pending.entry.key)) {\n this.outcomes[pending.outcomeIndex]!.writeStatus = \"evicted\";\n evicted += 1;\n }\n }\n }\n this.pendingWrites = [];\n this.replayedKeys = [];\n return evicted;\n }\n\n getOutcomes(): ReplayStepOutcome[] {\n return [...this.outcomes];\n }\n\n getSummary(): ReplayCacheSummary {\n const summary: ReplayCacheSummary = {\n replayed: 0,\n handedOff: 0,\n missed: 0,\n saved: 0,\n evicted: 0,\n unconfirmed: 0,\n };\n for (const o of this.outcomes) {\n if (o.status === \"replayed\") summary.replayed++;\n else if (o.status === \"handed-off\") summary.handedOff++;\n else if (o.status === \"missed\") summary.missed++;\n\n if (o.writeStatus === \"saved\") summary.saved++;\n else if (o.writeStatus === \"evicted\") summary.evicted++;\n else if (o.writeStatus === \"unconfirmed\") summary.unconfirmed++;\n }\n return summary;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmEO,SAAS,KACd,MACA,YACA,SACsB;AACtB,MAAI,OAAO,eAAe,YAAY;AACpC,WAAO,EAAE,MAAM,IAAI,YAAY,QAAQ,CAAC,EAAE;AAAA,EAC5C;AACA,SAAO,EAAE,MAAM,IAAI,SAAU,QAAQ,WAAW;AAClD;;;AC5EA,SAAS,cAAc;AAEhB,IAAM,SAAS,OAAO,OAAO;AAAA,EAClC,GAAG,OAAO;AAAA,EACV,GAAG,OAAO;AAAA,EACV,OAAO,OAAO;AAAA,EACd,QAAQ,OAAO;AACjB,CAAC;AAGM,IAAM,UAAU,OAAO,OAAO;AAAA,EACnC,IAAI,OAAO,SAAS,OAAO,MAAM;AAAA,EACjC,MAAM,OAAO,SAAS,OAAO,MAAM;AAAA,EACnC,OAAO,OAAO,SAAS,OAAO,MAAM;AAAA,EACpC,oBAAoB,OAAO,SAAS,OAAO,MAAM;AAAA,EACjD,YAAY,OAAO,SAAS,OAAO,MAAM;AAAA,EACzC,aAAa,OAAO,SAAS,OAAO,MAAM;AAAA,EAC1C,QAAQ;AAAA,EACR,SAAS,OAAO,SAAS,OAAO,OAAO;AAAA,EACvC,SAAS,OAAO,SAAS,OAAO,OA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AAAA,EACT;AAAA,EAEA,cAAmC;AACjC,WAAO,CAAC,GAAG,KAAK,QAAQ;AAAA,EAC1B;AAAA,EAEA,aAAiC;AAC/B,UAAM,UAA8B;AAAA,MAClC,UAAU;AAAA,MACV,WAAW;AAAA,MACX,QAAQ;AAAA,MACR,OAAO;AAAA,MACP,SAAS;AAAA,MACT,aAAa;AAAA,IACf;AACA,eAAW,KAAK,KAAK,UAAU;AAC7B,UAAI,EAAE,WAAW,WAAY,SAAQ;AAAA,eAC5B,EAAE,WAAW,aAAc,SAAQ;AAAA,eACnC,EAAE,WAAW,SAAU,SAAQ;AAExC,UAAI,EAAE,gBAAgB,QAAS,SAAQ;AAAA,eAC9B,EAAE,gBAAgB,UAAW,SAAQ;AAAA,eACrC,EAAE,gBAAgB,cAAe,SAAQ;AAAA,IACpD;AACA,WAAO;AAAA,EACT;AACF;","names":["Schema"]}
|
|
1
|
+
{"version":3,"sources":["../src/api/flow.ts","../src/schemas/element.ts","../src/schemas/device.ts","../src/api/fixtures.ts","../src/core/replay-cache.ts","../src/core/worker-pool.ts"],"sourcesContent":["import type { ExtendedSelector, Platform } from \"../schemas/selector.js\";\nimport type { ArtifactConfig } from \"../schemas/config.js\";\nimport type { LaunchOptions } from \"../drivers/raw-driver.js\";\nimport type { PromiseApp } from \"./app.js\";\nimport type { PromiseExpectation } from \"./expect.js\";\nimport type { Sessions } from \"../core/session-manager.js\";\n\nexport interface WhenCondition {\n /** Only run on these platforms */\n platform?: Platform | Platform[];\n /** Only run when this environment variable is set */\n env?: string;\n}\n\nexport interface FlowDefaults {\n waitTimeout?: number;\n pollInterval?: number;\n settleTimeout?: number;\n waitForIdleTimeout?: number;\n typingDelay?: number;\n /** Starting poll interval for adaptive backoff. Default: 50ms. */\n initialPollInterval?: number;\n /** Hierarchy cache TTL in ms. Default: 100. Set to 0 to disable. */\n hierarchyCacheTtl?: number;\n}\n\nexport interface FlowConfig<R extends string = string> {\n tags?: string[];\n platforms?: Platform[];\n timeout?: number;\n autoLaunch?: boolean; // default true\n /** Per-flow launch defaults. Merged with project launchOptions and manual app.launch() calls. */\n launchOptions?: LaunchOptions<R>;\n artifacts?: ArtifactConfig;\n when?: WhenCondition;\n /** Per-flow overrides for timing defaults. Merged with global defaults. */\n defaults?: FlowDefaults;\n}\n\nexport interface FlowContext<T extends string = string, R extends string = string> {\n app: PromiseApp<T, R>;\n expect: (selector: ExtendedSelector<T>) => PromiseExpectation<T>;\n platform: Platform;\n sessions: Sessions;\n}\n\nexport type FlowFn<T extends string = string, R extends string = string> = (\n ctx: FlowContext<T, R>,\n) => Promise<void>;\n\nexport interface FlowDefinition<T extends string = string, R extends string = string> {\n name: string;\n fn: FlowFn<T, R>;\n config: FlowConfig<R>;\n sourcePath?: string;\n}\n\n// Overloads: flow(name, fn) and flow(name, config, fn)\nexport function flow<T extends string = string, R extends string = string>(\n name: string,\n fn: FlowFn<T, R>,\n): FlowDefinition<T, R>;\nexport function flow<T extends string = string, R extends string = string>(\n name: string,\n config: FlowConfig<R>,\n fn: FlowFn<T, R>,\n): FlowDefinition<T, R>;\nexport function flow<T extends string = string, R extends string = string>(\n name: string,\n configOrFn: FlowConfig<R> | FlowFn<T, R>,\n maybeFn?: FlowFn<T, R>,\n): FlowDefinition<T, R> {\n if (typeof configOrFn === \"function\") {\n return { name, fn: configOrFn, config: {} };\n }\n return { name, fn: maybeFn!, config: configOrFn };\n}\n\n/** Helper to create a typed flow function for your project. */\nexport function createFlow<T extends string = string, R extends string = string>() {\n return flow<T, R>;\n}\n","import { Schema } from \"effect\";\n\nexport const Bounds = Schema.Struct({\n x: Schema.Number,\n y: Schema.Number,\n width: Schema.Number,\n height: Schema.Number,\n});\nexport type Bounds = typeof Bounds.Type;\n\nexport const Element = Schema.Struct({\n id: Schema.optional(Schema.String),\n text: Schema.optional(Schema.String),\n value: Schema.optional(Schema.String),\n accessibilityLabel: Schema.optional(Schema.String),\n resourceId: Schema.optional(Schema.String),\n elementType: Schema.optional(Schema.String),\n bounds: Bounds,\n enabled: Schema.optional(Schema.Boolean),\n visible: Schema.optional(Schema.Boolean),\n clickable: Schema.optional(Schema.Boolean),\n focused: Schema.optional(Schema.Boolean),\n attributes: Schema.optional(Schema.Record({ key: Schema.String, value: Schema.String })),\n children: Schema.optional(\n Schema.Array(Schema.suspend((): Schema.Schema<any, any, never> => Element)),\n ),\n});\nexport type Element = typeof Element.Type;\n\nexport const ViewHierarchy = Schema.Struct({\n root: Element,\n timestamp: Schema.Number,\n});\nexport type ViewHierarchy = typeof ViewHierarchy.Type;\n","import { Schema } from \"effect\";\n\nexport const DeviceInfo = Schema.Struct({\n platform: Schema.Literal(\"android\", \"ios\", \"web\", \"electron\", \"electrobun\"),\n deviceId: Schema.String,\n name: Schema.String,\n isEmulator: Schema.Boolean,\n screenWidth: Schema.Number,\n screenHeight: Schema.Number,\n driverType: Schema.Literal(\n \"playwright\",\n \"uiautomator2\",\n \"wda\",\n \"appium\",\n \"electron\",\n \"electrobun\",\n ),\n});\nexport type DeviceInfo = typeof DeviceInfo.Type;\n","import type { DomClearStorageOptions, DomStorageEntries } from \"../channels/dom-channel.js\";\nimport type { FlowConfig, FlowContext, FlowDefinition } from \"./flow.js\";\nimport type { PromiseApp } from \"./app.js\";\n\n/**\n * Declarative named setup state (e.g. `\"admin\"`, `\"authenticated\"`, `\"seeded-cart\"`).\n * Automatically uses `spana-bridge` storage injection on mobile/desktop/bridge-web\n * and Playwright `loadAuthState` / `evaluate` on web.\n */\nexport interface NamedSetupDefinition<T extends string = string, R extends string = string> {\n name: string;\n /** Clear storage before restoring state (default: true). */\n clearBefore?: boolean | DomClearStorageOptions;\n /** Storage entries injected via `app.setStorage(...)` (localStorage/sessionStorage/cookies/Preferences). */\n storage?: DomStorageEntries;\n /** Optional Playwright storageState JSON file path for web runs. */\n storageStatePath?: string;\n /** Optional URL/route to navigate to after injecting state (or `reload` when omitted and storage was injected). */\n navigateTo?: R;\n /** Whether to reload the WebView/page after injecting storage when `navigateTo` is omitted (default: true). */\n reloadAfterStorage?: boolean;\n /** Optional custom setup hook for seeding API state or performing extra actions. */\n run?: (ctx: FlowContext<T, R>) => Promise<void>;\n}\n\n/** Define a reusable named setup state for `{ session: \"<name>\" }` flows. */\nexport function defineSetup<T extends string = string, R extends string = string>(\n name: string,\n config: Omit<NamedSetupDefinition<T, R>, \"name\">,\n): NamedSetupDefinition<T, R> {\n return { name, ...config };\n}\n\n/** Apply a named setup state to the active `FlowContext`. */\nexport async function applyNamedSetup<T extends string = string, R extends string = string>(\n setup: NamedSetupDefinition<T, R>,\n ctx: FlowContext<T, R>,\n): Promise<void> {\n const app = ctx.app as PromiseApp<T, R>;\n\n if (setup.storageStatePath && ctx.platform === \"web\") {\n await app.loadAuthState(setup.storageStatePath);\n }\n\n if (setup.clearBefore !== false && setup.storage) {\n const clearOpts = typeof setup.clearBefore === \"object\" ? setup.clearBefore : undefined;\n try {\n await app.clearStorage(clearOpts);\n } catch {\n // Fallback for plain web without spana-bridge\n if (ctx.platform === \"web\") {\n await app.evaluate(\"localStorage.clear(); sessionStorage.clear();\");\n }\n }\n }\n\n if (setup.storage) {\n try {\n await app.setStorage(setup.storage);\n } catch {\n // Fallback for web without spana-bridge\n if (ctx.platform === \"web\") {\n const serialized = JSON.stringify(setup.storage);\n await app.evaluate(\n `(() => { const entries = ${serialized}; if (entries.localStorage) { for (const [k, v] of Object.entries(entries.localStorage)) localStorage.setItem(k, v); } if (entries.sessionStorage) { for (const [k, v] of Object.entries(entries.sessionStorage)) sessionStorage.setItem(k, v); } })()`,\n );\n } else {\n throw new Error(\n `Named setup \"${setup.name}\" requires spana-bridge or a DOM channel to inject storage on ${ctx.platform}.`,\n );\n }\n }\n\n if (setup.navigateTo) {\n await app.openLink(setup.navigateTo);\n } else if (setup.reloadAfterStorage !== false) {\n try {\n await app.resetFast();\n } catch {\n if (ctx.platform === \"web\") {\n await app.evaluate(\"window.location.reload();\");\n }\n }\n }\n } else if (setup.navigateTo) {\n await app.openLink(setup.navigateTo);\n }\n\n if (setup.run) {\n await setup.run(ctx);\n }\n}\n\n// ── Composable Lazy Fixtures ────────────────────────────────────────────────\n\nexport type FixtureFn<\n Value,\n Deps extends Record<string, unknown>,\n T extends string = string,\n R extends string = string,\n> = (ctx: FlowContext<T, R> & Deps, use: (value: Value) => Promise<void>) => Promise<void>;\n\nexport type FixtureDefinition<\n Value,\n Deps extends Record<string, unknown>,\n T extends string = string,\n R extends string = string,\n> =\n | FixtureFn<Value, Deps, T, R>\n | {\n setup: FixtureFn<Value, Deps, T, R>;\n /** When true, always runs for every flow even if not destructured. */\n auto?: boolean;\n /** Explicit fixture dependency names (optional — also inferred from parameter destructuring). */\n deps?: Array<keyof Deps & string>;\n };\n\nexport type FixtureMap<\n Fixtures extends Record<string, unknown>,\n T extends string = string,\n R extends string = string,\n> = {\n [K in keyof Fixtures]: FixtureDefinition<Fixtures[K], Omit<Fixtures, K>, T, R>;\n};\n\nexport interface ExtendedFlowConfig<\n R extends string = string,\n SessionName extends string = string,\n> extends FlowConfig<R> {\n /** Optional named setup state applied before any lazy fixtures run. */\n session?: SessionName;\n /** Optional explicit fixture names to activate (in addition to destructured params). */\n uses?: string[];\n}\n\n/**\n * Extract top-level destructured parameter names from the first argument of a function:\n * `async ({ app, project, task: t }) => ...` -> `[\"app\", \"project\", \"task\"]`\n */\nexport function extractDestructuredParamNames(fn: (...args: any[]) => unknown): string[] {\n const src = fn.toString().trim();\n const openParen = src.indexOf(\"(\");\n if (openParen < 0) return [];\n\n // Find first parameter token\n let i = openParen + 1;\n while (i < src.length && /\\s/.test(src[i]!)) i++;\n if (src[i] !== \"{\") return [];\n\n // Extract balanced `{ ... }`\n let depth = 0;\n const start = i + 1;\n let end = -1;\n for (; i < src.length; i++) {\n const ch = src[i];\n if (ch === \"{\") depth++;\n else if (ch === \"}\") {\n depth--;\n if (depth === 0) {\n end = i;\n break;\n }\n }\n }\n if (end < 0) return [];\n\n const inner = src.slice(start, end);\n const names: string[] = [];\n // Split top-level commas only (ignore nested destructuring/defaults)\n let token = \"\";\n let nested = 0;\n for (let j = 0; j < inner.length; j++) {\n const ch = inner[j]!;\n if (ch === \"{\" || ch === \"[\" || ch === \"(\") nested++;\n else if (ch === \"}\" || ch === \"]\" || ch === \")\") nested--;\n else if (ch === \",\" && nested === 0) {\n const parsed = parseDestructuredKey(token);\n if (parsed) names.push(parsed);\n token = \"\";\n continue;\n }\n token += ch;\n }\n const last = parseDestructuredKey(token);\n if (last) names.push(last);\n return names;\n}\n\nfunction parseDestructuredKey(raw: string): string | null {\n const cleaned = raw.trim();\n if (!cleaned || cleaned.startsWith(\"...\")) return null;\n // Strip default value (`foo = 1`) and alias (`foo: bar`)\n const keyMatch = cleaned.match(/^([A-Za-z_$][A-Za-z0-9_$]*)/);\n return keyMatch?.[1] ?? null;\n}\n\ninterface NormalizedFixture<T extends string, R extends string> {\n name: string;\n setup: FixtureFn<unknown, Record<string, unknown>, T, R>;\n auto: boolean;\n deps: string[];\n}\n\nexport interface CreateFixturesOptions<\n Fixtures extends Record<string, unknown>,\n SessionName extends string = string,\n T extends string = string,\n R extends string = string,\n> {\n fixtures?: FixtureMap<Fixtures, T, R>;\n setups?: Record<SessionName, NamedSetupDefinition<T, R>>;\n}\n\n/**\n * Create a `flow()` builder enhanced with lazy composable fixtures and named\n * setup states (`{ session: \"admin\" }`), inspired by Playwright and `e2e`.\n *\n * - Fixtures only run when destructured by the flow (or marked `{ auto: true }`).\n * - Fixtures can depend on other fixtures; cycles are detected immediately.\n * - Teardown runs in strict reverse (LIFO) order even when the flow throws.\n */\nexport function createFlowWithFixtures<\n Fixtures extends Record<string, unknown> = Record<string, never>,\n SessionName extends string = string,\n T extends string = string,\n R extends string = string,\n>(options: CreateFixturesOptions<Fixtures, SessionName, T, R>) {\n const fixtureMap = new Map<string, NormalizedFixture<T, R>>();\n const rawFixtures = options.fixtures ?? ({} as FixtureMap<Fixtures, T, R>);\n const setups = (options.setups ?? {}) as Record<string, NamedSetupDefinition<T, R>>;\n\n for (const [name, def] of Object.entries(rawFixtures)) {\n const fn = typeof def === \"function\" ? def : def.setup;\n const auto = typeof def === \"function\" ? false : Boolean(def.auto);\n const explicitDeps = typeof def === \"function\" ? undefined : def.deps;\n const inferredDeps = explicitDeps ?? extractDestructuredParamNames(fn);\n fixtureMap.set(name, { name, setup: fn, auto, deps: inferredDeps });\n }\n\n function resolveFixtureOrder(requested: string[]): NormalizedFixture<T, R>[] {\n const ordered: NormalizedFixture<T, R>[] = [];\n const visiting = new Set<string>();\n const visited = new Set<string>();\n\n const visit = (name: string) => {\n if (visited.has(name)) return;\n const fix = fixtureMap.get(name);\n if (!fix) return;\n if (visiting.has(name)) {\n throw new Error(`Circular fixture dependency detected involving \"${name}\"`);\n }\n visiting.add(name);\n for (const dep of fix.deps) {\n if (fixtureMap.has(dep)) {\n visit(dep);\n }\n }\n visiting.delete(name);\n visited.add(name);\n ordered.push(fix);\n };\n\n // Always run `auto: true` fixtures first\n for (const fix of fixtureMap.values()) {\n if (fix.auto) visit(fix.name);\n }\n for (const name of requested) {\n visit(name);\n }\n return ordered;\n }\n\n function extendedFlow(\n name: string,\n fn: (ctx: FlowContext<T, R> & Fixtures) => Promise<void>,\n ): FlowDefinition<T, R>;\n function extendedFlow(\n name: string,\n config: ExtendedFlowConfig<R, SessionName>,\n fn: (ctx: FlowContext<T, R> & Fixtures) => Promise<void>,\n ): FlowDefinition<T, R>;\n function extendedFlow(\n name: string,\n configOrFn:\n | ExtendedFlowConfig<R, SessionName>\n | ((ctx: FlowContext<T, R> & Fixtures) => Promise<void>),\n maybeFn?: (ctx: FlowContext<T, R> & Fixtures) => Promise<void>,\n ): FlowDefinition<T, R> {\n const isFnOnly = typeof configOrFn === \"function\";\n const extConfig: ExtendedFlowConfig<R, SessionName> = isFnOnly ? {} : configOrFn;\n const userFn = isFnOnly ? configOrFn : maybeFn!;\n\n const requestedNames = [\n ...(extConfig.uses ?? []),\n ...extractDestructuredParamNames(userFn).filter((n) => fixtureMap.has(n)),\n ];\n\n const wrappedFn = async (baseCtx: FlowContext<T, R>): Promise<void> => {\n // 1. Restore named session setup before fixtures run\n if (extConfig.session) {\n const setup = setups[extConfig.session];\n if (!setup) {\n throw new Error(\n `Unknown setup session \"${extConfig.session}\". Registered setups: ${\n Object.keys(setups).join(\", \") || \"(none)\"\n }`,\n );\n }\n await applyNamedSetup(setup, baseCtx);\n }\n\n // 2. Resolve lazy fixture graph & run nested setup -> use -> LIFO teardown\n const orderedFixtures = resolveFixtureOrder(requestedNames);\n const mergedCtx: Record<string, unknown> = { ...baseCtx };\n\n const runChain = async (idx: number): Promise<void> => {\n if (idx >= orderedFixtures.length) {\n await userFn(mergedCtx as FlowContext<T, R> & Fixtures);\n return;\n }\n const fix = orderedFixtures[idx]!;\n let useCalled = false;\n let flowError: unknown;\n let hasFlowError = false;\n\n await fix.setup(mergedCtx as FlowContext<T, R> & Record<string, unknown>, async (val) => {\n useCalled = true;\n mergedCtx[fix.name] = val;\n try {\n await runChain(idx + 1);\n } catch (err) {\n flowError = err;\n hasFlowError = true;\n }\n });\n\n if (!useCalled) {\n throw new Error(`Fixture \"${fix.name}\" finished without calling use(value).`);\n }\n if (hasFlowError) {\n throw flowError;\n }\n };\n\n await runChain(0);\n };\n\n const { session: _session, uses: _uses, ...baseFlowConfig } = extConfig;\n return {\n name,\n config: baseFlowConfig,\n fn: wrappedFn,\n };\n }\n\n return extendedFlow;\n}\n\n// ── First-Class API Setup Client & Per-Persona Auth Cache ───────────────────\n\nexport interface ApiClientOptions {\n /** Base URL for API/test-control endpoints (e.g. `\"http://localhost:3000/api\"`). */\n baseUrl: string;\n /** Default headers attached to every request (e.g. `{ Authorization: \"Bearer ...\" }`). */\n headers?: Record<string, string>;\n /** Optional custom fetch implementation for testing. */\n fetchFn?: typeof fetch;\n}\n\nexport interface ApiRequestOptions {\n headers?: Record<string, string>;\n query?: Record<string, string | number | boolean | undefined>;\n signal?: AbortSignal;\n}\n\nexport interface ApiResponse<T = unknown> {\n status: number;\n ok: boolean;\n headers: Headers;\n data: T;\n}\n\nexport interface ApiClient {\n get<T = unknown>(path: string, opts?: ApiRequestOptions): Promise<ApiResponse<T>>;\n post<T = unknown>(\n path: string,\n body?: unknown,\n opts?: ApiRequestOptions,\n ): Promise<ApiResponse<T>>;\n put<T = unknown>(path: string, body?: unknown, opts?: ApiRequestOptions): Promise<ApiResponse<T>>;\n patch<T = unknown>(\n path: string,\n body?: unknown,\n opts?: ApiRequestOptions,\n ): Promise<ApiResponse<T>>;\n delete<T = unknown>(path: string, opts?: ApiRequestOptions): Promise<ApiResponse<T>>;\n /** Register an automatic teardown callback (runs in strict LIFO order on `cleanup()`). */\n onCleanup(fn: () => Promise<void> | void): void;\n /** Run all registered cleanup callbacks in reverse (LIFO) order and clear the queue. */\n cleanup(): Promise<void>;\n}\n\n/**\n * First-class HTTP client for seeding and tearing down test data via API/test-control\n * endpoints inside Spana flows and lazy fixtures (far faster than UI setup).\n */\nexport function createApiClient(options: ApiClientOptions): ApiClient {\n const baseUrl = options.baseUrl.replace(/\\/+$/, \"\");\n const defaultHeaders = options.headers ?? {};\n const fetchFn = options.fetchFn ?? fetch;\n const cleanups: Array<() => Promise<void> | void> = [];\n\n const request = async <T = unknown>(\n method: string,\n path: string,\n body?: unknown,\n opts?: ApiRequestOptions,\n ): Promise<ApiResponse<T>> => {\n const cleanPath =\n path.startsWith(\"http://\") || path.startsWith(\"https://\")\n ? path\n : `${baseUrl}/${path.replace(/^\\/+/, \"\")}`;\n const url = new URL(cleanPath);\n if (opts?.query) {\n for (const [k, v] of Object.entries(opts.query)) {\n if (v !== undefined) url.searchParams.set(k, String(v));\n }\n }\n\n const headers: Record<string, string> = {\n ...defaultHeaders,\n ...(body !== undefined ? { \"content-type\": \"application/json\" } : {}),\n ...opts?.headers,\n };\n\n const res = await fetchFn(url.toString(), {\n method,\n headers,\n ...(body !== undefined\n ? { body: typeof body === \"string\" ? body : JSON.stringify(body) }\n : {}),\n ...(opts?.signal ? { signal: opts.signal } : {}),\n });\n\n const contentType = res.headers.get(\"content-type\") ?? \"\";\n let data: unknown;\n if (contentType.includes(\"application/json\")) {\n data = await res.json().catch(() => null);\n } else {\n const text = await res.text().catch(() => \"\");\n try {\n data = text ? JSON.parse(text) : text;\n } catch {\n data = text;\n }\n }\n\n return {\n status: res.status,\n ok: res.ok,\n headers: res.headers,\n data: data as T,\n };\n };\n\n return {\n get: <T = unknown>(path: string, opts?: ApiRequestOptions) =>\n request<T>(\"GET\", path, undefined, opts),\n post: <T = unknown>(path: string, body?: unknown, opts?: ApiRequestOptions) =>\n request<T>(\"POST\", path, body, opts),\n put: <T = unknown>(path: string, body?: unknown, opts?: ApiRequestOptions) =>\n request<T>(\"PUT\", path, body, opts),\n patch: <T = unknown>(path: string, body?: unknown, opts?: ApiRequestOptions) =>\n request<T>(\"PATCH\", path, body, opts),\n delete: <T = unknown>(path: string, opts?: ApiRequestOptions) =>\n request<T>(\"DELETE\", path, undefined, opts),\n onCleanup: (fn) => {\n cleanups.push(fn);\n },\n cleanup: async () => {\n const pending = cleanups.splice(0, cleanups.length).toReversed();\n const errors: unknown[] = [];\n for (const fn of pending) {\n try {\n await fn();\n } catch (err) {\n errors.push(err);\n }\n }\n if (errors.length > 0) {\n throw errors[0];\n }\n },\n };\n}\n\n/**\n * Convenience lazy fixture builder for `createFlowWithFixtures`:\n * provides a fresh `ApiClient` to each flow and automatically executes all\n * `api.onCleanup(...)` hooks in LIFO order even when the flow throws.\n */\nexport function createApiFixture<\n Deps extends Record<string, unknown> = Record<string, never>,\n T extends string = string,\n R extends string = string,\n>(\n options: ApiClientOptions | ((ctx: FlowContext<T, R> & Deps) => ApiClientOptions),\n): FixtureFn<ApiClient, Deps, T, R> {\n return async (ctx, use) => {\n const resolved = typeof options === \"function\" ? options(ctx) : options;\n const api = createApiClient(resolved);\n try {\n await use(api);\n } finally {\n await api.cleanup();\n }\n };\n}\n\nexport interface PersonaDefinition<T extends string = string, R extends string = string> {\n name: string;\n /** Sign in once (via API, virtual passkey, or UI) and return storage entries or a saved storageStatePath. */\n signIn: (\n ctx: FlowContext<T, R>,\n ) => Promise<{ storage?: DomStorageEntries; storageStatePath?: string } | void>;\n /** Optional cache key discriminator (e.g. base URL or tenant ID). */\n cacheKey?: string;\n /** Optional route to navigate to after restoring cached auth state. */\n navigateTo?: R;\n}\n\n/** Define a reusable authenticated persona for `PersonaAuthCache`. */\nexport function definePersona<T extends string = string, R extends string = string>(\n name: string,\n config: Omit<PersonaDefinition<T, R>, \"name\">,\n): PersonaDefinition<T, R> {\n return { name, ...config };\n}\n\nexport interface CachedPersonaState {\n storage?: DomStorageEntries;\n storageStatePath?: string;\n cachedAt: number;\n}\n\n/**\n * In-memory per-persona auth state cache (single-flight safe across parallel workers).\n * Signs a persona in ONCE (including passkey / WebAuthn flows), caches its auth state,\n * and restores it in milliseconds across all remaining flows.\n */\nexport class PersonaAuthCache {\n private readonly cache = new Map<string, CachedPersonaState>();\n private readonly inflight = new Map<string, Promise<CachedPersonaState>>();\n\n private keyFor(persona: PersonaDefinition<any, any>): string {\n return `${persona.name}::${persona.cacheKey ?? \"default\"}`;\n }\n\n get(name: string, cacheKey = \"default\"): CachedPersonaState | undefined {\n return this.cache.get(`${name}::${cacheKey}`);\n }\n\n invalidate(name?: string, cacheKey = \"default\"): void {\n if (!name) {\n this.cache.clear();\n return;\n }\n this.cache.delete(`${name}::${cacheKey}`);\n }\n\n /**\n * Ensure `persona` is authenticated in `ctx`. On cache miss, executes `persona.signIn(ctx)`\n * once (coalescing concurrent callers); on cache hit, restores cookies/storageState directly.\n */\n async authenticate<T extends string = string, R extends string = string>(\n persona: PersonaDefinition<T, R>,\n ctx: FlowContext<T, R>,\n ): Promise<CachedPersonaState> {\n const key = this.keyFor(persona);\n let state = this.cache.get(key);\n let wasMiss = false;\n\n if (!state) {\n wasMiss = true;\n let pending = this.inflight.get(key);\n if (!pending) {\n pending = (async () => {\n const produced = (await persona.signIn(ctx)) ?? {};\n const entry: CachedPersonaState = {\n storage: produced.storage,\n storageStatePath: produced.storageStatePath,\n cachedAt: Date.now(),\n };\n this.cache.set(key, entry);\n return entry;\n })().finally(() => {\n this.inflight.delete(key);\n });\n this.inflight.set(key, pending);\n }\n state = await pending;\n }\n\n const app = ctx.app as PromiseApp<T, R>;\n if (!wasMiss) {\n if (state.storageStatePath && ctx.platform === \"web\") {\n await app.loadAuthState(state.storageStatePath);\n }\n if (state.storage) {\n await app.setStorage(state.storage);\n }\n }\n if (persona.navigateTo) {\n await app.openLink(persona.navigateTo);\n }\n return state;\n }\n}\n","import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from \"node:fs\";\nimport { dirname, join } from \"node:path\";\nimport { createHash } from \"node:crypto\";\nimport type { ExtendedSelector } from \"../schemas/selector.js\";\nimport type { PromiseApp } from \"../api/app.js\";\n\n/** A deterministic action recorded from an `agent.act(goal)` execution. */\nexport type RecordedAction =\n | { kind: \"tap\"; selector: ExtendedSelector }\n | { kind: \"doubleTap\"; selector: ExtendedSelector }\n | { kind: \"longPress\"; selector: ExtendedSelector }\n | { kind: \"inputText\"; text: string }\n | { kind: \"pressKey\"; key: string }\n | { kind: \"scroll\"; direction: \"up\" | \"down\" | \"left\" | \"right\" }\n | { kind: \"scrollUntilVisible\"; selector: ExtendedSelector }\n | { kind: \"openLink\"; url: string };\n\nexport interface ReplayCacheEntry {\n schemaVersion: 1;\n key: string;\n goal: string;\n flowName: string;\n platform: string;\n actions: RecordedAction[];\n recordedAt: string;\n verifiedBy: string;\n}\n\nexport type ReplayCacheMode = \"read-write\" | \"strict\" | \"off\";\n\nexport type CacheWriteStatus = \"saved\" | \"kept\" | \"unconfirmed\" | \"evicted\" | \"skipped\";\n\nexport interface ReplayStepOutcome {\n goal: string;\n key: string;\n status: \"replayed\" | \"handed-off\" | \"missed\" | \"live\";\n writeStatus?: CacheWriteStatus;\n actionCount: number;\n error?: string;\n}\n\nexport interface ReplayCacheSummary {\n replayed: number;\n handedOff: number;\n missed: number;\n saved: number;\n evicted: number;\n unconfirmed: number;\n}\n\n/**\n * Pluggable agent executor called ONLY on cache miss or self-healing handoff.\n * Returns the deterministic list of actions it executed to achieve `goal`.\n */\nexport interface AgentActExecutor {\n act(input: {\n goal: string;\n app: PromiseApp;\n handoffReason?: string;\n }): Promise<{ actions: RecordedAction[] }>;\n}\n\n/** Compute a stable cache key for a `(flowName, platform, goal)` tuple. */\nexport function buildReplayCacheKey(flowName: string, platform: string, goal: string): string {\n const hash = createHash(\"sha256\")\n .update(`${flowName}\\0${platform}\\0${goal.trim()}`)\n .digest(\"hex\")\n .slice(0, 16);\n const slug = flowName\n .toLowerCase()\n .replaceAll(/[^a-z0-9]+/g, \"-\")\n .replaceAll(/^-|-$/g, \"\")\n .slice(0, 40);\n return `${slug || \"flow\"}-${platform}-${hash}`;\n}\n\n/** Disk-backed replay cache store (default directory: `.spana/cache`). */\nexport class ReplayCacheStore {\n readonly cacheDir: string;\n\n constructor(cacheDir: string = \".spana/cache\") {\n this.cacheDir = cacheDir;\n }\n\n private filePath(key: string): string {\n return join(this.cacheDir, `${key}.json`);\n }\n\n get(key: string): ReplayCacheEntry | null {\n const p = this.filePath(key);\n if (!existsSync(p)) return null;\n try {\n const raw = readFileSync(p, \"utf-8\");\n const parsed = JSON.parse(raw) as ReplayCacheEntry;\n if (parsed.schemaVersion !== 1 || !Array.isArray(parsed.actions)) return null;\n return parsed;\n } catch {\n return null;\n }\n }\n\n set(entry: ReplayCacheEntry): void {\n const p = this.filePath(entry.key);\n mkdirSync(dirname(p), { recursive: true });\n writeFileSync(p, JSON.stringify(entry, null, 2), \"utf-8\");\n }\n\n delete(key: string): boolean {\n const p = this.filePath(key);\n if (!existsSync(p)) return false;\n rmSync(p, { force: true });\n return true;\n }\n}\n\n/** Execute a single recorded deterministic action against `PromiseApp`. */\nexport async function replayRecordedAction(app: PromiseApp, action: RecordedAction): Promise<void> {\n switch (action.kind) {\n case \"tap\":\n await app.tap(action.selector);\n break;\n case \"doubleTap\":\n await app.doubleTap(action.selector);\n break;\n case \"longPress\":\n await app.longPress(action.selector);\n break;\n case \"inputText\":\n await app.inputText(action.text);\n break;\n case \"pressKey\":\n await app.pressKey(action.key);\n break;\n case \"scroll\":\n await app.scroll(action.direction);\n break;\n case \"scrollUntilVisible\":\n await app.scrollUntilVisible(action.selector);\n break;\n case \"openLink\":\n await app.openLink(action.url);\n break;\n }\n}\n\nexport interface ReplaySessionOptions {\n flowName: string;\n platform: string;\n app: PromiseApp;\n store?: ReplayCacheStore;\n mode?: ReplayCacheMode;\n executor?: AgentActExecutor;\n}\n\n/**\n * Verified Replay Cache session inspired by `e2e-inc/e2e`:\n *\n * - On cache hit: replays deterministic `{ testID }` / `systemUI()` actions with ZERO LLM calls.\n * - In `strict` mode (`--strict-cache`): fails deterministically if a recording is missing or no longer matches.\n * - In `read-write` mode: hands off to `executor` on miss or mismatch (self-healing), and ONLY commits\n * new/healed recordings to `.spana/cache/` after `markVerified(verifierName)` is called by a real assertion!\n */\nexport class ReplaySession {\n private readonly flowName: string;\n private readonly platform: string;\n private readonly app: PromiseApp;\n private readonly store: ReplayCacheStore;\n private readonly mode: ReplayCacheMode;\n private readonly executor?: AgentActExecutor;\n\n private pendingWrites: Array<{\n entry: ReplayCacheEntry;\n outcomeIndex: number;\n wasExisting: boolean;\n }> = [];\n private replayedKeys: Array<{ key: string; outcomeIndex: number }> = [];\n private outcomes: ReplayStepOutcome[] = [];\n\n constructor(options: ReplaySessionOptions) {\n this.flowName = options.flowName;\n this.platform = options.platform;\n this.app = options.app;\n this.store = options.store ?? new ReplayCacheStore();\n this.mode = options.mode ?? \"read-write\";\n this.executor = options.executor;\n }\n\n /** Execute a natural-language goal using replay cache first, falling back to `executor`. */\n async act(goal: string): Promise<ReplayStepOutcome> {\n const key = buildReplayCacheKey(this.flowName, this.platform, goal);\n const cached = this.mode === \"off\" ? null : this.store.get(key);\n\n // 1. Try deterministic replay first (zero LLM calls)\n if (cached && cached.actions.length > 0) {\n try {\n for (const action of cached.actions) {\n await replayRecordedAction(this.app, action);\n }\n const outcome: ReplayStepOutcome = {\n goal,\n key,\n status: \"replayed\",\n writeStatus: \"kept\",\n actionCount: cached.actions.length,\n };\n const idx = this.outcomes.push(outcome) - 1;\n this.replayedKeys.push({ key, outcomeIndex: idx });\n return outcome;\n } catch (err) {\n const errMsg = err instanceof Error ? err.message : String(err);\n if (this.mode === \"strict\") {\n throw new Error(\n `Strict replay cache mismatch for \"${goal}\" (${key}): ${errMsg}. Re-run locally without --strict-cache to self-heal and update .spana/cache/.`,\n { cause: err },\n );\n }\n // Hand off to executor for self-healing\n return this.runLiveAndQueue(goal, key, true, errMsg);\n }\n }\n\n // 2. Cache miss\n if (this.mode === \"strict\") {\n throw new Error(\n `Strict replay cache miss for \"${goal}\" (${key}). No verified recording found in ${this.store.cacheDir}.`,\n );\n }\n\n return this.runLiveAndQueue(goal, key, false);\n }\n\n private async runLiveAndQueue(\n goal: string,\n key: string,\n wasExisting: boolean,\n handoffReason?: string,\n ): Promise<ReplayStepOutcome> {\n if (!this.executor) {\n throw new Error(\n `No agent executor configured for goal \"${goal}\" and no cached replay exists.`,\n );\n }\n\n const result = await this.executor.act({\n goal,\n app: this.app,\n handoffReason,\n });\n\n const outcome: ReplayStepOutcome = {\n goal,\n key,\n status: wasExisting ? \"handed-off\" : this.mode === \"off\" ? \"live\" : \"missed\",\n writeStatus: this.mode === \"off\" ? \"skipped\" : \"unconfirmed\",\n actionCount: result.actions.length,\n };\n const idx = this.outcomes.push(outcome) - 1;\n\n if (this.mode === \"read-write\" && result.actions.length > 0) {\n this.pendingWrites.push({\n wasExisting,\n outcomeIndex: idx,\n entry: {\n schemaVersion: 1,\n key,\n goal,\n flowName: this.flowName,\n platform: this.platform,\n actions: result.actions,\n recordedAt: new Date().toISOString(),\n verifiedBy: \"\",\n },\n });\n }\n\n return outcome;\n }\n\n /**\n * Call when a real post-action assertion (`expect(...).toBeVisible()`, `toHaveText()`, etc.)\n * succeeds. Flushes all preceding pending recordings to disk in `read-write` mode.\n */\n markVerified(verifierName: string): number {\n if (this.mode !== \"read-write\") return 0;\n let saved = 0;\n for (const pending of this.pendingWrites) {\n pending.entry.verifiedBy = verifierName;\n this.store.set(pending.entry);\n this.outcomes[pending.outcomeIndex]!.writeStatus = \"saved\";\n saved += 1;\n }\n this.pendingWrites = [];\n return saved;\n }\n\n /**\n * Call when the flow attempt fails: evicts any replayed recordings involved in the\n * failure (in `read-write` mode) and discards unconfirmed recordings so broken paths\n * are never persisted.\n */\n markFailed(): number {\n let evicted = 0;\n if (this.mode === \"read-write\") {\n for (const replayed of this.replayedKeys) {\n if (this.store.delete(replayed.key)) {\n this.outcomes[replayed.outcomeIndex]!.writeStatus = \"evicted\";\n evicted += 1;\n }\n }\n for (const pending of this.pendingWrites) {\n if (pending.wasExisting && this.store.delete(pending.entry.key)) {\n this.outcomes[pending.outcomeIndex]!.writeStatus = \"evicted\";\n evicted += 1;\n }\n }\n }\n this.pendingWrites = [];\n this.replayedKeys = [];\n return evicted;\n }\n\n getOutcomes(): ReplayStepOutcome[] {\n return [...this.outcomes];\n }\n\n getSummary(): ReplayCacheSummary {\n const summary: ReplayCacheSummary = {\n replayed: 0,\n handedOff: 0,\n missed: 0,\n saved: 0,\n evicted: 0,\n unconfirmed: 0,\n };\n for (const o of this.outcomes) {\n if (o.status === \"replayed\") summary.replayed++;\n else if (o.status === \"handed-off\") summary.handedOff++;\n else if (o.status === \"missed\") summary.missed++;\n\n if (o.writeStatus === \"saved\") summary.saved++;\n else if (o.writeStatus === \"evicted\") summary.evicted++;\n else if (o.writeStatus === \"unconfirmed\") summary.unconfirmed++;\n }\n return summary;\n }\n}\n","import { spawn } from \"node:child_process\";\nimport { existsSync, readFileSync, unlinkSync } from \"node:fs\";\nimport type { TestResult } from \"./engine.js\";\n\nexport const DEFAULT_MAX_WORKERS_PER_PROCESS = 8;\n\nexport interface ProcessPartitionPlan {\n totalWorkers: number;\n maxWorkersPerProcess: number;\n processCount: number;\n workersPerProcess: number[];\n}\n\n/**\n * Plan how to split `totalWorkers` across OS processes.\n * - Up to `maxWorkersPerProcess` (default 8): 1 single in-process Bun event loop (zero IPC overhead).\n * - Above `maxWorkersPerProcess` (e.g. 16 or 32 workers on large CI boxes): evenly divides\n * workers across `Math.ceil(totalWorkers / maxWorkersPerProcess)` OS processes so each\n * process gets its own JS heap, GC, and event loop.\n */\nexport function planProcessPool(\n totalWorkers: number,\n maxWorkersPerProcess: number = DEFAULT_MAX_WORKERS_PER_PROCESS,\n): ProcessPartitionPlan {\n const safeTotal = Math.max(1, Math.floor(totalWorkers));\n const safeMax = Math.max(1, Math.floor(maxWorkersPerProcess));\n if (safeTotal <= safeMax) {\n return {\n totalWorkers: safeTotal,\n maxWorkersPerProcess: safeMax,\n processCount: 1,\n workersPerProcess: [safeTotal],\n };\n }\n\n const processCount = Math.ceil(safeTotal / safeMax);\n const base = Math.floor(safeTotal / processCount);\n const remainder = safeTotal % processCount;\n const workersPerProcess = Array.from(\n { length: processCount },\n (_v, i) => base + (i < remainder ? 1 : 0),\n );\n\n return {\n totalWorkers: safeTotal,\n maxWorkersPerProcess: safeMax,\n processCount,\n workersPerProcess,\n };\n}\n\n/**\n * Partition flows across `processCount` buckets using Longest-Processing-Time-First (LPT)\n * bin packing when `durationHintsMs` are available so every child process finishes together.\n */\nexport function partitionFlowsAcrossProcesses<T>(\n items: T[],\n processCount: number,\n options?: {\n durationHintsMs?: Record<string, number>;\n getName?: (item: T) => string;\n },\n): T[][] {\n const count = Math.max(1, Math.min(Math.floor(processCount), Math.max(1, items.length)));\n if (count === 1 || items.length === 0) {\n return items.length === 0 ? [] : [items];\n }\n\n const hints = options?.durationHintsMs;\n const getName = options?.getName;\n const known = hints ? Object.values(hints).filter((v) => typeof v === \"number\" && v > 0) : [];\n const defaultWeight = known.length > 0 ? known.reduce((a, b) => a + b, 0) / known.length : 1000;\n\n const indexed = items.map((item, idx) => ({\n item,\n idx,\n weight: hints && getName ? (hints[getName(item)] ?? defaultWeight) : 1000,\n }));\n\n const ordered =\n hints && getName && Object.keys(hints).length > 0\n ? indexed.toSorted((a, b) => b.weight - a.weight || a.idx - b.idx)\n : indexed;\n\n const loads = Array.from({ length: count }, () => 0);\n const buckets: Array<Array<{ item: T; idx: number }>> = Array.from({ length: count }, () => []);\n\n for (const entry of ordered) {\n let best = 0;\n for (let i = 1; i < count; i++) {\n if (loads[i]! < loads[best]!) best = i;\n }\n loads[best] = loads[best]! + entry.weight;\n buckets[best]!.push({ item: entry.item, idx: entry.idx });\n }\n\n return buckets\n .map((bucket) => bucket.toSorted((a, b) => a.idx - b.idx).map((e) => e.item))\n .filter((b) => b.length > 0);\n}\n\nexport interface ProcessShardCommand {\n command: string;\n args: string[];\n env?: Record<string, string>;\n reportJsonPath: string;\n}\n\nexport interface ProcessShardOutcome {\n shardIndex: number;\n workerCount: number;\n exitCode: number | null;\n durationMs: number;\n results: TestResult[];\n error?: string;\n}\n\nexport interface MultiProcessPoolOptions {\n totalWorkers: number;\n maxWorkersPerProcess?: number;\n buildShardCommand: (\n shardIndex: number,\n shardTotal: number,\n workerCount: number,\n ) => ProcessShardCommand;\n spawnFn?: typeof spawn;\n readReportFn?: (reportJsonPath: string) => TestResult[];\n cleanupReportFiles?: boolean;\n}\n\nexport interface MultiProcessPoolResult {\n results: TestResult[];\n totalDurationMs: number;\n passed: number;\n failed: number;\n skipped: number;\n flaky: number;\n processCount: number;\n processResults: ProcessShardOutcome[];\n}\n\nfunction defaultReadJsonReport(reportJsonPath: string): TestResult[] {\n if (!existsSync(reportJsonPath)) return [];\n const raw = JSON.parse(readFileSync(reportJsonPath, \"utf8\")) as {\n results?: TestResult[];\n };\n return Array.isArray(raw.results) ? raw.results : [];\n}\n\n/**\n * Execute a high-concurrency suite (16–32+ workers) across multiple OS worker processes,\n * each running up to `maxWorkersPerProcess` in-process workers with its own JS heap & event loop.\n */\nexport async function runMultiProcessPool(\n options: MultiProcessPoolOptions,\n): Promise<MultiProcessPoolResult> {\n const plan = planProcessPool(options.totalWorkers, options.maxWorkersPerProcess);\n const spawnFn = options.spawnFn ?? spawn;\n const readReport = options.readReportFn ?? defaultReadJsonReport;\n const shouldCleanup = options.cleanupReportFiles !== false;\n const startedAt = Date.now();\n\n const processResults = await Promise.all(\n plan.workersPerProcess.map(async (workerCount, shardIdx): Promise<ProcessShardOutcome> => {\n const shardStart = Date.now();\n const spec = options.buildShardCommand(shardIdx + 1, plan.processCount, workerCount);\n\n let exitCode: number | null = null;\n let spawnError: string | undefined;\n\n try {\n exitCode = await new Promise<number | null>((resolve, reject) => {\n const child = spawnFn(spec.command, spec.args, {\n env: { ...process.env, ...spec.env },\n stdio: \"inherit\",\n });\n child.on(\"error\", reject);\n child.on(\"close\", (code) => resolve(code));\n });\n } catch (err) {\n spawnError = err instanceof Error ? err.message : String(err);\n }\n\n let shardResults: TestResult[] = [];\n try {\n shardResults = readReport(spec.reportJsonPath);\n } catch (err) {\n if (!spawnError) {\n spawnError = `Failed to parse shard ${shardIdx + 1} report: ${err instanceof Error ? err.message : String(err)}`;\n }\n }\n\n if (shouldCleanup) {\n try {\n if (existsSync(spec.reportJsonPath)) unlinkSync(spec.reportJsonPath);\n } catch {\n // ignore cleanup failure\n }\n }\n\n if (exitCode !== 0 && shardResults.length === 0) {\n shardResults.push({\n name: `worker-process-${shardIdx + 1}`,\n platform: \"web\",\n status: \"failed\",\n durationMs: Date.now() - shardStart,\n error: {\n category: \"driver-error\",\n message:\n spawnError ??\n `Worker process ${shardIdx + 1} exited with code ${exitCode ?? \"unknown\"}`,\n },\n });\n }\n\n return {\n shardIndex: shardIdx + 1,\n workerCount,\n exitCode,\n durationMs: Date.now() - shardStart,\n results: shardResults,\n ...(spawnError ? { error: spawnError } : {}),\n };\n }),\n );\n\n const results = processResults.flatMap((p) => p.results);\n const passed = results.filter((r) => r.status === \"passed\").length;\n const failed = results.filter((r) => r.status === \"failed\").length;\n const skipped = results.filter((r) => r.status === \"skipped\").length;\n const flaky = results.filter((r) => r.flaky).length;\n\n return {\n results,\n totalDurationMs: Date.now() - startedAt,\n pass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|
4
4
|
import "./chunk-DGUM43GV.js";
|
|
5
5
|
|
|
6
6
|
// src/core/screenshot-compare.ts
|
|
@@ -133,4 +133,4 @@ export {
|
|
|
133
133
|
compareScreenshots,
|
|
134
134
|
cropToElement
|
|
135
135
|
};
|
|
136
|
-
//# sourceMappingURL=screenshot-compare-
|
|
136
|
+
//# sourceMappingURL=screenshot-compare-POTXVUTL.js.map
|
|
@@ -7,12 +7,12 @@ import {
|
|
|
7
7
|
} from "./chunk-PLE7RFQE.js";
|
|
8
8
|
import {
|
|
9
9
|
connect
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-KNSAHEXI.js";
|
|
11
11
|
import {
|
|
12
12
|
discoverDevices
|
|
13
13
|
} from "./chunk-HCG4CJKR.js";
|
|
14
|
-
import "./chunk-
|
|
15
|
-
import "./chunk-
|
|
14
|
+
import "./chunk-T5CROOR7.js";
|
|
15
|
+
import "./chunk-T3EBOYLS.js";
|
|
16
16
|
import "./chunk-HYSTRWYN.js";
|
|
17
17
|
import "./chunk-DTNK54C2.js";
|
|
18
18
|
import "./chunk-S5JNNDXS.js";
|
|
@@ -835,4 +835,4 @@ async function startStudio(options) {
|
|
|
835
835
|
export {
|
|
836
836
|
startStudio
|
|
837
837
|
};
|
|
838
|
-
//# sourceMappingURL=server-
|
|
838
|
+
//# sourceMappingURL=server-EBPYK3VE.js.map
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
SpanaMcpServer,
|
|
4
4
|
buildFlowFileFromLines,
|
|
5
5
|
formatSelectorCode
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-RURZVMZ7.js";
|
|
7
7
|
import "./chunk-DGUM43GV.js";
|
|
8
8
|
export {
|
|
9
9
|
SPANA_MCP_TOOLS,
|
|
@@ -11,4 +11,4 @@ export {
|
|
|
11
11
|
buildFlowFileFromLines,
|
|
12
12
|
formatSelectorCode
|
|
13
13
|
};
|
|
14
|
-
//# sourceMappingURL=server-
|
|
14
|
+
//# sourceMappingURL=server-IGLBFEU7.js.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Session,
|
|
3
3
|
connect
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-KNSAHEXI.js";
|
|
5
5
|
import "./chunk-HCG4CJKR.js";
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
6
|
+
import "./chunk-T5CROOR7.js";
|
|
7
|
+
import "./chunk-T3EBOYLS.js";
|
|
8
8
|
import "./chunk-HYSTRWYN.js";
|
|
9
9
|
import "./chunk-DTNK54C2.js";
|
|
10
10
|
import "./chunk-S5JNNDXS.js";
|
|
@@ -15,4 +15,4 @@ export {
|
|
|
15
15
|
Session,
|
|
16
16
|
connect
|
|
17
17
|
};
|
|
18
|
-
//# sourceMappingURL=session-
|
|
18
|
+
//# sourceMappingURL=session-QRWH3SPW.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { P as Platform, p as BrowserName, M as StorybookConfig, R as RawDriverService, S as Selector, E as ExtendedSelector, K as ScrollUntilVisibleOptions, v as BackUntilVisibleOptions, F as DismissKeyboardOptions, L as LaunchOptions, N as StorybookOpenOptions, B as BrowserRouteMatcher, m as BrowserMockResponse, y as BrowserNetworkConditions, n as BrowserConsoleLog, o as BrowserJSError, t as PromiseApp, x as BrowserHAR } from './app-
|
|
1
|
+
import { P as Platform, p as BrowserName, M as StorybookConfig, R as RawDriverService, S as Selector, E as ExtendedSelector, K as ScrollUntilVisibleOptions, v as BackUntilVisibleOptions, F as DismissKeyboardOptions, L as LaunchOptions, N as StorybookOpenOptions, B as BrowserRouteMatcher, m as BrowserMockResponse, y as BrowserNetworkConditions, n as BrowserConsoleLog, o as BrowserJSError, t as PromiseApp, x as BrowserHAR } from './app-D_UyZBsl.js';
|
|
2
2
|
import { Schema } from 'effect';
|
|
3
3
|
|
|
4
4
|
declare const Bounds: Schema.Struct<{
|
|
@@ -2,7 +2,7 @@ import "./chunk-DGUM43GV.js";
|
|
|
2
2
|
|
|
3
3
|
// src/cli/studio-command.ts
|
|
4
4
|
async function runStudioCommand(options) {
|
|
5
|
-
const { startStudio } = await import("./server-
|
|
5
|
+
const { startStudio } = await import("./server-EBPYK3VE.js");
|
|
6
6
|
const { existsSync } = await import("fs");
|
|
7
7
|
const { resolve, dirname } = await import("path");
|
|
8
8
|
const { fileURLToPath } = await import("url");
|
|
@@ -21,4 +21,4 @@ async function runStudioCommand(options) {
|
|
|
21
21
|
export {
|
|
22
22
|
runStudioCommand
|
|
23
23
|
};
|
|
24
|
-
//# sourceMappingURL=studio-command-
|
|
24
|
+
//# sourceMappingURL=studio-command-FLA5HKRK.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
loadConfig
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-2IXXEXTL.js";
|
|
4
4
|
import {
|
|
5
5
|
collectDiagnosticSections
|
|
6
6
|
} from "./chunk-KJPHH2TW.js";
|
|
@@ -15,8 +15,8 @@ import {
|
|
|
15
15
|
executeFlow,
|
|
16
16
|
runParallel,
|
|
17
17
|
speculativelyPrelaunchWebBrowser
|
|
18
|
-
} from "./chunk-
|
|
19
|
-
import "./chunk-
|
|
18
|
+
} from "./chunk-6B5Y75V4.js";
|
|
19
|
+
import "./chunk-JYFPZRCN.js";
|
|
20
20
|
import {
|
|
21
21
|
createCloudProviderHelper,
|
|
22
22
|
detectProvider
|
|
@@ -37,10 +37,10 @@ import {
|
|
|
37
37
|
parseIOSHierarchy,
|
|
38
38
|
resolveNetworkConditions,
|
|
39
39
|
splitGraphemes
|
|
40
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-T5CROOR7.js";
|
|
41
41
|
import {
|
|
42
42
|
DriverError
|
|
43
|
-
} from "./chunk-
|
|
43
|
+
} from "./chunk-T3EBOYLS.js";
|
|
44
44
|
import "./chunk-HYSTRWYN.js";
|
|
45
45
|
import "./chunk-DTNK54C2.js";
|
|
46
46
|
import "./chunk-S5JNNDXS.js";
|
|
@@ -1556,7 +1556,7 @@ async function setupReporters(reporterNames, config, resolveFromConfig, appiumUr
|
|
|
1556
1556
|
const { createConsoleReporter } = await import("./console-MI2XB5RG.js");
|
|
1557
1557
|
const { createJsonReporter } = await import("./json-JMRPUVY2.js");
|
|
1558
1558
|
const { createJUnitReporter } = await import("./junit-HLC62MK6.js");
|
|
1559
|
-
const { createHtmlReporter } = await import("./html-
|
|
1559
|
+
const { createHtmlReporter } = await import("./html-IKCTZH2U.js");
|
|
1560
1560
|
const { createAllureReporter } = await import("./allure-RNMEYTXS.js");
|
|
1561
1561
|
const { createGitHubPrReporter } = await import("./github-pr-YMWIPCCZ.js");
|
|
1562
1562
|
const resolvedOutputDir = config.artifacts?.outputDir ?? resolveFromConfig("./spana-output");
|
|
@@ -2133,4 +2133,4 @@ export {
|
|
|
2133
2133
|
loadCustomReporter,
|
|
2134
2134
|
runTestCommand
|
|
2135
2135
|
};
|
|
2136
|
-
//# sourceMappingURL=test-command-
|
|
2136
|
+
//# sourceMappingURL=test-command-P5W7UD52.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "spana-test",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "One test. Every screen. TypeScript E2E testing for Web, iOS, Android, Electron, and Electrobun — no Appium to set up, agent-ready via MCP",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"android",
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
".agents",
|
|
30
30
|
"dist",
|
|
31
31
|
"LICENSE",
|
|
32
|
+
"native",
|
|
32
33
|
"README.md",
|
|
33
34
|
"studio-dist"
|
|
34
35
|
],
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/core/native-accel.ts"],"sourcesContent":["import { existsSync } from \"node:fs\";\nimport { createRequire } from \"node:module\";\nimport { dirname, resolve } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\n\nexport interface NativePngCompareResult {\n match: boolean;\n sizeMismatch: boolean;\n diffPixelCount: number;\n diffPixelRatio: number;\n diffImage?: Buffer;\n}\n\nexport interface NativeXmlRawNode {\n tagName: string;\n attrs: Record<string, string>;\n children: NativeXmlRawNode[];\n}\n\ninterface LoadedNativeLib {\n comparePng: (\n expected: Buffer | Uint8Array,\n actual: Buffer | Uint8Array,\n threshold: number,\n maxDiffRatio: number,\n layoutTolerant: boolean,\n ) => NativePngCompareResult | null;\n tokenizeXml: (xml: string, wrapperTag: string) => NativeXmlRawNode[] | null;\n libraryPath: string;\n}\n\nlet loadAttempted = false;\nlet cachedLib: LoadedNativeLib | null = null;\n\nfunction libFileName(): string {\n if (process.platform === \"darwin\") return \"libspana_native.dylib\";\n if (process.platform === \"win32\") return \"spana_native.dll\";\n return \"libspana_native.so\";\n}\n\nfunction findNativeLibraryPath(): string | null {\n const envOverride = process.env[\"SPANA_NATIVE_LIB\"];\n if (envOverride && existsSync(envOverride)) return envOverride;\n\n const file = libFileName();\n const here = dirname(fileURLToPath(import.meta.url));\n const candidates = [\n // Bundled inside packages/spana/native/\n resolve(here, \"../../native\", file),\n resolve(here, \"../native\", file),\n // Monorepo cargo release / debug output\n resolve(here, \"../../../spana-native/target/release\", file),\n resolve(here, \"../../../../packages/spana-native/target/release\", file),\n resolve(process.cwd(), \"packages/spana-native/target/release\", file),\n ];\n\n for (const candidate of candidates) {\n if (existsSync(candidate)) return candidate;\n }\n return null;\n}\n\nfunction loadNativeAccelerator(): LoadedNativeLib | null {\n if (loadAttempted) return cachedLib;\n loadAttempted = true;\n\n if (process.env[\"SPANA_DISABLE_NATIVE\"] === \"1\") {\n return null;\n }\n\n // Uses Bun's zero-overhead native FFI when running under Bun; Node.js falls back cleanly to JS\n if (typeof (globalThis as Record<string, unknown>)[\"Bun\"] === \"undefined\") {\n return null;\n }\n\n const libPath = findNativeLibraryPath();\n if (!libPath) return null;\n\n try {\n // Dynamic createRequire so bundlers targeting Node never fail on `bun:ffi`\n const req = createRequire(import.meta.url);\n const ffiModuleName = [\"bun\", \"ffi\"].join(\":\");\n const ffi = req(ffiModuleName) as {\n dlopen: (path: string, symbols: Record<string, unknown>) => { symbols: Record<string, any> };\n FFIType: Record<string, string>;\n ptr: (buf: Uint8Array) => number;\n toArrayBuffer: (p: number, offset: number, length: number) => ArrayBuffer;\n };\n\n const lib = ffi.dlopen(libPath, {\n spana_compare_png: {\n args: [\n ffi.FFIType.ptr,\n ffi.FFIType.u64,\n ffi.FFIType.ptr,\n ffi.FFIType.u64,\n ffi.FFIType.f64,\n ffi.FFIType.f64,\n ffi.FFIType.i32,\n ffi.FFIType.ptr,\n ],\n returns: ffi.FFIType.void,\n },\n spana_tokenize_xml: {\n args: [ffi.FFIType.ptr, ffi.FFIType.u64, ffi.FFIType.ptr, ffi.FFIType.u64, ffi.FFIType.ptr],\n returns: ffi.FFIType.i32,\n },\n spana_free_buffer: {\n args: [ffi.FFIType.ptr, ffi.FFIType.u64],\n returns: ffi.FFIType.void,\n },\n });\n\n const { spana_compare_png, spana_tokenize_xml, spana_free_buffer } = lib.symbols;\n\n // Struct layout of NativeCompareResult (repr(C) on 64-bit):\n // offset 0: matched (i32)\n // offset 4: size_mismatch (i32)\n // offset 8: diff_pixel_count (u32)\n // offset 12: [4 bytes padding]\n // offset 16: diff_pixel_ratio (f64)\n // offset 24: diff_png_ptr (*mut u8 / u64)\n // offset 32: diff_png_len (usize / u64)\n // Total = 40 bytes\n const resultScratch = new ArrayBuffer(40);\n const resultView = new DataView(resultScratch);\n const resultBytes = new Uint8Array(resultScratch);\n\n // Struct layout of NativeBuffer (repr(C) on 64-bit):\n // offset 0: ptr (*mut u8 / u64)\n // offset 8: len (usize / u64)\n const bufScratch = new ArrayBuffer(16);\n const bufView = new DataView(bufScratch);\n const bufBytes = new Uint8Array(bufScratch);\n\n const textEncoder = new TextEncoder();\n const textDecoder = new TextDecoder();\n\n cachedLib = {\n libraryPath: libPath,\n\n comparePng: (expected, actual, threshold, maxDiffRatio, layoutTolerant) => {\n const expArr = expected instanceof Uint8Array ? expected : new Uint8Array(expected);\n const actArr = actual instanceof Uint8Array ? actual : new Uint8Array(actual);\n if (expArr.byteLength === 0 || actArr.byteLength === 0) return null;\n\n spana_compare_png(\n ffi.ptr(expArr),\n expArr.byteLength,\n ffi.ptr(actArr),\n actArr.byteLength,\n threshold,\n maxDiffRatio,\n layoutTolerant ? 1 : 0,\n ffi.ptr(resultBytes),\n );\n\n const matched = resultView.getInt32(0, true);\n if (matched < 0) return null;\n const sizeMismatch = resultView.getInt32(4, true) !== 0;\n const diffPixelCount = resultView.getUint32(8, true);\n const diffPixelRatio = resultView.getFloat64(16, true);\n const diffPtr = Number(resultView.getBigUint64(24, true));\n const diffLen = Number(resultView.getBigUint64(32, true));\n\n let diffImage: Buffer | undefined;\n if (diffPtr !== 0 && diffLen > 0) {\n try {\n const view = new Uint8Array(ffi.toArrayBuffer(diffPtr, 0, diffLen));\n diffImage = Buffer.from(view);\n } finally {\n spana_free_buffer(diffPtr, diffLen);\n }\n }\n\n return {\n match: matched === 1,\n sizeMismatch,\n diffPixelCount,\n diffPixelRatio,\n ...(diffImage ? { diffImage } : {}),\n };\n },\n\n tokenizeXml: (xml, wrapperTag) => {\n const xmlBytes = textEncoder.encode(xml);\n if (xmlBytes.byteLength === 0) return [];\n const wrapBytes = textEncoder.encode(wrapperTag);\n const rc = spana_tokenize_xml(\n ffi.ptr(xmlBytes),\n xmlBytes.byteLength,\n wrapBytes.byteLength > 0 ? ffi.ptr(wrapBytes) : 0,\n wrapBytes.byteLength,\n ffi.ptr(bufBytes),\n );\n if (rc !== 0) return null;\n\n const outPtr = Number(bufView.getBigUint64(0, true));\n const outLen = Number(bufView.getBigUint64(8, true));\n if (outPtr === 0 || outLen === 0) return [];\n\n try {\n const slice = new Uint8Array(ffi.toArrayBuffer(outPtr, 0, outLen));\n const jsonStr = textDecoder.decode(slice);\n return JSON.parse(jsonStr) as NativeXmlRawNode[];\n } finally {\n spana_free_buffer(outPtr, outLen);\n }\n },\n };\n\n return cachedLib;\n } catch {\n return null;\n }\n}\n\n/** Check whether Spana's native Rust accelerator (`libspana_native`) is loaded and active. */\nexport function isNativeAcceleratorActive(): boolean {\n return loadNativeAccelerator() !== null;\n}\n\n/** Return the loaded native Rust library path, or `null` when running in pure-JS fallback mode. */\nexport function getNativeAcceleratorPath(): string | null {\n return loadNativeAccelerator()?.libraryPath ?? null;\n}\n\n/** Accelerated Rust PNG diff (returns `null` if unavailable so caller falls back cleanly to JS). */\nexport function comparePngNative(\n expected: Buffer | Uint8Array,\n actual: Buffer | Uint8Array,\n threshold: number,\n maxDiffRatio: number,\n layoutTolerant: boolean,\n): NativePngCompareResult | null {\n const lib = loadNativeAccelerator();\n if (!lib) return null;\n try {\n return lib.comparePng(expected, actual, threshold, maxDiffRatio, layoutTolerant);\n } catch {\n return null;\n }\n}\n\n/** Accelerated Rust XML hierarchy tokenizer (returns `null` if unavailable so caller falls back to JS). */\nexport function tokenizeXmlNative(xml: string, wrapperTag: string): NativeXmlRawNode[] | null {\n const lib = loadNativeAccelerator();\n if (!lib) return null;\n try {\n return lib.tokenizeXml(xml, wrapperTag);\n } catch {\n return null;\n }\n}\n"],"mappings":";AAAA,SAAS,kBAAkB;AAC3B,SAAS,qBAAqB;AAC9B,SAAS,SAAS,eAAe;AACjC,SAAS,qBAAqB;AA4B9B,IAAI,gBAAgB;AACpB,IAAI,YAAoC;AAExC,SAAS,cAAsB;AAC7B,MAAI,QAAQ,aAAa,SAAU,QAAO;AAC1C,MAAI,QAAQ,aAAa,QAAS,QAAO;AACzC,SAAO;AACT;AAEA,SAAS,wBAAuC;AAC9C,QAAM,cAAc,QAAQ,IAAI,kBAAkB;AAClD,MAAI,eAAe,WAAW,WAAW,EAAG,QAAO;AAEnD,QAAM,OAAO,YAAY;AACzB,QAAM,OAAO,QAAQ,cAAc,YAAY,GAAG,CAAC;AACnD,QAAM,aAAa;AAAA;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O,SAAS,2BAA0C;AACxD,SAAO,sBAAsB,GAAG,eAAe;AACjD;AAGO,SAAS,iBACd,UACA,QACA,WACA,cACA,gBAC+B;AAC/B,QAAM,MAAM,sBAAsB;AAClC,MAAI,CAAC,IAAK,QAAO;AACjB,MAAI;AACF,WAAO,IAAI,WAAW,UAAU,QAAQ,WAAW,cAAc,cAAc;AAAA,EACjF,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAGO,SAAS,kBAAkB,KAAa,YAA+C;AAC5F,QAAM,MAAM,sBAAsB;AAClC,MAAI,CAAC,IAAK,QAAO;AACjB,MAAI;AACF,WAAO,IAAI,YAAY,KAAK,UAAU;AAAA,EACxC,QAAQ;AACN,WAAO;AAAA,EACT;AACF;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/schemas/config.ts"],"sourcesContent":["import type { Platform, TapMode } from \"./selector.js\";\nimport type {\n DeviceStateConfig,\n LaunchOptions,\n VirtualAuthenticatorOptions,\n} from \"../drivers/raw-driver.js\";\nimport { z, type ZodError } from \"zod\";\n\nexport type { DeviceStateConfig, LaunchOptions, VirtualAuthenticatorOptions };\n\nexport interface IOSSigningConfig {\n /** Apple Development Team ID (from developer.apple.com or Xcode) */\n teamId: string;\n /** Code signing identity (default: \"Apple Development\") */\n signingIdentity?: string;\n}\n\nexport interface BridgeConfig {\n /** Enable the in-app spana-bridge WebSocket server. Default: auto-detected when port/url is set. */\n enabled?: boolean;\n /** Port for the runner's spana-bridge WebSocket server (default: 9333). */\n port?: number;\n /** Host to bind the bridge server on (default: \"127.0.0.1\"). */\n host?: string;\n /** Explicit external bridge URL if already running (e.g. ws://127.0.0.1:9333). */\n url?: string;\n /** Connection timeout in ms when waiting for the app bridge to connect (default: 5000). */\n connectTimeout?: number;\n}\n\nexport interface WarmDaemonConfig {\n /** Keep WDA / UiAutomator2 daemons alive across test runs and reuse them. Default: false. */\n enabled?: boolean;\n /** Reuse a single browser process across flows with fresh BrowserContexts. Default: true. */\n reuseBrowserProcess?: boolean;\n /** Reuse an active WDA/UiAutomator2 session across flows instead of recreating. Default: true when warm daemons enabled. */\n reuseSession?: boolean;\n /** Optional path to store warm daemon metadata. */\n stateFile?: string;\n}\n\nexport interface AppConfig {\n url?: string;\n packageName?: string;\n bundleId?: string;\n /** Path to .app or .ipa for auto-install on device/simulator */\n appPath?: string;\n /** iOS code signing config for physical devices */\n signing?: IOSSigningConfig;\n /** Explicit WebKit Inspector URL or port for iOS WKWebView direct DOM access */\n webkitInspectorUrl?: string;\n webkitInspectorPort?: number;\n /** Explicit CDP port for Android WebView or desktop targets */\n cdpPort?: number;\n /** Pin device locale (e.g. \"en_US\", \"sv_SE\") for predictable system UI labels */\n locale?: string;\n /** Optional spana-bridge override for this app target */\n bridge?: BridgeConfig;\n}\n\nexport interface ElectronAppConfig {\n /** Path to Electron main entry file or app directory (passed to Playwright _electron.launch) */\n entry?: string;\n /** Path to a packaged Electron executable */\n executablePath?: string;\n /** Extra CLI arguments passed to Electron */\n args?: string[];\n /** Working directory for Electron launch */\n cwd?: string;\n /** Additional environment variables for Electron */\n env?: Record<string, string>;\n /** Attach to an already-running Electron app over CDP instead of launching */\n cdpUrl?: string;\n /** Remote debugging port when launching or attaching over CDP */\n cdpPort?: number;\n /** Optional URL to navigate to after launch */\n url?: string;\n /** Optional spana-bridge config */\n bridge?: BridgeConfig;\n}\n\nexport type ElectrobunRenderer = \"native\" | \"cef\";\n\nexport interface ElectrobunAppConfig {\n /** Path to Electrobun binary or packaged .app/.exe */\n executablePath?: string;\n /** Path to Electrobun project root (containing electrobun.config.ts) */\n appDir?: string;\n /** Extra CLI arguments passed to the Electrobun process */\n args?: string[];\n /** Working directory for launch */\n cwd?: string;\n /** Additional environment variables */\n env?: Record<string, string>;\n /** Renderer engine used by the Electrobun build: \"native\" (WKWebView/WebView2/WebKitGTK) or \"cef\" */\n renderer?: ElectrobunRenderer;\n /** Attach to an already-running Electrobun CEF/WebView2 app over CDP */\n cdpUrl?: string;\n /** Remote debugging port (ELECTROBUN_CDP_PORT / WEBVIEW2_ADDITIONAL_BROWSER_ARGUMENTS) */\n cdpPort?: number;\n /** WebKit Inspector port for macOS WKWebView or Linux WebKitGTK */\n webkitInspectorPort?: number;\n /** Optional URL to navigate to after launch */\n url?: string;\n /** Optional spana-bridge config */\n bridge?: BridgeConfig;\n}\n\nexport type BrowserName = \"chromium\" | \"firefox\" | \"webkit\";\nexport type WebBrowserEngine = \"playwright\" | \"cdp\" | \"lightpanda\";\nexport type WebResourceBlockType = \"image\" | \"font\" | \"media\" | \"stylesheet\";\n\nexport type StorybookValue = string | number | boolean | null;\n\nexport interface StorybookConfig {\n /** Optional dedicated Storybook URL (falls back to apps.web.url when omitted) */\n url?: string;\n /** Preview iframe path used to render isolated stories (default: /iframe.html) */\n iframePath?: string;\n}\n\nexport interface WebExecutionConfig {\n browser?: BrowserName;\n /** Browser engine backend: \"playwright\" (default), \"cdp\" (direct CDP WebSocket — zero Playwright pipe), or \"lightpanda\". */\n engine?: WebBrowserEngine;\n /** Connect to an existing CDP browser / Lightpanda endpoint (e.g. \"http://127.0.0.1:9222\"). */\n cdpUrl?: string;\n /** Connect to a remote Playwright server WebSocket (e.g. BrowserStack Automate Web `wss://cdp.browserstack.com/playwright?...`). */\n wsEndpoint?: string;\n /** Explicit browser executable path (e.g. system Chrome or custom Chromium binary). */\n executablePath?: string;\n /** Browser release channel (e.g. \"chrome\", \"chrome-beta\", \"msedge\"). */\n channel?: string;\n headless?: boolean;\n /** Navigation readiness event for launchApp/openLink (default: \"load\"). */\n waitUntil?: \"domcontentloaded\" | \"load\" | \"networkidle\" | \"commit\";\n /** Collapse CSS transitions & animations to 0.001ms for faster deterministic runs. */\n instantAnimations?: boolean;\n /** Abort heavy asset requests (\"image\" | \"font\" | \"media\" | \"stylesheet\") during web runs. */\n blockResources?: WebResourceBlockType[];\n /** Reuse a persistent warm Chromium daemon across runs via CDP (chromium only). */\n warmBrowser?: boolean;\n /** Scope key for isolating warm Chromium daemons across concurrent repos/runs (defaults to cwd hash). */\n warmBrowserScope?: string;\n /** Create a fresh isolated BrowserContext per flow using pre-warmed context pooling + background teardown. */\n freshContextPerFlow?: boolean;\n /** Max worker contexts sharing one Chromium browser process under `--parallel` (default: 2 to avoid CDP/IO contention). */\n maxContextsPerBrowser?: number;\n /** Automatically attach a CDP WebAuthn virtual authenticator (passkey) to every fresh context. */\n virtualAuthenticator?: boolean | VirtualAuthenticatorOptions;\n /** Optional Playwright storage state JSON file to preload for web runs */\n storageState?: string;\n /** Print verbose Playwright runtime events to stdout for local web debugging */\n verboseLogging?: boolean;\n /** Optional Storybook config for isolated component/story flows in the browser runtime */\n storybook?: StorybookConfig;\n}\n\nexport interface CloudAppReferenceConfig {\n /** Existing remote app reference, e.g. bs://... or storage:... */\n id?: string;\n /** Local file path to upload when the provider supports managed upload */\n path?: string;\n /** Override the uploaded file name when the provider supports it */\n name?: string;\n}\n\nexport interface BrowserStackAppConfig extends CloudAppReferenceConfig {\n /** Stable BrowserStack app alias */\n customId?: string;\n}\n\nexport interface BrowserStackLocalConfig {\n enabled?: boolean;\n binary?: string;\n identifier?: string;\n args?: string[];\n}\n\nexport interface BrowserStackHelperConfig {\n app?: BrowserStackAppConfig;\n local?: BrowserStackLocalConfig;\n options?: Record<string, unknown>;\n}\n\nexport interface SauceConnectConfig {\n enabled?: boolean;\n binary?: string;\n tunnelName?: string;\n args?: string[];\n}\n\nexport interface SauceLabsHelperConfig {\n app?: CloudAppReferenceConfig;\n connect?: SauceConnectConfig;\n options?: Record<string, unknown>;\n}\n\nexport interface AppiumExecutionConfig {\n serverUrl?: string;\n capabilities?: Record<string, unknown>;\n /**\n * Platform-specific capabilities merged on top of `capabilities` when the\n * matching platform runs. Useful when you want different `appium:deviceName`\n * or `appium:platformVersion` for Android vs iOS.\n */\n platformCapabilities?: {\n android?: Record<string, unknown>;\n ios?: Record<string, unknown>;\n };\n capabilitiesFile?: string;\n reportToProvider?: boolean;\n browserstack?: BrowserStackHelperConfig;\n saucelabs?: SauceLabsHelperConfig;\n /** Path to a custom cloud provider module (default export must conform to CloudProvider interface). */\n cloudProvider?: string;\n /**\n * Opt in to having spana spawn a local `appium` subprocess for the\n * duration of the test run. Requires `appium` to be on PATH. When true,\n * `serverUrl` (if set) is ignored and a URL is assigned to the\n * auto-started server instead. Off by default — spana never spawns\n * background processes unless you ask.\n */\n autoStart?: boolean;\n /** Override the `appium` binary name. Default: \"appium\". */\n autoStartBinary?: string;\n /** Extra CLI args to forward to the spawned Appium process. */\n autoStartArgs?: readonly string[];\n}\n\nexport interface ExecutionConfig {\n mode?: \"local\" | \"appium\";\n web?: WebExecutionConfig;\n appium?: AppiumExecutionConfig;\n /** In-app spana-bridge configuration shared across webview targets */\n bridge?: BridgeConfig;\n /** Warm daemon & process reuse settings for fast repeated runs */\n warmDaemons?: WarmDaemonConfig;\n}\n\nexport interface ArtifactConfig {\n outputDir?: string;\n captureOnFailure?: boolean;\n captureOnSuccess?: boolean;\n captureSteps?: boolean;\n screenshot?: boolean;\n uiHierarchy?: boolean;\n consoleLogs?: boolean;\n jsErrors?: boolean;\n har?: boolean;\n}\n\nexport interface HookContext {\n app: unknown; // Will be typed properly when App is defined\n expect?: unknown;\n platform?: Platform;\n result?: unknown;\n summary?: unknown;\n}\n\nexport interface ProvConfig {\n apps?: {\n web?: AppConfig;\n android?: AppConfig;\n ios?: AppConfig;\n electron?: ElectronAppConfig;\n electrobun?: ElectrobunAppConfig;\n };\n defaults?: {\n waitTimeout?: number;\n pollInterval?: number;\n settleTimeout?: number;\n retries?: number;\n /** Pause after each action (tap, scroll) to let the UI settle. Default: 0 (disabled). */\n waitForIdleTimeout?: number;\n /** Delay between each character when typing. Default: 0 (instant). */\n typingDelay?: number;\n /** Starting poll interval for adaptive backoff. Default: 50ms. Set equal to pollInterval to disable adaptive backoff. */\n initialPollInterval?: number;\n /** Max age in ms before cached hierarchy is stale. Default: 100. Set to 0 to disable. */\n hierarchyCacheTtl?: number;\n /** Max depth for UI hierarchy snapshots on iOS. Default: 100. */\n snapshotMaxDepth?: number;\n /** Delay in ms between retry attempts of a failed flow. Default: 0 (immediate). */\n retryDelay?: number;\n /** Max workers per platform when using --parallel. */\n workers?: number;\n /** Default tap mode when a DOM channel resolves an element: \"native\" (real touch, default) or \"dom\" (fast synthetic click). */\n tapMode?: TapMode;\n /** Pin device locale across targets so system UI sheet labels stay deterministic. */\n locale?: string;\n /** Fail web element waits early when the page is idle & readyState === \"complete\" instead of waiting full waitTimeout. */\n failFastWhenIdle?: boolean;\n };\n platforms?: Platform[];\n /** Run platforms concurrently when they use independent resources. Default: false (serial). */\n parallelPlatforms?: boolean;\n flowDir?: string;\n launchOptions?: LaunchOptions;\n /**\n * Reporter names or module paths. Built-in: \"console\", \"json\", \"junit\", \"html\", \"allure\".\n * Custom reporters: provide a relative path (e.g., \"./reporters/slack.ts\") that default-exports\n * a Reporter object or a `(options: { outputDir: string }) => Reporter` factory function.\n */\n reporters?: string[];\n hooks?: {\n beforeAll?: (ctx: HookContext) => Promise<void>;\n beforeEach?: (ctx: HookContext) => Promise<void>;\n afterEach?: (ctx: HookContext) => Promise<void>;\n afterAll?: (ctx: HookContext) => Promise<void>;\n };\n artifacts?: ArtifactConfig;\n execution?: ExecutionConfig;\n visualRegression?: {\n threshold?: number;\n maxDiffPixelRatio?: number;\n baselinesDir?: string;\n mode?: \"pixel\" | \"layout-tolerant\";\n };\n /** Pluggable CI filters evaluated when `--changed-since <ref>` is passed. */\n filters?: Array<{\n name: string;\n filter: (flows: any[], context: any) => Promise<any> | any;\n }>;\n /** Verified replay cache settings for optional agentic steps (`.spana/cache/`). */\n replayCache?: {\n mode?: \"read-write\" | \"strict\" | \"off\";\n dir?: string;\n };\n}\n\nconst platformSchema = z.enum([\"web\", \"android\", \"ios\", \"electron\", \"electrobun\"]);\nconst reporterSchema = z.string().min(1);\nconst hookSchema = z.custom<(...args: unknown[]) => Promise<void>>(\n (value) => typeof value === \"function\",\n { message: \"Expected function\" },\n);\n\nconst iosSigningConfigSchema = z\n .object({\n teamId: z.string().min(1, \"teamId is required\"),\n signingIdentity: z.string().min(1).optional(),\n })\n .strict();\n\nconst bridgeConfigSchema = z\n .object({\n enabled: z.boolean().optional(),\n port: z.number().int().positive().optional(),\n host: z.string().min(1).optional(),\n url: z.string().min(1).optional(),\n connectTimeout: z.number().positive().optional(),\n })\n .strict();\n\nconst warmDaemonConfigSchema = z\n .object({\n enabled: z.boolean().optional(),\n reuseBrowserProcess: z.boolean().optional(),\n reuseSession: z.boolean().optional(),\n stateFile: z.string().min(1).optional(),\n })\n .strict();\n\nconst appConfigSchema = z\n .object({\n url: z.string().url().optional(),\n packageName: z.string().min(1).optional(),\n bundleId: z.string().min(1).optional(),\n appPath: z.string().min(1).optional(),\n signing: iosSigningConfigSchema.optional(),\n webkitInspectorUrl: z.string().min(1).optional(),\n webkitInspectorPort: z.number().int().positive().optional(),\n cdpPort: z.number().int().positive().optional(),\n locale: z.string().min(1).optional(),\n bridge: bridgeConfigSchema.optional(),\n })\n .strict();\n\nconst electronAppConfigSchema = z\n .object({\n entry: z.string().min(1).optional(),\n executablePath: z.string().min(1).optional(),\n args: z.array(z.string()).optional(),\n cwd: z.string().min(1).optional(),\n env: z.record(z.string(), z.string()).optional(),\n cdpUrl: z.string().url().optional(),\n cdpPort: z.number().int().positive().optional(),\n url: z.string().url().optional(),\n bridge: bridgeConfigSchema.optional(),\n })\n .strict();\n\nconst electrobunAppConfigSchema = z\n .object({\n executablePath: z.string().min(1).optional(),\n appDir: z.string().min(1).optional(),\n args: z.array(z.string()).optional(),\n cwd: z.string().min(1).optional(),\n env: z.record(z.string(), z.string()).optional(),\n renderer: z.enum([\"native\", \"cef\"]).optional(),\n cdpUrl: z.string().url().optional(),\n cdpPort: z.number().int().positive().optional(),\n webkitInspectorPort: z.number().int().positive().optional(),\n url: z.string().url().optional(),\n bridge: bridgeConfigSchema.optional(),\n })\n .strict();\n\nconst cloudAppReferenceSchema = z\n .object({\n id: z.string().min(1).optional(),\n path: z.string().min(1).optional(),\n name: z.string().min(1).optional(),\n })\n .strict();\n\nconst browserStackAppSchema = cloudAppReferenceSchema\n .extend({\n customId: z.string().min(1).optional(),\n })\n .strict();\n\nconst browserStackLocalSchema = z\n .object({\n enabled: z.boolean().optional(),\n binary: z.string().min(1).optional(),\n identifier: z.string().min(1).optional(),\n args: z.array(z.string().min(1)).optional(),\n })\n .strict();\n\nconst browserStackHelperSchema = z\n .object({\n app: browserStackAppSchema.optional(),\n local: browserStackLocalSchema.optional(),\n options: z.record(z.string(), z.unknown()).optional(),\n })\n .strict();\n\nconst sauceConnectSchema = z\n .object({\n enabled: z.boolean().optional(),\n binary: z.string().min(1).optional(),\n tunnelName: z.string().min(1).optional(),\n args: z.array(z.string().min(1)).optional(),\n })\n .strict();\n\nconst sauceLabsHelperSchema = z\n .object({\n app: cloudAppReferenceSchema.optional(),\n connect: sauceConnectSchema.optional(),\n options: z.record(z.string(), z.unknown()).optional(),\n })\n .strict();\n\nconst storybookConfigSchema = z\n .object({\n url: z.string().url().optional(),\n iframePath: z.string().min(1).optional(),\n })\n .strict();\n\nconst appiumExecutionConfigSchema = z\n .object({\n serverUrl: z.string().url().optional(),\n capabilities: z.record(z.string(), z.unknown()).optional(),\n platformCapabilities: z\n .object({\n android: z.record(z.string(), z.unknown()).optional(),\n ios: z.record(z.string(), z.unknown()).optional(),\n })\n .strict()\n .optional(),\n capabilitiesFile: z.string().min(1).optional(),\n reportToProvider: z.boolean().optional(),\n browserstack: browserStackHelperSchema.optional(),\n saucelabs: sauceLabsHelperSchema.optional(),\n cloudProvider: z.string().min(1).optional(),\n autoStart: z.boolean().optional(),\n autoStartBinary: z.string().min(1).optional(),\n autoStartArgs: z.array(z.string()).optional(),\n })\n .strict();\n\nconst virtualAuthenticatorOptionsSchema = z\n .object({\n protocol: z.enum([\"ctap2\", \"u2f\"]).optional(),\n transport: z.enum([\"usb\", \"nfc\", \"ble\", \"cable\", \"internal\"]).optional(),\n hasResidentKey: z.boolean().optional(),\n hasUserVerification: z.boolean().optional(),\n isUserVerified: z.boolean().optional(),\n automaticPresenceSimulation: z.boolean().optional(),\n })\n .strict();\n\nconst webExecutionConfigSchema = z\n .object({\n browser: z.enum([\"chromium\", \"firefox\", \"webkit\"]).optional(),\n engine: z.enum([\"playwright\", \"cdp\", \"lightpanda\"]).optional(),\n cdpUrl: z.string().url().optional(),\n wsEndpoint: z.string().url().optional(),\n executablePath: z.string().min(1).optional(),\n channel: z.string().min(1).optional(),\n headless: z.boolean().optional(),\n waitUntil: z.enum([\"domcontentloaded\", \"load\", \"networkidle\", \"commit\"]).optional(),\n instantAnimations: z.boolean().optional(),\n blockResources: z.array(z.enum([\"image\", \"font\", \"media\", \"stylesheet\"])).optional(),\n warmBrowser: z.boolean().optional(),\n warmBrowserScope: z.string().min(1).optional(),\n freshContextPerFlow: z.boolean().optional(),\n maxContextsPerBrowser: z.number().int().positive().optional(),\n virtualAuthenticator: z.union([z.boolean(), virtualAuthenticatorOptionsSchema]).optional(),\n storageState: z.string().min(1).optional(),\n verboseLogging: z.boolean().optional(),\n storybook: storybookConfigSchema.optional(),\n })\n .strict();\n\nconst executionConfigSchema = z\n .object({\n mode: z.enum([\"local\", \"appium\"]).optional(),\n web: webExecutionConfigSchema.optional(),\n appium: appiumExecutionConfigSchema.optional(),\n bridge: bridgeConfigSchema.optional(),\n warmDaemons: warmDaemonConfigSchema.optional(),\n })\n .strict();\n\nconst artifactConfigSchema = z\n .object({\n outputDir: z.string().min(1).optional(),\n captureOnFailure: z.boolean().optional(),\n captureOnSuccess: z.boolean().optional(),\n captureSteps: z.boolean().optional(),\n screenshot: z.boolean().optional(),\n uiHierarchy: z.boolean().optional(),\n consoleLogs: z.boolean().optional(),\n jsErrors: z.boolean().optional(),\n har: z.boolean().optional(),\n })\n .strict();\n\nconst deviceStateSchema = z\n .object({\n language: z.string().min(1).optional(),\n locale: z.string().min(1).optional(),\n timeZone: z.string().min(1).optional(),\n })\n .strict();\n\nconst launchOptionsSchema = z\n .object({\n clearState: z.boolean().optional(),\n clearKeychain: z.boolean().optional(),\n deepLink: z.string().min(1).optional(),\n launchArguments: z.record(z.string(), z.unknown()).optional(),\n deviceState: deviceStateSchema.optional(),\n })\n .strict();\n\nexport const provConfigSchema = z\n .object({\n apps: z\n .object({\n web: appConfigSchema.optional(),\n android: appConfigSchema.optional(),\n ios: appConfigSchema.optional(),\n electron: electronAppConfigSchema.optional(),\n electrobun: electrobunAppConfigSchema.optional(),\n })\n .strict()\n .optional(),\n defaults: z\n .object({\n waitTimeout: z.number().positive().optional(),\n pollInterval: z.number().positive().optional(),\n settleTimeout: z.number().nonnegative().optional(),\n retries: z.number().int().nonnegative().optional(),\n waitForIdleTimeout: z.number().nonnegative().optional(),\n typingDelay: z.number().nonnegative().optional(),\n initialPollInterval: z.number().positive().optional(),\n hierarchyCacheTtl: z.number().nonnegative().optional(),\n snapshotMaxDepth: z.number().int().positive().optional(),\n retryDelay: z.number().nonnegative().optional(),\n workers: z.number().int().positive().optional(),\n tapMode: z.enum([\"native\", \"dom\"]).optional(),\n locale: z.string().min(1).optional(),\n failFastWhenIdle: z.boolean().optional(),\n })\n .strict()\n .optional(),\n platforms: z.array(platformSchema).optional(),\n parallelPlatforms: z.boolean().optional(),\n flowDir: z.string().min(1).optional(),\n launchOptions: launchOptionsSchema.optional(),\n reporters: z.array(reporterSchema).optional(),\n hooks: z\n .object({\n beforeAll: hookSchema.optional(),\n beforeEach: hookSchema.optional(),\n afterEach: hookSchema.optional(),\n afterAll: hookSchema.optional(),\n })\n .strict()\n .optional(),\n artifacts: artifactConfigSchema.optional(),\n execution: executionConfigSchema.optional(),\n visualRegression: z\n .object({\n threshold: z.number().min(0).max(1).optional(),\n maxDiffPixelRatio: z.number().min(0).max(1).optional(),\n baselinesDir: z.string().optional(),\n mode: z.enum([\"pixel\", \"layout-tolerant\"]).optional(),\n })\n .optional(),\n filters: z\n .array(\n z.custom<{ name: string; filter: (...args: unknown[]) => unknown }>(\n (value) =>\n typeof value === \"object\" &&\n value !== null &&\n typeof (value as Record<string, unknown>).name === \"string\" &&\n typeof (value as Record<string, unknown>).filter === \"function\",\n { message: \"Expected TestFilter ({ name, filter })\" },\n ),\n )\n .optional(),\n replayCache: z\n .object({\n mode: z.enum([\"read-write\", \"strict\", \"off\"]).optional(),\n dir: z.string().min(1).optional(),\n })\n .strict()\n .optional(),\n })\n .strict();\n\nexport function defineConfig(config: ProvConfig): ProvConfig {\n return config;\n}\n\nexport function validateConfig(config: unknown): ProvConfig {\n return provConfigSchema.parse(config) as ProvConfig;\n}\n\nexport function formatConfigValidationError(error: ZodError): string {\n return error.issues\n .map((issue) => {\n const path = issue.path.length > 0 ? issue.path.join(\".\") : \"config\";\n return `- ${path}: ${issue.message}`;\n })\n .join(\"\\n\");\n}\n"],"mappings":";AAMA,SAAS,SAAwB;AAqUjC,IAAM,iBAAiB,EAAE,KAAK,CAAC,OAAO,WAAW,OAAO,YAAY,YAAY,CAAC;AACjF,IAAM,iBAAiB,EAAE,OAAO,EAAE,IAAI,CAAC;AACvC,IAAM,aAAa,EAAE;AAAA,EACnB,CAAC,UAAU,OAAO,UAAU;AAAA,EAC5B,EAAE,SAAS,oBAAoB;AACjC;AAEA,IAAM,yBAAyB,EAC5B,OAAO;AAAA,EACN,QAAQ,EAAE,OAAO,EAAE,IAAI,GAAG,oBAAoB;AAAA,EAC9C,iBAAiB,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,SAAS;AAC9C,CAAC,EACA,OAAO;AAEV,IAAM,qBAAqB,EACxB,OAAO;AAAA,EACN,SAAS,EAAE,QAAQ,EAAE,SAAS;AAAA,EAC9B,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS;AAAA,EAC3C,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,SAAS;AAAA,EACjC,KAAK,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,SAAS;AAAA,EAChC,gBAAgB,EAAE,OAAO,EAAE,S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