/** * Deterministic Ultragoal validation applicability policy (#4560). * * The boundary cohort (`cleaner || architect || QA`) and the terminal critic * are expensive LLM lanes. They were introduced as unconditional per-boundary * ceremony, which inflates token cost and failure surface on low-risk work and * makes compaction more likely during long runs (#3473/#3474 moved review from * per-subgoal to per-boundary; this policy makes the boundary lanes * risk-proportional without removing them for risky work). * * Selection is runtime-authoritative and deterministic from durable facts * (change set, plan shape, ledger receipts) — never free-form model prose. * It fails closed: any condition that cannot be proven cheap is treated as * high-risk and keeps the full heavyweight cohort. The precedent is * `requiresComputerRedTeamSuite`, whose applicability the runtime derives from * the computed change set and refuses to let the model self-exempt. */ import { type UltragoalChangeSet, type UltragoalChangeSetPath } from "./ultragoal-change-set"; export type UltragoalValidationLane = "cleaner" | "architect" | "qa" | "terminal-critic"; export interface UltragoalValidationApplicabilityInput { /** Trusted computed change set for the boundary (checkpoint path). */ changeSet?: UltragoalChangeSet; /** * Durable aggregate shape: the number of goals the plan actually requires. * This is a property of the plan, not of how far it has progressed, so the * multi-goal risk signal cannot evaporate at the final goal of a multi-goal * run — which is precisely the aggregate boundary where risk is highest. */ requiredGoals?: number; /** Open review blockers exist (review_blocked goals). */ hasOpenReviewBlockers?: boolean; /** Newest joined cohort sourceHash recorded in the ledger. */ latestCohortSourceHash?: string; /** Current frozen source hash the boundary would review. */ currentSourceHash?: string; /** Runtime-computed digest of the authoritative current source basis. */ authoritativeSourceHash?: string; } export interface UltragoalValidationApplicability { /** Lane -> applicability decision with the durable facts that forced it. */ lanes: Record; /** True only when every heavyweight lane is applicable (full cohort). */ heavyweight: boolean; /** Risk classification driving the selection. */ riskClass: "low" | "high"; /** True when open review blockers make terminal evidence uncertain. */ hasOpenReviewBlockers: boolean; /** True when an unchanged immutable source basis permits evidence reuse. */ basisUnchanged: boolean; /** Human- and machine-inspectable selection basis, recorded in diagnostics. */ selection: string[]; } export interface UltragoalValidationLaneSelection { riskClass: "low" | "high"; reasons: string[]; omittedLanes: UltragoalValidationLane[]; } export declare function isHighRiskChangePath(row: UltragoalChangeSetPath): boolean; export declare function validationLaneSelectionFor(applicability: UltragoalValidationApplicability): UltragoalValidationLaneSelection; export declare function isMigrationChangePath(row: UltragoalChangeSetPath): boolean; /** * Compute the deterministic validation applicability for a boundary. * * Low-risk eligibility (the only case where redundant lanes may be omitted): * trusted change set, single outstanding goal, no open review blockers, no * high-risk/migration/computer/public-contract path, complete capture. * Everything else — including a missing/untrusted change set — keeps the full * heavyweight cohort exactly as today. */ export declare function resolveUltragoalValidationApplicability(input: UltragoalValidationApplicabilityInput): UltragoalValidationApplicability;