import { type CandidateConfig } from './candidate'; import { type ResolvedItem } from './resolve'; import { type VisualQaAssert, type VisualQaBundle, type VisualQaCriticResult, type VisualQaVerdict, type VisualQaVerdictItem } from './types'; export declare const HARNESS_REVISION = "vqa-1"; export interface VisualQaOptions { apiBase: string; webBase: string; token?: string | null; out?: string; storageState?: string; hostIds?: string[]; chrome?: string; submit?: boolean; localCritic?: boolean; cliVersion: string; quiet?: boolean; /** Hosted runner: submit against this job's lease (`?jobId=&leaseToken=`) instead of as a plain creator run. A run * with harness errors is NOT submitted — the caller reports it with the job's `/fail` so the job is retried. */ lease?: { jobId: string; leaseToken: string; }; /** Hosted runner: called once the item is resolved, before anything is rendered; throw to stop (e.g. version moved). */ onResolved?: (resolved: ResolvedItem) => void; /** Hosted runner: called once every browser of this render is closed and the bundle is on disk, before the critic, the * encode and the upload. The GPU is free from here, so the worker may start the next job's render while this one's * submit (server-side critic included) is still in flight. Called at most once; a throw is ignored. */ onRendered?: () => void; /** Do not wait for the CDN mirror to serve the pinned model before rendering (specs; a harness that serves its own bytes). */ skipMirrorWait?: boolean; /** Render THIS version of the item's pinned package instead of the pin (`--package-version`): a version move judged * before the pointer moves. Equal to the pin = the normal run. */ packageVersion?: string | null; /** Vehicles, with `packageVersion`: the version move's vehicle package, served by Try Now after server-side preparation. */ vehiclePackage?: Record | null; /** The world-walk stage (wearables, character add-ons, avatars). False = skip it (`--no-world-walk`). Default on. */ worldWalk?: boolean; } export interface VisualQaOutcome { verdict: VisualQaVerdict; reasons: string[]; /** Avatars: generator-limit defects of a `warn` verdict (released privately). Empty unless the server sent some. */ warnings: VisualQaVerdictItem[]; /** What stops the item, machine-readable (the server's `blockers`). Empty unless the server sent some. */ blockers: VisualQaVerdictItem[]; bundleDir: string; bundle: VisualQaBundle; critic: VisualQaCriticResult | null; contactSheet: string | null; /** Set when a version the item is not pinned to yet was rendered (`--package-version`). */ candidate?: { currentVersion: string | null; } | null; server?: { runId?: string; verdict?: VisualQaVerdict; contactSheetUrl?: string; reasons?: string[]; warnings?: VisualQaVerdictItem[]; blockers?: VisualQaVerdictItem[]; hostedJob?: unknown; } | null; /** Why a requested submit did not happen (hosted runner reads this to call `/fail`). */ submitSkipped?: 'exempt' | 'no_frames' | 'harness_errors'; timings: { renderMs: number; criticMs: number; submitMs: number; totalMs: number; }; } /** Critic checks that never block on their own (the measured occupant asserts decide a breach). */ export declare const ADVISORY_CRITIC_CHECKS: ReadonlySet; /** The local verdict rule — identical to the backend's: no harness errors and every required assert present and * passing. The critic (when it ran) is advisory: its findings come back as `advisories`, never as reasons. */ export declare function deriveVerdict(category: VisualQaBundle['item']['category'], asserts: VisualQaAssert[], errors: string[], critic: VisualQaCriticResult | null): { verdict: VisualQaVerdict; reasons: string[]; advisories: VisualQaVerdictItem[]; }; /** What the critic cannot see in a frame but must know: the measured size (a prop viewer has no ground or person * for scale) and which host/base each frame shows, and that only this one part is fitted. */ /** Errors that mean the BROWSER failed (renderer crash, frame torn down), not the item: the route is retried once. */ export declare const BROWSER_CRASH_RE: RegExp; /** How long one render (the attempt plus its crash retry) may run before the harness aborts its own browsers and reports a * harness error. The hosted runner already sets its own (possibly shorter) deadline around the whole render; this backstops * the local CLI so a hung Chromium (e.g. a browser-slot wait on a loaded box) never sits silent with an empty bundle. */ export declare function renderWatchdogMs(env?: NodeJS.ProcessEnv): number; export declare function criticContext(bundle: VisualQaBundle): string; export type RouteName = 'vehicle' | 'avatar' | 'viewer' | 'animation' | 'scene'; /** Which render route judges a category. Whole vehicles and whole avatars are rendered in the hosted test grounds (Try Now). An * emote has no body of its own (it is played on the base bodies on its item page) and a scene is walked through the way a * visitor does (the Home preview), so neither can use the prop viewer; the rest use the customiser / item viewer. */ export declare function routeFor(category: VisualQaBundle['item']['category']): RouteName; /** * Does the render browser need the judge's signed-in session? Every category but a prop always does (the customiser, Try * Now). A prop's page is public, so a PUBLISHED prop is judged as an anonymous buyer sees it; a prop that is not published * yet (born held for visual QA, e.g. a Dreamer prop) is shown only to its judges (creator, admin, the leased runner), and * its page answers an anonymous browser with a 404, which used to surface as 'no frame satisfied the probe' and burn the * hosted job's attempts. */ export declare function needsJudgeSession(category: string, itemStatus: unknown): boolean; /** * Point the runtime at a candidate version and collect what it was served. Try Now categories must see a * `trial.candidate` that matches the sealed version (it also completes the identity: version row id, and for a vehicle * the checksum the server minted); customiser categories must have had their add-ons list and the add-on's own item * read rewritten, and any version those name must be the candidate. Anything else is a harness error: a candidate run * never silently renders the current version. */ export declare function candidateWatch(resolved: ResolvedItem, token?: string | null, opts?: { worldWalk?: boolean; apiBase?: string; webBase?: string; }): { config: CandidateConfig; finish(): { errors: string[]; facts: Record; }; }; /** Thrown when the backend will not serve this login a version the item is not pinned to: a refusal, not a harness * error, and it is decided before any browser starts. */ export declare class CandidateRefusedError extends Error { } /** Ask the backend, before rendering, whether this login may see the candidate (the add-on/item preview read has the * same creator / admin / leased-runner rule as Try Now). A refusal surfaces first and alone instead of after a * browser launch as one of several harness errors. */ export declare function assertCandidateAllowed(apiBase: string, itemId: string, version: string, token: string | null): Promise; /** The account's own copy of the item (inventory instance id), or null. Best effort: no copy = a normal Try Now. */ export declare function ownedInstanceOf(apiBase: string, itemId: string, token: string): Promise; export declare function runVisualQa(itemId: string, opts: VisualQaOptions): Promise;