import { type BrowserChannel } from './pinnedChrome'; import { type WebGpuSelfTest } from './webgpuSelfTest'; import type { BrowserContext, Frame, Page } from 'playwright'; import { type CandidateConfig } from './candidate'; /** The engine's line when a car cannot be composed (an add-on bind root absent, a vehicle material role with no host material, …). A string match, so it works before and after the engine names it. */ export declare const RUNTIME_FAULT_RE: RegExp; export interface VqaBrowser { ctx: BrowserContext; page: Page; fetchedAssets: string[]; pageErrors: string[]; /** * Console errors that say the runtime refused to compose the car (`[helix-vehicle] composition failed: …`). The throw * happens while the car is being composed, so it is never presented and the page raises no error of its own. */ runtimeFaults: string[]; /** The browser this session runs on, as recorded in the bundle (`harness.browser`). */ info: VqaBrowserInfo; close(): Promise; } /** `harness.browser` in every bundle: which exact build drew the frames, where it came from, and its WebGPU self-test. */ export interface VqaBrowserInfo { /** `Chrome for Testing`, `Playwright Chromium (chromium-1243)`, … */ name: string; /** Full four-part version from CDP `Browser.getVersion` (the UA string reduces it to `153.0.0.0`). */ version: string | null; executablePath: string | null; /** `pinned-cft` (the gate's own current-stable pin), `env-override` (HELIX_VQA_CHROME / HELIX_VQA_WIN_CHROME), * `explicit` (--chrome), `remote-cdp` (HELIX_VQA_CDP_URL: a browser this process did not start). */ channel: BrowserChannel; userAgent: string | null; webgpu?: { status: WebGpuSelfTest['webgpu'] | 'skipped'; adapter?: string | null; selfTest: 'pass' | 'fail' | 'skipped'; detail?: string; ms?: number; }; } export interface VqaLaunchOptions { /** Playwright storageState JSON (cookies + localStorage) of a signed-in QA account. */ storageState?: string; width?: number; height?: number; /** Explicit Chromium executable. Defaults to the pinned current-stable Chrome for Testing; the macOS system Chrome is refused. */ executablePath?: string; /** `session` = only mints a sign-in cookie (no WebGPU self-test). Default `render`. */ purpose?: 'render' | 'session'; } /** @deprecated the gate resolves the pinned Chrome for Testing (pinnedChrome.ts); kept for callers of the old export. */ export declare function defaultExecutable(playwrightDefault?: string): string | undefined; /** True when the harness should drive a Windows-native Chromium over CDP (WSL: the real GPU) instead of a Linux one. */ export declare function useWindowsChrome(): boolean; export declare function gpuArgs(platform?: NodeJS.Platform): string[]; /** Page-side hook source. Plain function so Playwright serialises it; runs before any page script in every frame. */ export declare function installHooks(): void; export declare function resetBrowserAbort(): void; export declare function abortAllBrowsers(): Promise; export declare function setCandidate(config: CandidateConfig | null): void; /** The site serves the platform runtime's addons through a cross-origin redirect (`/api/platform-runtime//` -> backend * -> CDN). A browser with ANY request interception on refuses that redirect chain for lack of an `Access-Control-Allow-Origin` * header on the first hop (the backend answers `null`), and the page dies with "Something went wrong" before the avatar or * car is ever presented. Windows Chrome over CDP on the hosted runner hit it for every candidate (version-move) render. */ export declare const PLATFORM_RUNTIME_URL_RE: RegExp; /** Fetch the platform runtime's scripts in Node (redirects followed there) and hand them back with the header. Install it * on every context that intercepts requests. */ export declare function installPlatformRuntimeCors(ctx: Pick): Promise; export declare function launchVqaBrowser(opts?: VqaLaunchOptions): Promise; /** Display name of a build, from where it lives: Playwright's bundled pre-stable build is named as such so a bundle * rendered on it can never be mistaken for the pinned stable one. */ export declare function browserName(executablePath: string | null, product: string | null): string; export declare function resetBrowserRecords(): void; /** The browser that drew this render: the first render launch, else the first launch of any kind, else null. */ export declare function renderBrowser(): VqaBrowserInfo | null; /** Distinct builds this render launched (normally one). */ export declare function distinctBrowserVersions(): string[]; /** * Launch, self-test and close one browser — the hosted worker's preflight, so a host on a broken build refuses to * claim jobs at all instead of burning each job's attempts on harness errors. */ export declare function preflightVqaBrowser(opts?: { executablePath?: string; }): Promise; /** * `HELIX_VQA_FIXTURE_MODEL==`: answer every request for that content hash with a local file, so a * deliberately broken fixture (an emissive wash-out, a twisted bone roll, torn skin weights) is drawn by the REAL runtime * through the real route. A run with a fixture always carries a harness error, so its verdict is `error` and it can never * be submitted as a pass (`runVisualQa` adds the error); it exists to prove that each assert fails on what it claims to catch. */ export declare function fixtureModel(env?: NodeJS.ProcessEnv): { hex: string; file: string; } | null; /** Pad a GLB to exactly `length` bytes with a trailing unknown-type chunk; unchanged when it cannot fit. */ export declare function padGlb(glb: Buffer, length: number): Buffer; /** Page-side (fixture runs only): a digest of bytes that begin like the fixture (after the GLB header) reports the pinned model's hash. */ export declare function fixtureDigestSpoof(arg: { prefix: string; hex: string; }): void; /** The renderer string actually in use (never inferred from flags). */ export declare function rendererInfo(page: Page): Promise; /** JPEG screenshot of the viewport (or a frame's element) after letting `settleMs` of frames render. */ export declare function captureJpeg(page: Page, file: string, settleMs?: number): Promise<{ width: number; height: number; }>; /** Find the first frame (main or iframe) where `probe` returns truthy. */ export declare function findFrame(page: Page, probe: () => unknown, timeoutMs?: number): Promise; /** * Sign a throwaway headless browser in as the CLI's own user and save its storage state, so the harness renders as * the publisher — who owns the item being judged, which the customiser needs for anything not yet listed. Uses the * website's `sso-tokens` provider, which validates the bearer server-side against /users/me (a forged token never * makes a session). Returns the username the session resolved to. */ export declare function mintStorageState(webBase: string, accessToken: string, file: string, executablePath?: string): Promise;