import type { RunAdapterArtifact, RunAdapterScore, RunBundle, RunFeedbackCandidate, RunScorerProvenance } from "./run.js"; export type BrowserAdapterBackend = "cua" | "shared-world" | "concurrent-shared-world"; /** * Product-agnostic scoring context for browser/computer-use lanes. Product-specific * evidence/rubrics stay in the adopter's repo; core provides the assembled bundle * plus stable run identifiers and never learns product nouns. */ export interface BrowserLabScoringContext { bundle: RunBundle; /** * Absolute path to the ignored run directory. Adapter hooks may write their * own product/state proof files here, then return relative references through * `deriveArtifacts`. This path is runtime-only and must never be persisted. */ runDir: string; labId: string; runId: string; actor: string; backend: BrowserAdapterBackend; dryRun: boolean; laneCount: number; } export interface BrowserLabAdapterHooks { /** * Browser-route extension seam (#165): a thin adapter may score the assembled * browser/shared-world evidence without forking core. The score is stored as * namespaced `bundle.adapterScore`; product-specific component detail belongs * in `data`, not in core enums or review text. */ score?: (ctx: BrowserLabScoringContext) => RunAdapterScore | Promise; /** * Companion seam for public-safe, adapter-namespaced feedback candidates. * Malformed candidates are dropped before bundle persistence so core remains * verifiable even when an adapter misbehaves. */ deriveFeedback?: (ctx: BrowserLabScoringContext) => RunFeedbackCandidate[] | Promise; /** * Optional product/state proof artifact references. The adapter writes files * under `ctx.runDir` and returns local relative paths. Core stores only the * namespaced references and `verify` fails closed if referenced files are * missing or nonlocal. */ deriveArtifacts?: (ctx: BrowserLabScoringContext) => RunAdapterArtifact[] | Promise; } export declare function applyBrowserAdapterHooks(args: { hooks: BrowserLabAdapterHooks | undefined; context: BrowserLabScoringContext; bundle: RunBundle; sanitize: (text: string) => string; warnings: string[]; hookLabel: string; /** Present only when the scorer was CONFIG-DECLARED (#316); core-stamped onto the bundle as * evidence of which out-of-tree module was loaded. Absent for library callers. Its presence also * opts a THROWING or MALFORMED scorer into the declared-gate downgrade — a declared gate that * cannot render a pass is a fail, never a silent green. */ scorerProvenance?: RunScorerProvenance; }): Promise<{ declaredVerdictFailure?: string; }>; export declare function adapterScoreFailureMessage(bundle: RunBundle): string | undefined; export declare function applyAdapterScoreFailureToReview(bundle: RunBundle): string | undefined; /** * A CONFIG-DECLARED scorer (#316) that fails to render a PASS verdict — it returned status:"fail", * threw, or returned a malformed value — must never leave a silent green (the declared-gate invariant: * a gate that cannot render a pass is a fail, never a silent pass). Adds a review gap and downgrades a * would-be pass/contract_proof_only to fail (this ONLY ever makes the verdict STRICTER). Callers gate * on `declared`, so library callers are never affected. */ export declare function recordDeclaredScorerVerdictFailure(bundle: RunBundle, reason: string): void; /** * Deep-freeze a structured clone so a loaded scorer sees a READ-ONLY bundle: it cannot mutate * noSpend/cost/review in place to launder a verdict (which would defeat the costProbe-not-loadable * guarantee). A tamper attempt throws in the scorer's strict-mode ESM and is caught as a hook failure. * Legitimate read-only scoring is unaffected. The seam always stamps the REAL bundle, never this view. */ export declare function frozenBundleView(bundle: RunBundle): RunBundle;