import type { CandidateVerification } from "./candidate-verification.js"; import type { CandidateSetStatus, ClaimTarget, Extraction, RawSource, ReviewAuthorizing, ReviewOutcome } from "./types.js"; export declare const reviewResourceApiVersion = "survey.kontourai.io/v1alpha1"; export type ReviewResourceApiVersion = typeof reviewResourceApiVersion; export type ReviewResourceKind = "ReviewItem" | "ReviewDecision" | "ReviewSession" | "ReviewSessionEvent"; export interface ResourceMetadata { name: string; uid?: string; labels?: Record; annotations?: Record; producer?: Record; } export interface ResourceEnvelope> { apiVersion: ReviewResourceApiVersion; kind: K; metadata: ResourceMetadata; spec: Spec; status?: Status; } export type CandidateRole = "current" | "proposed" | "alternative" | "source-version" | "computed"; export interface SourceReference { sourceRef: string; sourceId?: string; kind?: RawSource["kind"]; observedAt?: string; fetchedAt?: string; checksum?: string; locatorScheme?: RawSource["locatorScheme"]; } export interface ReviewLocator { scheme: RawSource["locatorScheme"]; locator?: string; excerpt?: string; } export interface ExtractionReference { extractionId?: string; target: string; confidence?: number; /** The extraction tool/pipeline that produced this candidate (e.g. a crawler or parser). */ extractor?: string; /** * The model or model-version that generated this candidate, when the producer * knows it (e.g. an LLM id or a dated extraction-model tag). Distinct from * `extractor` (the tool): a reviewer wants to know *which model* proposed a * value for trust/calibration. Producer-provided provenance; Survey only * carries and displays it. */ model?: string; extractedAt?: string; } export interface ClaimTargetHint { claimId?: string; subjectType: string; subjectId: string; /** * Producer-defined grouping or namespace for this claim (Hachure schema 5, * surface@2.0.0: Claim.surface -> Claim.facet). */ facet: string; claimType: string; fieldOrBehavior: string; impactLevel: ClaimTarget["impactLevel"]; evidenceType?: ClaimTarget["evidenceType"]; evidenceMethod?: ClaimTarget["evidenceMethod"]; collectedBy?: string; derivedFrom?: string[]; } export interface SurveyRecordProjectionHint { rawSourceId?: RawSource["id"]; extractionId?: Extraction["id"]; candidateSetId?: string; candidateId?: string; reviewOutcomeId?: ReviewOutcome["id"]; claimId?: ClaimTarget["id"]; } /** * Well-known decision-mode vocabulary for {@link ProducerPolicy.decisionMode}. * A producer declares how a ReviewItem is allowed to be resolved: * `keep-current` — only a keep-current decision is admissible. * `current-proposed` — only the current or proposed candidate may be selected. * `free-select` — any declared candidate may be selected. * Enforcement is opt-in; see `assertReviewDecisionModeAllows` and the * `enforceProducerPolicy` option on `applyReviewSession`. */ export type ReviewDecisionMode = "keep-current" | "current-proposed" | "free-select"; /** * Producer-declared policy carried on a ReviewItem. The well-known * `decisionMode` sub-key is typed and optionally enforceable; all other keys * remain opaque to Survey (tolerated via the index signature, never inspected). */ export interface ProducerPolicy { decisionMode?: ReviewDecisionMode; [key: string]: unknown; } export interface ReviewCandidate { id: string; role?: CandidateRole; value: unknown; confidence?: number; sourceRank?: number; rejectionReason?: string; source: SourceReference; locator?: ReviewLocator; extraction: ExtractionReference; claimTarget: ClaimTargetHint; projection?: SurveyRecordProjectionHint; producer?: Record; /** * Records of what independent support verifiers said about this candidate's * value (see `CandidateVerification`). A record of a verifier's output, not a * trust decision: nothing routes, accepts, or calibrates on it. Every decision * surface validates each record on read, ignores any that fail, and shows only * those bound to the value under review. */ verifications?: CandidateVerification[]; } /** * Well-known neutral value-type vocabulary for {@link ReviewValueDescriptor}. * Survey defines NO field-schema system of its own; this deliberately MIRRORS * the shape an upstream field-schema owner already uses (e.g. traverse's * `TargetFieldSchema.type` / `ExtractionProposal.valueType`), so a producer can * carry a reviewed field's declared type down to the review UI WITHOUT Survey * importing that owner's package (structural match, zero coupling). */ export type ReviewValueType = "string" | "number" | "boolean" | "date" | "enum" | "array" | "object"; /** * Optional, producer-supplied descriptor of a reviewed field's declared value * shape. Purely descriptive: the workbench uses it ONLY to pick a typed editor * (an enum `