import { type ReviewQueueSessionState, type ReviewWorkbenchDecision, type ReviewWorkbenchState } from "./review-queue-session.js"; import { type ReviewSessionReplayIssue, type ReviewSessionReplayWarning } from "./review-session-replay.js"; import { type ReviewPresentationAdapter } from "./review-presentation.js"; import { type ReviewCandidate, type ReviewDecision, type ReviewItem, type ReviewSession, type ReviewSessionEvent, type ReviewValueDescriptor } from "../review-resource.js"; import type { ExtractionEnvelopeImport, ExtractionEnvelopeImportResult } from "../extraction-envelope.js"; import type { FieldState } from "../field-states.js"; export { reviewAuditRowKeys, type ReviewAuditRowKey } from "./audit-rows.js"; export { assertReviewQueueAgainstExtractionImport, assertReviewQueueBinding, attestReviewQueueExtraction, bindReviewQueue, reviewItemCarriesExtractionBinding, unverifiedExtractionQueueSentence, hashReviewQueueSnapshot, UnattestedExtractionQueueError, UnattestedReviewQueueError, validateReviewQueueAgainstExtractionImport, validateReviewQueueBinding, type BindReviewQueueOptions, type ReviewQueueBinding, type ReviewQueueBindingIssue, type ReviewQueueBindingIssueCode, type ReviewQueueExtractionAttestation, type ReviewQueueExtractionIssue, type ReviewQueueExtractionIssueCode, type ValidateReviewQueueBindingOptions, } from "./queue-binding.js"; export { buildExtractionInspectorModel, exportExtractionInspector, filterExtractionInspectorCandidates, mountExtractionInspector, type ExtractionAlignmentState, type ArtifactUnavailableCode, type BuiltExtractionInspectorCandidate, type BuiltExtractionInspectorModel, type ExtractionInspectorCandidate, type ExtractionInspectorEntry, type ExtractionInspectorExportOptions, type ExtractionInspectorFilters, type ExtractionInspectorInput, type ExtractionInspectorMountOptions, type ExtractionInspectorModel, type ExtractionInspectorSource, type ResolvedExtractionArtifact, } from "./extraction-inspector.js"; export { renderFieldStatesHtml } from "./field-state-view.js"; export { drawRandomAuditSample, openRandomAuditSession, type RandomAuditSampleOptions, } from "./audit-sample.js"; export { buildReviewSessionEvents, buildReviewSessionEvent, buildReviewSessionResource, candidateForDecision, conflictSelectionIssue, unchosenProposedCandidates, decisionCandidateId, decisionSelectsNoCandidate, keepActionDecision, currentReviewItem, currentReviewWorkbenchState, defaultReviewSessionName, deriveQueueRowStatus, initialReviewQueueSessionState, initialReviewWorkbenchState, isScoreBlind, assertReviewSessionConditions, nextUnresolvedItemName, replayReviewSessionEvents, reviewSessionSummary, reviewWorkbenchSessionStorageKey, selectedCandidateRole, workbenchDecisionDefinitions, type ReviewSessionPresentation, type ReviewSessionSampling, type ReviewQueueRowStatus, type ReviewQueueSessionState, type ReviewSessionSummary, type ReviewWorkbenchDecision, type ReviewWorkbenchState, } from "./review-queue-session.js"; export { buildReviewCandidatePresentation, buildReviewItemPresentation, buildReviewResultPresentation, humanizeIdentifier, type ExcludedProposalPresentation, type ExcludedProposalsUnreadable, type ReviewCandidatePresentation, type ReviewCandidatePresentationContext, type ReviewItemPresentation, type ReviewItemPresentationContext, type ReviewPresentationAdapter, type ReviewPresentationLink, type ReviewResultPresentation, type ReviewTracePresentationContext, type ReviewTraceRef, type ReviewValuePresentationContext, } from "./review-presentation.js"; export { buildSurfaceProjectionPreview, type PreviewAuthorityTrace, type PreviewCandidateHistory, type PreviewClaim, type PreviewIntegrityPosture, type PreviewReviewEvent, type PreviewSourceAuthority, type PreviewSourceEvidence, type SurfaceProjectionPreview, } from "./review-surface-preview.js"; export { reviewSessionReplayWarningsForSnapshot, validateReviewSessionEventsForSnapshot, type ReviewSessionReplayIssue, type ReviewSessionReplayIssueCode, type ReviewSessionReplayWarning, } from "./review-session-replay.js"; export { checkEditedValueForItem, editedValueFromEditorText, type EditedValueCheck, } from "./edited-value.js"; export { assertReviewDecisionModeAllows, DecisionModeViolationError, validateReviewDecisionMode, type ReviewDecisionModeIssue, type ReviewDecisionModeIssueCode, type ReviewDecisionModeResult, } from "./producer-decision-mode.js"; /** * Options for building review decisions. The decision prompt is rendered from * the item when the decision is built, so pass the same presentation adapter * the card used, or the recorded prompt renders values its own way. */ export interface ReviewDecisionBuildOptions { readonly presentationAdapter?: ReviewPresentationAdapter; } export declare function buildReviewDecision(state: ReviewWorkbenchState, options?: ReviewDecisionBuildOptions): ReviewDecision | undefined; export interface ReviewWorkbenchSessionExport { readonly session: ReviewSession; readonly events: readonly ReviewSessionEvent[]; readonly decisions: readonly ReviewDecision[]; readonly results: readonly ReviewWorkbenchResult[]; } export type ReviewSessionApplyResolutionRequirement = "all" | "any" | "none"; export type ReviewSessionApplyIssue = ReviewSessionReplayIssue | { readonly code: "unresolved-review-item"; readonly reviewItemName: string; readonly message: string; } | { readonly code: "no-resolved-review-items"; readonly message: string; }; export interface DeriveReviewSessionApplyResultForSnapshotOptions { readonly snapshot: ReviewQueueSessionState; readonly events: readonly ReviewSessionEvent[]; readonly requiredResolvedItems?: ReviewSessionApplyResolutionRequirement; /** The adapter the reviewer's card used; the recorded decision prompts render values with it. */ readonly presentationAdapter?: ReviewPresentationAdapter; } export type DeriveReviewSessionApplyResultForSnapshotResult = { readonly ok: true; readonly issues: readonly []; /** Non-fatal replay notes, e.g. a legacy text edit converted to its typed value. */ readonly warnings?: readonly ReviewSessionReplayWarning[]; readonly unresolvedItemNames: readonly string[]; readonly replayedSession: ReviewQueueSessionState; readonly sessionExport: ReviewWorkbenchSessionExport; readonly decisions: readonly ReviewDecision[]; readonly results: readonly ReviewWorkbenchResult[]; } | { readonly ok: false; readonly issues: readonly ReviewSessionApplyIssue[]; readonly warnings?: readonly ReviewSessionReplayWarning[]; readonly unresolvedItemNames: readonly string[]; readonly replayedSession?: ReviewQueueSessionState; readonly sessionExport?: ReviewWorkbenchSessionExport; readonly decisions: readonly ReviewDecision[]; readonly results: readonly ReviewWorkbenchResult[]; }; export interface ReviewSessionEventStore { load(session: ReviewQueueSessionState): readonly ReviewSessionEvent[] | undefined; save(session: ReviewQueueSessionState, events: readonly ReviewSessionEvent[]): void; } export type ReviewSessionPersistenceStatus = "idle" | "saving" | "saved" | "error"; export interface ReviewSessionPersistenceState { readonly status: ReviewSessionPersistenceStatus; readonly events: readonly ReviewSessionEvent[]; readonly error?: unknown; } export interface ReviewSessionPersistenceRequest { readonly session: ReviewQueueSessionState; readonly events: readonly ReviewSessionEvent[]; readonly expectedEventCount: number; } export interface ReviewSessionPersistenceResult { readonly events?: readonly ReviewSessionEvent[]; readonly eventCount?: number; } export interface PersistReviewSessionEventsOptions { readonly session: ReviewQueueSessionState; readonly events: readonly ReviewSessionEvent[]; readonly expectedEventCount?: number; readonly persist: (request: ReviewSessionPersistenceRequest) => Promise; } export interface PersistReviewSessionEventsResult { readonly events: readonly ReviewSessionEvent[]; readonly eventCount: number; } export interface PersistentReviewSessionEventStoreOptions { readonly initialEvents?: readonly ReviewSessionEvent[]; readonly persist: (request: ReviewSessionPersistenceRequest) => Promise; readonly onStatusChange?: (state: ReviewSessionPersistenceState) => void; } /** Serializable producer-owned display hints. Never alter canonical items, events or apply authority. */ export interface ReviewQueuePresentation { readonly title?: string; readonly context?: string; readonly items?: Readonly>; }>>; } export interface MountReviewWorkbenchOptions { readonly queuePresentation?: ReviewQueuePresentation; /** A host that owns submission can hide the local apply/export control. */ readonly hideApply?: boolean; readonly eventStore?: ReviewSessionEventStore; readonly presentationAdapter?: ReviewPresentationAdapter; /** * The extraction import record the queue was built from, as stored beside * it. When supplied, the workbench checks the queue against it and refuses to * present a queue that diverges. When absent and the queue's items came from * an extraction import, the workbench shows an "Unverified queue" notice. */ readonly extractionImport?: ExtractionEnvelopeImport | ExtractionEnvelopeImportResult; /** Maximum review cards mounted at once. Defaults to 50 and is capped at 250. */ readonly pageSize?: number; /** * The queue's derived field states (`deriveFieldStates`). When supplied, a * field-state panel lists every field with its content state, lifecycle and * signals, including fields that have no review card because they were not * read. Lifecycles of queued fields follow the live session. */ readonly fieldStates?: readonly FieldState[]; } export type ReviewQueueDisposition = "all" | "unresolved" | "accepted" | "kept" | "rejected" | "could-not-confirm"; export interface ReviewQueueView { readonly query: string; readonly disposition: ReviewQueueDisposition; readonly page: number; readonly pageSize: number; } export interface ReviewQueueWindow { readonly items: readonly ReviewItem[]; readonly totalMatching: number; readonly page: number; readonly pageCount: number; readonly start: number; readonly end: number; } export interface BrowserReviewWorkbenchConfig { readonly startState?: ReviewQueueSessionState | ReviewWorkbenchState; } /** * The in-process outcome of one workbench decision, derived from the session. * For a decision that selects no candidate ({@link decisionSelectsNoCandidate}: * reject-all or could-not-confirm on a conflict), every `selected*` and * `effective*` field is absent, `unselectedCandidates` holds every candidate, * and `reviewDecision.spec.candidateId` is absent. */ export interface ReviewWorkbenchResult { readonly reviewItemName: string; readonly decision: ReviewWorkbenchDecision; readonly selectedCandidate?: ReviewCandidate; readonly selectedCandidateId?: string; readonly selectedCandidateRole?: ReviewCandidate["role"]; /** The selected candidate's original value, unaffected by any reviewer edit. Used * for candidate-identity matching (see `matchingSelectedCandidate`); consumers who * want the reviewer's edited value should read `effectiveValue` instead. */ readonly selectedValue?: unknown; readonly selectedDisplayValue?: string; /** Reviewer-edited override captured for an accept-proposed decision, if the * reviewer changed the proposed value before applying it. Additive/optional. */ readonly editedValue?: unknown; /** The value that should actually be applied: `editedValue` when present (and the * decision selects the proposed candidate), otherwise `selectedValue`. */ readonly effectiveValue?: unknown; readonly effectiveDisplayValue?: string; readonly unselectedCandidates: readonly ReviewCandidate[]; readonly reviewDecision: ReviewDecision; readonly status: ReviewDecision["spec"]["status"]; readonly rationale?: string; } export interface ReviewApplyResultExpectation { readonly decision?: ReviewWorkbenchDecision; readonly status?: ReviewDecision["spec"]["status"]; readonly selectedCandidateRole?: ReviewCandidate["role"]; readonly selectedCandidateId?: string; readonly selectedValue?: unknown; readonly equals?: (left: unknown, right: unknown) => boolean; } export interface ReviewApplyActionMapping { readonly result: ReviewWorkbenchResult; readonly item: ReviewItem; readonly action: TAction; } export type ReviewApplyActionIssue = { readonly code: "unknown-review-item"; readonly reviewItemName: string; readonly message: string; } | { readonly code: "duplicate-review-target"; readonly target: string; readonly message: string; } | { readonly code: "selected-candidate-mismatch"; readonly reviewItemName: string; readonly message: string; } | { readonly code: "unmapped-review-result"; readonly reviewItemName: string; readonly message: string; }; export declare class ReviewApplyActionMappingError extends Error { readonly name = "ReviewApplyActionMappingError"; readonly issues: readonly ReviewApplyActionIssue[]; constructor(issues: readonly ReviewApplyActionIssue[]); } export interface ReviewApplyActionContext { readonly result: ReviewWorkbenchResult; readonly item: ReviewItem; readonly target: ReviewItem["spec"]["target"]; readonly selectedCandidate: ReviewCandidate; readonly unselectedCandidates: readonly ReviewCandidate[]; } export interface MapReviewWorkbenchResultsToApplyActionsOptions { readonly results: readonly ReviewWorkbenchResult[]; readonly items: readonly ReviewItem[]; readonly requireUniqueTargets?: boolean; readonly skip?: (context: ReviewApplyActionContext) => boolean; readonly map: (context: ReviewApplyActionContext) => TAction | readonly TAction[] | undefined; } export declare function buildReviewDecisionsFromSession(session: ReviewQueueSessionState, options?: ReviewDecisionBuildOptions): ReviewDecision[]; export declare function requireReviewResultForItem(item: ReviewItem, results: readonly ReviewWorkbenchResult[]): ReviewWorkbenchResult; export declare function assertReviewResultMatches(result: ReviewWorkbenchResult, expectation: ReviewApplyResultExpectation): void; export declare function mapReviewWorkbenchResultsToApplyActions(options: MapReviewWorkbenchResultsToApplyActionsOptions): ReviewApplyActionMapping[]; export declare const mapReviewApplyActions: typeof mapReviewWorkbenchResultsToApplyActions; export declare function buildReviewWorkbenchResultsFromSession(session: ReviewQueueSessionState, options?: ReviewDecisionBuildOptions): ReviewWorkbenchResult[]; export declare function buildReviewWorkbenchSessionExport(session: ReviewQueueSessionState, events?: readonly ReviewSessionEvent[], options?: ReviewDecisionBuildOptions): ReviewWorkbenchSessionExport; export declare function replayReviewSessionEventsForSnapshot(snapshot: ReviewQueueSessionState, events: readonly ReviewSessionEvent[]): ReviewQueueSessionState; export declare function buildReviewWorkbenchSessionExportForSnapshot(snapshot: ReviewQueueSessionState, events: readonly ReviewSessionEvent[], options?: ReviewDecisionBuildOptions): ReviewWorkbenchSessionExport; export declare function deriveReviewSessionApplyResultForSnapshot(options: DeriveReviewSessionApplyResultForSnapshotOptions): DeriveReviewSessionApplyResultForSnapshotResult; export declare function createInMemoryReviewSessionEventStore(initialEvents?: readonly ReviewSessionEvent[]): ReviewSessionEventStore & { events(): readonly ReviewSessionEvent[]; }; export declare function createLocalStorageReviewSessionEventStore(storage: Pick, keyPrefix?: string): ReviewSessionEventStore; export declare function persistReviewSessionEvents(options: PersistReviewSessionEventsOptions): Promise; export declare function createPersistentReviewSessionEventStore(options: PersistentReviewSessionEventStoreOptions): ReviewSessionEventStore & { events(): readonly ReviewSessionEvent[]; }; export declare function renderReviewWorkbenchHtml(state: ReviewWorkbenchState | ReviewQueueSessionState, _events?: readonly ReviewSessionEvent[], options?: { readonly presentationAdapter?: ReviewPresentationAdapter; readonly queueView?: Partial; readonly queuePresentation?: ReviewQueuePresentation; readonly hideApply?: boolean; /** See {@link MountReviewWorkbenchOptions.extractionImport}. */ readonly extractionImport?: ExtractionEnvelopeImport | ExtractionEnvelopeImportResult; /** See {@link MountReviewWorkbenchOptions.fieldStates}. */ readonly fieldStates?: readonly FieldState[]; }): string; export declare function buildReviewQueueWindow(session: ReviewQueueSessionState, view?: Partial): ReviewQueueWindow; /** * Validates a reviewer's raw (string) edit of a proposed value against the * field's neutral {@link ReviewValueDescriptor}, returning a human-readable * error message when the value violates the declared type/enum constraint, or * `undefined` when it is acceptable — including when there is no descriptor or * the type carries no single-line constraint (string/array/object). This is a * FORMAT check on the editor text; on accept the workbench stores the text * converted to the descriptor's JSON type (`editedValueFromEditorText`). */ export declare function validateProposedValue(descriptor: ReviewValueDescriptor | undefined, rawValue: string): string | undefined; export declare function mountReviewWorkbench(root: HTMLElement, startState?: ReviewQueueSessionState | ReviewWorkbenchState, options?: MountReviewWorkbenchOptions): void; export declare function browserReviewWorkbenchStartState(): ReviewQueueSessionState | ReviewWorkbenchState | undefined; declare global { interface Window { kontourSurveyReviewWorkbench?: BrowserReviewWorkbenchConfig | ReviewQueueSessionState | ReviewWorkbenchState; } }