spana-test 0.6.0 → 0.8.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 +9 -9
- package/dist/{allure-RNMEYTXS.js → allure-RAEK4SIH.js} +2 -2
- package/dist/allure-RAEK4SIH.js.map +1 -0
- package/dist/{android-4NVTZMHL.js → android-6BOQTMM3.js} +2 -2
- package/dist/app-CgbLADmF.d.ts +1191 -0
- package/dist/{chunk-H27IBIGA.js → chunk-2AFWVHQK.js} +63 -43
- package/dist/chunk-2AFWVHQK.js.map +1 -0
- package/dist/{chunk-KBRLIQRA.js → chunk-2T4K7BJ3.js} +8 -3
- package/dist/chunk-2T4K7BJ3.js.map +1 -0
- package/dist/{chunk-KEUZLBQS.js → chunk-3FXDOTFI.js} +1361 -327
- package/dist/chunk-3FXDOTFI.js.map +1 -0
- package/dist/{chunk-4K3FZTSV.js → chunk-54ASKII6.js} +6 -2
- package/dist/chunk-54ASKII6.js.map +1 -0
- package/dist/{chunk-PWUJT5HE.js → chunk-AJCSETN6.js} +1330 -246
- package/dist/chunk-AJCSETN6.js.map +1 -0
- package/dist/chunk-JPZCZHL4.js +79 -0
- package/dist/chunk-JPZCZHL4.js.map +1 -0
- package/dist/{chunk-C4E4XULT.js → chunk-NS2HLJO4.js} +3 -3
- package/dist/{chunk-S4JVAHBR.js → chunk-PMXSU5MS.js} +2 -2
- package/dist/{chunk-HYSTRWYN.js → chunk-QP4MDUBY.js} +4 -4
- package/dist/chunk-RKYKRGHB.js +236 -0
- package/dist/chunk-RKYKRGHB.js.map +1 -0
- package/dist/{chunk-HCG4CJKR.js → chunk-SF7UYW4I.js} +3 -3
- package/dist/{chunk-LCV673G3.js → chunk-SNL4X67N.js} +1166 -94
- package/dist/chunk-SNL4X67N.js.map +1 -0
- package/dist/{chunk-WBBMEAHU.js → chunk-WKVU24B6.js} +8 -8
- package/dist/{chunk-S5JNNDXS.js → chunk-WV3ALL3H.js} +65 -37
- package/dist/chunk-WV3ALL3H.js.map +1 -0
- package/dist/cli.js +23 -11
- package/dist/cli.js.map +1 -1
- package/dist/config-loader-5FU45FXK.js +9 -0
- package/dist/{console-MI2XB5RG.js → console-BGAK7Z2L.js} +11 -1
- package/dist/{console-MI2XB5RG.js.map → console-BGAK7Z2L.js.map} +1 -1
- package/dist/{daemon-manager-FBISTX24.js → daemon-manager-DDYQITPD.js} +4 -2
- package/dist/{discover-LHEBSUIP.js → discover-RLSKEBAX.js} +5 -5
- package/dist/{doctor-command-WEHFANT7.js → doctor-command-HEQQOYUR.js} +26 -18
- package/dist/doctor-command-HEQQOYUR.js.map +1 -0
- package/dist/{flow-C2JQ7gUu.d.ts → flow-Md5xLwbX.d.ts} +3 -29
- package/dist/gherkin/steps.d.ts +2 -2
- package/dist/{html-F3X3XPSX.js → html-JO2YNRWX.js} +195 -4
- package/dist/html-JO2YNRWX.js.map +1 -0
- package/dist/index.d.ts +400 -15
- package/dist/index.js +255 -18
- package/dist/index.js.map +1 -1
- package/dist/{installer-VUPFWP5X.js → installer-IYGMG7LS.js} +4 -4
- package/dist/{ios-JPK43TFZ.js → ios-Y4TO5MBR.js} +7 -3
- package/dist/{screenshot-compare-5NINZVOK.js → screenshot-compare-POTXVUTL.js} +2 -2
- package/dist/{server-3MGZNK67.js → server-4PEREPHY.js} +2 -2
- package/dist/{server-OANRDAHN.js → server-JPNH33MX.js} +50 -36
- package/dist/server-JPNH33MX.js.map +1 -0
- package/dist/{session-Daq0mE_a.d.ts → session-D9e30RVS.d.ts} +1 -1
- package/dist/session-V4PYJXNB.js +18 -0
- package/dist/{studio-command-RJYLJT4I.js → studio-command-JOIFCOHC.js} +2 -2
- package/dist/{test-command-ALH5ZQY5.js → test-command-JCO2HPYI.js} +221 -27
- package/dist/test-command-JCO2HPYI.js.map +1 -0
- package/native/darwin-arm64/libspana_native.dylib +0 -0
- package/native/darwin-x64/libspana_native.dylib +0 -0
- package/native/linux-arm64/libspana_native.so +0 -0
- package/native/linux-x64/libspana_native.so +0 -0
- package/native/win32-x64/spana_native.dll +0 -0
- package/package.json +2 -1
- package/studio-dist/assets/index-CBFsOh-9.js +193 -0
- package/studio-dist/assets/index-DH_18EyL.css +1 -0
- package/studio-dist/index.html +2 -2
- package/dist/allure-RNMEYTXS.js.map +0 -1
- package/dist/app-DcLXtpv4.d.ts +0 -908
- package/dist/chunk-4K3FZTSV.js.map +0 -1
- package/dist/chunk-DTNK54C2.js +0 -127
- package/dist/chunk-DTNK54C2.js.map +0 -1
- package/dist/chunk-H27IBIGA.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/chunk-OBCFACUW.js +0 -28
- package/dist/chunk-OBCFACUW.js.map +0 -1
- package/dist/chunk-PWUJT5HE.js.map +0 -1
- package/dist/chunk-S5JNNDXS.js.map +0 -1
- package/dist/config-loader-J4Z2PMUQ.js +0 -9
- package/dist/doctor-command-WEHFANT7.js.map +0 -1
- package/dist/html-F3X3XPSX.js.map +0 -1
- package/dist/server-OANRDAHN.js.map +0 -1
- package/dist/session-Q3QYHT4Q.js +0 -18
- package/dist/test-command-ALH5ZQY5.js.map +0 -1
- package/studio-dist/assets/index-C-Io44gy.js +0 -193
- package/studio-dist/assets/index-DfM9lK4p.css +0 -1
- /package/dist/{android-4NVTZMHL.js.map → android-6BOQTMM3.js.map} +0 -0
- /package/dist/{chunk-C4E4XULT.js.map → chunk-NS2HLJO4.js.map} +0 -0
- /package/dist/{chunk-S4JVAHBR.js.map → chunk-PMXSU5MS.js.map} +0 -0
- /package/dist/{chunk-HYSTRWYN.js.map → chunk-QP4MDUBY.js.map} +0 -0
- /package/dist/{chunk-HCG4CJKR.js.map → chunk-SF7UYW4I.js.map} +0 -0
- /package/dist/{chunk-WBBMEAHU.js.map → chunk-WKVU24B6.js.map} +0 -0
- /package/dist/{config-loader-J4Z2PMUQ.js.map → config-loader-5FU45FXK.js.map} +0 -0
- /package/dist/{daemon-manager-FBISTX24.js.map → daemon-manager-DDYQITPD.js.map} +0 -0
- /package/dist/{discover-LHEBSUIP.js.map → discover-RLSKEBAX.js.map} +0 -0
- /package/dist/{installer-VUPFWP5X.js.map → installer-IYGMG7LS.js.map} +0 -0
- /package/dist/{ios-JPK43TFZ.js.map → ios-Y4TO5MBR.js.map} +0 -0
- /package/dist/{screenshot-compare-5NINZVOK.js.map → screenshot-compare-POTXVUTL.js.map} +0 -0
- /package/dist/{server-3MGZNK67.js.map → server-4PEREPHY.js.map} +0 -0
- /package/dist/{session-Q3QYHT4Q.js.map → session-V4PYJXNB.js.map} +0 -0
- /package/dist/{studio-command-RJYLJT4I.js.map → studio-command-JOIFCOHC.js.map} +0 -0
|
@@ -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;AAAA,IAEjB,QAAQ,MAAM,gBAAgB,IAAI;AAAA,IAClC,QAAQ,MAAM,aAAa,IAAI;AAAA;AAAA,IAE/B,QAAQ,MAAM,wCAAwC,IAAI;AAAA,IAC1D,QAAQ,MAAM,oDAAoD,IAAI;AAAA,IACtE,QAAQ,QAAQ,IAAI,GAAG,wCAAwC,IAAI;AAAA,EACrE;AAEA,aAAW,aAAa,YAAY;AAClC,QAAI,WAAW,SAAS,EAAG,QAAO;AAAA,EACpC;AACA,SAAO;AACT;AAEA,SAAS,wBAAgD;AACvD,MAAI,cAAe,QAAO;AAC1B,kBAAgB;AAEhB,MAAI,QAAQ,IAAI,sBAAsB,MAAM,KAAK;AAC/C,WAAO;AAAA,EACT;AAGA,MAAI,OAAQ,WAAuC,KAAK,MAAM,aAAa;AACzE,WAAO;AAAA,EACT;AAEA,QAAM,UAAU,sBAAsB;AACtC,MAAI,CAAC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-
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
|
|
3
|
-
import { tmpdir } from "os";
|
|
4
|
-
import { dirname, join } from "path";
|
|
5
|
-
function defaultDaemonStatePath() {
|
|
6
|
-
return join(tmpdir(), "spana-warm-daemons.json");
|
|
7
|
-
}
|
|
8
|
-
function daemonKey(kind, deviceId) {
|
|
9
|
-
return `${kind}:${deviceId}`;
|
|
10
|
-
}
|
|
11
|
-
function loadDaemonRegistry(stateFile = defaultDaemonStatePath()) {
|
|
12
|
-
if (!existsSync(stateFile)) {
|
|
13
|
-
return { version: 1, daemons: {} };
|
|
14
|
-
}
|
|
15
|
-
try {
|
|
16
|
-
const raw = readFileSync(stateFile, "utf-8");
|
|
17
|
-
const parsed = JSON.parse(raw);
|
|
18
|
-
if (parsed && parsed.version === 1 && typeof parsed.daemons === "object") {
|
|
19
|
-
return parsed;
|
|
20
|
-
}
|
|
21
|
-
} catch {
|
|
22
|
-
}
|
|
23
|
-
return { version: 1, daemons: {} };
|
|
24
|
-
}
|
|
25
|
-
function saveDaemonRegistry(registry, stateFile = defaultDaemonStatePath()) {
|
|
26
|
-
mkdirSync(dirname(stateFile), { recursive: true });
|
|
27
|
-
writeFileSync(stateFile, JSON.stringify(registry, null, 2), "utf-8");
|
|
28
|
-
}
|
|
29
|
-
function registerWarmDaemon(record, stateFile = defaultDaemonStatePath()) {
|
|
30
|
-
const registry = loadDaemonRegistry(stateFile);
|
|
31
|
-
registry.daemons[daemonKey(record.kind, record.deviceId)] = record;
|
|
32
|
-
saveDaemonRegistry(registry, stateFile);
|
|
33
|
-
}
|
|
34
|
-
function updateWarmDaemonSession(kind, deviceId, sessionId, bundleId, stateFile = defaultDaemonStatePath()) {
|
|
35
|
-
const registry = loadDaemonRegistry(stateFile);
|
|
36
|
-
const key = daemonKey(kind, deviceId);
|
|
37
|
-
const existing = registry.daemons[key];
|
|
38
|
-
if (!existing) return;
|
|
39
|
-
registry.daemons[key] = { ...existing, sessionId, ...bundleId ? { bundleId } : {} };
|
|
40
|
-
saveDaemonRegistry(registry, stateFile);
|
|
41
|
-
}
|
|
42
|
-
function unregisterWarmDaemon(kind, deviceId, stateFile = defaultDaemonStatePath()) {
|
|
43
|
-
const registry = loadDaemonRegistry(stateFile);
|
|
44
|
-
delete registry.daemons[daemonKey(kind, deviceId)];
|
|
45
|
-
saveDaemonRegistry(registry, stateFile);
|
|
46
|
-
}
|
|
47
|
-
function listWarmDaemons(stateFile = defaultDaemonStatePath()) {
|
|
48
|
-
return Object.values(loadDaemonRegistry(stateFile).daemons);
|
|
49
|
-
}
|
|
50
|
-
function isPidAlive(pid) {
|
|
51
|
-
if (!pid || pid <= 0) return false;
|
|
52
|
-
try {
|
|
53
|
-
process.kill(pid, 0);
|
|
54
|
-
return true;
|
|
55
|
-
} catch {
|
|
56
|
-
return false;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
async function getHealthyWarmDaemon(kind, deviceId, options = {}) {
|
|
60
|
-
const stateFile = options.stateFile ?? defaultDaemonStatePath();
|
|
61
|
-
const fetchFn = options.fetchFn ?? fetch;
|
|
62
|
-
const timeoutMs = options.timeoutMs ?? 1500;
|
|
63
|
-
const statusPath = options.statusPath ?? (kind === "chromium" ? "/json/version" : "/status");
|
|
64
|
-
const registry = loadDaemonRegistry(stateFile);
|
|
65
|
-
const record = registry.daemons[daemonKey(kind, deviceId)];
|
|
66
|
-
if (!record) return null;
|
|
67
|
-
try {
|
|
68
|
-
const controller = new AbortController();
|
|
69
|
-
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
70
|
-
try {
|
|
71
|
-
const res = await fetchFn(`http://${record.host}:${record.port}${statusPath}`, {
|
|
72
|
-
signal: controller.signal
|
|
73
|
-
});
|
|
74
|
-
if (res.ok) {
|
|
75
|
-
return record;
|
|
76
|
-
}
|
|
77
|
-
} finally {
|
|
78
|
-
clearTimeout(timer);
|
|
79
|
-
}
|
|
80
|
-
} catch {
|
|
81
|
-
}
|
|
82
|
-
delete registry.daemons[daemonKey(kind, deviceId)];
|
|
83
|
-
saveDaemonRegistry(registry, stateFile);
|
|
84
|
-
return null;
|
|
85
|
-
}
|
|
86
|
-
function stopWarmDaemon(kind, deviceId, stateFile = defaultDaemonStatePath()) {
|
|
87
|
-
const registry = loadDaemonRegistry(stateFile);
|
|
88
|
-
const key = daemonKey(kind, deviceId);
|
|
89
|
-
const record = registry.daemons[key];
|
|
90
|
-
if (!record) return false;
|
|
91
|
-
for (const pid of [record.pid, record.tunnelPid]) {
|
|
92
|
-
if (pid && pid > 0) {
|
|
93
|
-
try {
|
|
94
|
-
process.kill(pid);
|
|
95
|
-
} catch {
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
delete registry.daemons[key];
|
|
100
|
-
saveDaemonRegistry(registry, stateFile);
|
|
101
|
-
return true;
|
|
102
|
-
}
|
|
103
|
-
function stopAllWarmDaemons(stateFile = defaultDaemonStatePath()) {
|
|
104
|
-
const records = listWarmDaemons(stateFile);
|
|
105
|
-
let stopped = 0;
|
|
106
|
-
for (const record of records) {
|
|
107
|
-
if (stopWarmDaemon(record.kind, record.deviceId, stateFile)) {
|
|
108
|
-
stopped++;
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
return stopped;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
export {
|
|
115
|
-
defaultDaemonStatePath,
|
|
116
|
-
loadDaemonRegistry,
|
|
117
|
-
saveDaemonRegistry,
|
|
118
|
-
registerWarmDaemon,
|
|
119
|
-
updateWarmDaemonSession,
|
|
120
|
-
unregisterWarmDaemon,
|
|
121
|
-
listWarmDaemons,
|
|
122
|
-
isPidAlive,
|
|
123
|
-
getHealthyWarmDaemon,
|
|
124
|
-
stopWarmDaemon,
|
|
125
|
-
stopAllWarmDaemons
|
|
126
|
-
};
|
|
127
|
-
//# sourceMappingURL=chunk-DTNK54C2.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/runtime/daemon-manager.ts"],"sourcesContent":["import { existsSync, mkdirSync, readFileSync, writeFileSync } from \"node:fs\";\nimport { tmpdir } from \"node:os\";\nimport { dirname, join } from \"node:path\";\n\nexport type WarmDaemonKind = \"wda\" | \"uiautomator2\" | \"iproxy\" | \"chromium\";\n\nexport interface WarmDaemonRecord {\n kind: WarmDaemonKind;\n deviceId: string;\n host: string;\n port: number;\n pid?: number;\n tunnelPid?: number;\n xctestrunPath?: string;\n /** Optional reusable WDA/UiAutomator2 session ID persisted across runs */\n sessionId?: string;\n bundleId?: string;\n startedAt: string;\n}\n\ninterface DaemonRegistryFile {\n version: 1;\n daemons: Record<string, WarmDaemonRecord>;\n}\n\nexport function defaultDaemonStatePath(): string {\n return join(tmpdir(), \"spana-warm-daemons.json\");\n}\n\nfunction daemonKey(kind: WarmDaemonKind, deviceId: string): string {\n return `${kind}:${deviceId}`;\n}\n\nexport function loadDaemonRegistry(stateFile = defaultDaemonStatePath()): DaemonRegistryFile {\n if (!existsSync(stateFile)) {\n return { version: 1, daemons: {} };\n }\n try {\n const raw = readFileSync(stateFile, \"utf-8\");\n const parsed = JSON.parse(raw) as DaemonRegistryFile;\n if (parsed && parsed.version === 1 && typeof parsed.daemons === \"object\") {\n return parsed;\n }\n } catch {\n // corrupted state file — reset cleanly\n }\n return { version: 1, daemons: {} };\n}\n\nexport function saveDaemonRegistry(\n registry: DaemonRegistryFile,\n stateFile = defaultDaemonStatePath(),\n): void {\n mkdirSync(dirname(stateFile), { recursive: true });\n writeFileSync(stateFile, JSON.stringify(registry, null, 2), \"utf-8\");\n}\n\nexport function registerWarmDaemon(\n record: WarmDaemonRecord,\n stateFile = defaultDaemonStatePath(),\n): void {\n const registry = loadDaemonRegistry(stateFile);\n registry.daemons[daemonKey(record.kind, record.deviceId)] = record;\n saveDaemonRegistry(registry, stateFile);\n}\n\n/** Persist a warm WDA/UiAutomator2 session ID on an existing daemon record for cross-run reuse. */\nexport function updateWarmDaemonSession(\n kind: WarmDaemonKind,\n deviceId: string,\n sessionId: string,\n bundleId?: string,\n stateFile = defaultDaemonStatePath(),\n): void {\n const registry = loadDaemonRegistry(stateFile);\n const key = daemonKey(kind, deviceId);\n const existing = registry.daemons[key];\n if (!existing) return;\n registry.daemons[key] = { ...existing, sessionId, ...(bundleId ? { bundleId } : {}) };\n saveDaemonRegistry(registry, stateFile);\n}\n\nexport function unregisterWarmDaemon(\n kind: WarmDaemonKind,\n deviceId: string,\n stateFile = defaultDaemonStatePath(),\n): void {\n const registry = loadDaemonRegistry(stateFile);\n delete registry.daemons[daemonKey(kind, deviceId)];\n saveDaemonRegistry(registry, stateFile);\n}\n\nexport function listWarmDaemons(stateFile = defaultDaemonStatePath()): WarmDaemonRecord[] {\n return Object.values(loadDaemonRegistry(stateFile).daemons);\n}\n\nexport function isPidAlive(pid: number | undefined): boolean {\n if (!pid || pid <= 0) return false;\n try {\n process.kill(pid, 0);\n return true;\n } catch {\n return false;\n }\n}\n\n/**\n * Probe whether a recorded warm WDA / UiAutomator2 daemon is still healthy on\n * `GET http://<host>:<port>/status`. Removes stale records automatically.\n */\nexport async function getHealthyWarmDaemon(\n kind: WarmDaemonKind,\n deviceId: string,\n options: {\n stateFile?: string;\n fetchFn?: typeof fetch;\n timeoutMs?: number;\n /** HTTP health endpoint path (default: \"/status\", use \"/json/version\" for chromium). */\n statusPath?: string;\n } = {},\n): Promise<WarmDaemonRecord | null> {\n const stateFile = options.stateFile ?? defaultDaemonStatePath();\n const fetchFn = options.fetchFn ?? fetch;\n const timeoutMs = options.timeoutMs ?? 1500;\n const statusPath = options.statusPath ?? (kind === \"chromium\" ? \"/json/version\" : \"/status\");\n\n const registry = loadDaemonRegistry(stateFile);\n const record = registry.daemons[daemonKey(kind, deviceId)];\n if (!record) return null;\n\n try {\n const controller = new AbortController();\n const timer = setTimeout(() => controller.abort(), timeoutMs);\n try {\n const res = await fetchFn(`http://${record.host}:${record.port}${statusPath}`, {\n signal: controller.signal,\n });\n if (res.ok) {\n return record;\n }\n } finally {\n clearTimeout(timer);\n }\n } catch {\n // unreachable — prune stale entry\n }\n\n delete registry.daemons[daemonKey(kind, deviceId)];\n saveDaemonRegistry(registry, stateFile);\n return null;\n}\n\n/**\n * Stop only the specific process PIDs started by Spana for this daemon record.\n */\nexport function stopWarmDaemon(\n kind: WarmDaemonKind,\n deviceId: string,\n stateFile = defaultDaemonStatePath(),\n): boolean {\n const registry = loadDaemonRegistry(stateFile);\n const key = daemonKey(kind, deviceId);\n const record = registry.daemons[key];\n if (!record) return false;\n\n for (const pid of [record.pid, record.tunnelPid]) {\n if (pid && pid > 0) {\n try {\n process.kill(pid);\n } catch {\n // already exited\n }\n }\n }\n\n delete registry.daemons[key];\n saveDaemonRegistry(registry, stateFile);\n return true;\n}\n\nexport function stopAllWarmDaemons(stateFile = defaultDaemonStatePath()): number {\n const records = listWarmDaemons(stateFile);\n let stopped = 0;\n for (const record of records) {\n if (stopWarmDaemon(record.kind, record.deviceId, stateFile)) {\n stopped++;\n }\n }\n return stopped;\n}\n"],"mappings":";AAAA,SAAS,YAAY,WAAW,cAAc,qBAAqB;AACnE,SAAS,cAAc;AACvB,SAAS,SAAS,YAAY;AAuBvB,SAAS,yBAAiC;AAC/C,SAAO,KAAK,OAAO,GAAG,yBAAyB;AACjD;AAEA,SAAS,UAAU,MAAsB,UAA0B;AACjE,SAAO,GAAG,IAAI,IAAI,QAAQ;AAC5B;AAEO,SAAS,mBAAmB,YAAY,uBAAuB,GAAuB;AAC3F,MAAI,CAAC,WAAW,SAAS,GAAG;AAC1B,WAAO,EAAE,SAAS,GAAG,SAAS,CAAC,EAAE;AAAA,EACnC;AACA,MAAI;AACF,UAAM,MAAM,aAAa,WAAW,OAAO;AAC3C,UAAM,SAAS,KAAK,MAAM,GAAG;AAC7B,QAAI,UAAU,OAAO,YAAY,KAAK,OAAO,OAAO,YAAY,UAAU;AACxE,aAAO;AAAA,IACT;AAAA,EACF,QAAQ;AAAA,EAER;AACA,SAAO,EAAE,SAAS,GAAG,SAAS,CAAC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MAAM,OAAO,UAAU,SAAS,GAAG;AAC3D;AAAA,IACF;AAAA,EACF;AACA,SAAO;AACT;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/device/android.ts"],"sourcesContent":["import { execFileSync, execSync } from \"node:child_process\";\n\nexport interface AndroidDevice {\n serial: string;\n state: string; // \"device\", \"offline\", \"unauthorized\"\n type: \"emulator\" | \"device\";\n}\n\n/** Find the adb binary */\nexport function findADB(): string | null {\n // Check common locations\n const candidates = [\n \"adb\", // on PATH\n `${process.env.ANDROID_HOME}/platform-tools/adb`,\n `${process.env.ANDROID_SDK_ROOT}/platform-tools/adb`,\n \"/usr/local/bin/adb\",\n `${process.env.HOME}/Library/Android/sdk/platform-tools/adb`,\n ];\n\n for (const candidate of candidates) {\n if (!candidate) continue;\n try {\n execSync(`${candidate} version`, { stdio: \"ignore\" });\n return candidate;\n } catch {\n // try next\n }\n }\n return null;\n}\n\n/** List connected Android devices */\nexport function listAndroidDevices(): AndroidDevice[] {\n const adb = findADB();\n if (!adb) return [];\n\n try {\n const output = execSync(`${adb} devices`, { encoding: \"utf-8\" });\n return parseDeviceList(output);\n } catch {\n return [];\n }\n}\n\nfunction parseDeviceList(output: string): AndroidDevice[] {\n const devices: AndroidDevice[] = [];\n const lines = output.split(\"\\n\");\n\n for (const line of lines) {\n const trimmed = line.trim();\n if (!trimmed || trimmed.startsWith(\"List of\")) continue;\n\n const parts = trimmed.split(/\\s+/);\n if (parts.length < 2) continue;\n\n const serial = parts[0]!;\n const state = parts[1]!;\n\n devices.push({\n serial,\n state,\n type: serial.startsWith(\"emulator-\") ? \"emulator\" : \"device\",\n });\n }\n\n return devices;\n}\n\nfunction shellQuote(value: string): string {\n return `'${value.replaceAll(\"'\", \"'\\\\''\")}'`;\n}\n\n/** Get first available (state === \"device\") Android device */\nexport function firstAndroidDevice(): AndroidDevice | null {\n const devices = listAndroidDevices();\n return devices.find((d) => d.state === \"device\") ?? null;\n}\n\n/** Find the emulator binary */\nexport function findEmulator(): string | null {\n const candidates = [\n \"emulator\",\n `${process.env.ANDROID_HOME}/emulator/emulator`,\n `${process.env.ANDROID_SDK_ROOT}/emulator/emulator`,\n `${process.env.HOME}/Library/Android/sdk/emulator/emulator`,\n ];\n for (const candidate of candidates) {\n if (!candidate) continue;\n try {\n execSync(`${candidate} -version`, { stdio: \"ignore\" });\n return candidate;\n } catch {\n // try next\n }\n }\n return null;\n}\n\n/** List available Android Virtual Devices */\nexport function listAVDs(): string[] {\n const emulator = findEmulator();\n if (!emulator) return [];\n try {\n const output = execSync(`${emulator} -list-avds`, { encoding: \"utf-8\" });\n return output\n .split(\"\\n\")\n .map((l) => l.trim())\n .filter(Boolean);\n } catch {\n return [];\n }\n}\n\n/**\n * Start an Android emulator and wait for it to boot.\n * Returns the device serial (e.g. \"emulator-5554\") once ready.\n */\nexport function startEmulator(avdName: string, timeoutMs = 60_000): string {\n const emulator = findEmulator();\n if (!emulator) throw new Error(\"Android emulator not found\");\n\n // Launch in background\n const { spawn } = require(\"node:child_process\") as typeof import(\"node:child_process\");\n const proc = spawn(emulator, [\"-avd\", avdName, \"-no-snapshot-save\", \"-no-audio\", \"-no-window\"], {\n detached: true,\n stdio: \"ignore\",\n });\n proc.unref();\n\n // Wait for device to appear in adb\n const adb = findADB();\n if (!adb) throw new Error(\"adb not found\");\n\n const start = Date.now();\n while (Date.now() - start < timeoutMs) {\n const device = firstAndroidDevice();\n if (device) {\n // Wait for boot to complete\n try {\n const bootAnim = execSync(`${adb} -s ${device.serial} shell getprop sys.boot_completed`, {\n encoding: \"utf-8\",\n timeout: 5000,\n }).trim();\n if (bootAnim === \"1\") return device.serial;\n } catch {\n // not ready yet\n }\n }\n execSync(\"sleep 2\");\n }\n\n throw new Error(`Emulator \"${avdName}\" did not boot within ${timeoutMs / 1000}s`);\n}\n\n/**\n * Ensure an Android device is available.\n * If none connected, attempts to start the first available AVD.\n * Returns the device or null if no AVDs available.\n */\nexport function ensureAndroidDevice(timeoutMs = 60_000): AndroidDevice | null {\n const existing = firstAndroidDevice();\n if (existing) return existing;\n\n const avds = listAVDs();\n if (avds.length === 0) return null;\n\n console.log(`No Android device connected. Starting emulator \"${avds[0]}\"...`);\n const serial = startEmulator(avds[0]!, timeoutMs);\n return { serial, state: \"device\", type: \"emulator\" };\n}\n\n/** Forward a port from host to device via adb */\nexport function adbForward(serial: string, hostPort: number, devicePort: number): void {\n const adb = findADB();\n if (!adb) throw new Error(\"adb not found\");\n execSync(`${adb} -s ${serial} forward tcp:${hostPort} tcp:${devicePort}`);\n}\n\n/**\n * Reverse-forward a port from device localhost to host localhost via adb.\n * Allows both physical USB Android phones and emulators to reach Spana's\n * `spana-bridge` WebSocket server at `ws://127.0.0.1:<port>` with zero config.\n */\nexport function adbReverse(serial: string, devicePort: number, hostPort = devicePort): void {\n const adb = findADB();\n if (!adb) throw new Error(\"adb not found\");\n execSync(`${adb} -s ${serial} reverse tcp:${devicePort} tcp:${hostPort}`, { stdio: \"ignore\" });\n}\n\n/** Remove an adb reverse port mapping (best-effort). */\nexport function adbReverseRemove(serial: string, devicePort: number): void {\n const adb = findADB();\n if (!adb) return;\n try {\n execSync(`${adb} -s ${serial} reverse --remove tcp:${devicePort}`, { stdio: \"ignore\" });\n } catch {\n // mapping may already be removed\n }\n}\n\n/** Run adb shell command on device */\nexport function adbShell(serial: string, command: string): string {\n const adb = findADB();\n if (!adb) throw new Error(\"adb not found\");\n return execSync(`${adb} -s ${serial} shell ${command}`, { encoding: \"utf-8\" });\n}\n\n/** Install APK on device */\nexport function adbInstall(serial: string, apkPath: string): void {\n const adb = findADB();\n if (!adb) throw new Error(\"adb not found\");\n execSync(`${adb} -s ${serial} install -r ${apkPath}`, { stdio: \"ignore\" });\n}\n\n/** Launch an installed app via the launcher intent */\nexport function adbLaunchApp(serial: string, packageName: string): void {\n const adb = findADB();\n if (!adb) throw new Error(\"adb not found\");\n execSync(\n `${adb} -s ${serial} shell monkey -p ${packageName} -c android.intent.category.LAUNCHER 1`,\n { stdio: \"ignore\" },\n );\n}\n\n/** Force-stop an installed app */\nexport function adbForceStop(serial: string, packageName: string): void {\n const adb = findADB();\n if (!adb) throw new Error(\"adb not found\");\n execSync(`${adb} -s ${serial} shell am force-stop ${packageName}`, { stdio: \"ignore\" });\n}\n\n/** Clear app data and cache */\nexport function adbClearApp(serial: string, packageName: string): void {\n const adb = findADB();\n if (!adb) throw new Error(\"adb not found\");\n execSync(`${adb} -s ${serial} shell pm clear ${packageName}`, { stdio: \"ignore\" });\n}\n\n// ── Network control helpers ──────────────────────────────────────────\n\n/** Maps friendly profile names to ADB emulator network presets */\nexport const ADB_PROFILE_MAP: Record<string, { speed: string; delay: string }> = {\n \"2g\": { speed: \"gprs\", delay: \"gprs\" },\n edge: { speed: \"edge\", delay: \"edge\" },\n \"3g\": { speed: \"umts\", delay: \"umts\" },\n \"4g\": { speed: \"lte\", delay: \"none\" },\n wifi: { speed: \"full\", delay: \"none\" },\n};\n\n/** Toggle airplane mode on/off */\nexport function adbSetAirplaneMode(serial: string, enable: boolean): void {\n const adb = findADB();\n if (!adb) throw new Error(\"adb not found\");\n execSync(\n `${adb} -s ${serial} shell cmd connectivity airplane-mode ${enable ? \"enable\" : \"disable\"}`,\n );\n}\n\n/** Toggle Wi-Fi on/off */\nexport function adbSetWifi(serial: string, enable: boolean): void {\n const adb = findADB();\n if (!adb) throw new Error(\"adb not found\");\n execSync(`${adb} -s ${serial} shell svc wifi ${enable ? \"enable\" : \"disable\"}`);\n}\n\n/** Toggle mobile data on/off */\nexport function adbSetData(serial: string, enable: boolean): void {\n const adb = findADB();\n if (!adb) throw new Error(\"adb not found\");\n execSync(`${adb} -s ${serial} shell svc data ${enable ? \"enable\" : \"disable\"}`);\n}\n\n/** Apply a named network profile (emulator only) */\nexport function adbSetNetworkProfile(serial: string, profile: string): void {\n const adb = findADB();\n if (!adb) throw new Error(\"adb not found\");\n const mapping = ADB_PROFILE_MAP[profile];\n if (!mapping) throw new Error(`Unknown network profile \"${profile}\"`);\n execSync(`${adb} -s ${serial} emu network speed ${mapping.speed}`);\n execSync(`${adb} -s ${serial} emu network delay ${mapping.delay}`);\n}\n\n/** Apply custom network throttling (emulator only) */\nexport function adbSetCustomNetwork(\n serial: string,\n downloadKbps: number,\n uploadKbps: number,\n delayMs: number,\n): void {\n const adb = findADB();\n if (!adb) throw new Error(\"adb not found\");\n execSync(`${adb} -s ${serial} emu network speed ${downloadKbps}:${uploadKbps}`);\n execSync(`${adb} -s ${serial} emu network delay ${delayMs}:${delayMs}`);\n}\n\n/** Reset network to full speed and disable airplane mode */\nexport function adbResetNetwork(serial: string): void {\n const adb = findADB();\n if (!adb) throw new Error(\"adb not found\");\n execSync(`${adb} -s ${serial} emu network speed full`);\n execSync(`${adb} -s ${serial} emu network delay none`);\n try {\n execSync(`${adb} -s ${serial} shell cmd connectivity airplane-mode disable`);\n } catch {\n // best-effort: may fail on physical devices\n }\n}\n\n/** Open a deep link or URL on the device */\nexport function adbOpenLink(serial: string, url: string, packageName?: string): void {\n const adb = findADB();\n if (!adb) throw new Error(\"adb not found\");\n\n // FLAG_ACTIVITY_CLEAR_TOP (0x04000000) + FLAG_ACTIVITY_NEW_TASK (0x10000000)\n // ensures the deeplink resets the navigation stack\n const flags = 0x04000000 | 0x10000000;\n const command = [\n \"am\",\n \"start\",\n \"-W\",\n \"-a\",\n \"android.intent.action.VIEW\",\n \"-f\",\n String(flags),\n \"-d\",\n shellQuote(url),\n ];\n\n if (packageName) {\n command.push(shellQuote(packageName));\n }\n\n execFileSync(adb, [\"-s\", serial, \"shell\", command.join(\" \")], { stdio: \"ignore\" });\n}\n"],"mappings":";;;;;AAAA,SAAS,cAAc,gBAAgB;AAShC,SAAS,UAAyB;AAEvC,QAAM,aAAa;AAAA,IACjB;AAAA;AAAA,IACA,GAAG,QAAQ,IAAI,YAAY;AAAA,IAC3B,GAAG,QAAQ,IAAI,gBAAgB;AAAA,IAC/B;AAAA,IACA,GAAG,QAAQ,IAAI,IAAI;AAA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EAER;AACF;AAGO,SAAS,YAAY,QAAgB,KAAa,aAA4B;AACnF,QAAM,MAAM,QAAQ;AACpB,MAAI,CAAC,IAAK,OAAM,IAAI,MAAM,eAAe;AAIzC,QAAM,QAAQ,WAAa;AAC3B,QAAM,UAAU;AAAA,IACd;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,OAAO,KAAK;AAAA,IACZ;AAAA,IACA,WAAW,GAAG;AAAA,EAChB;AAEA,MAAI,aAAa;AACf,YAAQ,KAAK,WAAW,WAAW,CAAC;AAAA,EACtC;AAEA,eAAa,KAAK,CAAC,MAAM,QAAQ,SAAS,QAAQ,KAAK,GAAG,CAAC,GAAG,EAAE,OAAO,SAAS,CAAC;AACnF;","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,E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