import { type SelectionCacheOptions } from "./selection-cache.js"; /** Bounded so one receipt can never carry an unbounded drift list. */ export declare const PROVENANCE_DRIFT_LIMIT = 200; export type SelectionProvenanceStatus = "current" | "behind" | "pinned" | "unverified"; export type SelectionProvenanceSource = "local-receipt" | "authority-receipt" | "session-receipt"; export type SelectionProvenanceReference = "authority" | "synced-snapshot" | "unavailable"; /** * The fixed diagnostic vocabulary. A reader's exception text is never carried, * only one of these codes, so a foreign body or a credential inside an error * string cannot reach a receipt that may be shared. */ export type SelectionProvenanceReason = "CURRENT_SCHEMA_MATCH" | "REVISION_BEHIND" | "PINNED_BY_DESIGN" | "IDENTITY_MISMATCH" | "INCOMPLETE_RECEIPT" | "DIFFERENT_PROFILE" | "NO_LOCAL_RECEIPT" | "NO_SESSION_NAMED" | "NO_SESSION_RECEIPT" | "NO_STATION_RECEIPT" | "READ_REFUSED" | "REFERENCE_FROM_AUTHORITY" | "REFERENCE_NOT_AUTHORITY" | "REFERENCE_UNAVAILABLE" | "NO_STATION_REPORTED"; export interface SelectionProvenanceVersion { slug: string; version: string; bundleDigest?: string; } export interface SelectionProvenanceConsumer { kind: "station" | "session"; source: SelectionProvenanceSource; /** The local host for a local receipt, the requested station only for the authority receipt. */ id: string; /** Whether `id` names the host running this command or a station named on the command line. */ idKind: "local-host" | "requested-station"; profileId?: string; profileRevision?: string; /** Compared, never assumed: a matching revision under another identity is not current. */ authority?: string; workspaceId?: string; observedAt?: string; selectionCount?: number; /** Only for a session: how many of its selections it really loaded. */ loadedCount?: number; /** Only for a session: the exact versions it really loaded. */ consumed?: SelectionProvenanceVersion[]; status: SelectionProvenanceStatus; reasonCode: SelectionProvenanceReason; reason: string; } export interface SelectionProvenanceDrift { source: SelectionProvenanceSource; id: string; slug: string; selectedVersion: string; observedVersion: string; } export interface SelectionProvenanceReceipt { schemaVersion: 1; readOnly: true; selectionProfile: string; selected: { profileId: string; profileRevision?: string; selectionCount?: number; authority?: string; workspaceId?: string; source: SelectionProvenanceReference; observedAt?: string; reasonCode: SelectionProvenanceReason; reason: string; }; consumers: SelectionProvenanceConsumer[]; drift: SelectionProvenanceDrift[]; driftTruncated: boolean; /** * What this receipt deliberately does not attest. Version and digest evidence * for published payloads, native discovery, native locks and live consumer * adoption are outside this command and stay unverified here rather than being * implied by a clean-looking result. */ notAttested: string[]; } export interface SelectionProvenanceInput { profileId: string; /** The station whose authority-held sync receipt is read. */ stationId: string; /** The host this command runs on. Never conflated with `stationId`. */ localStationId: string; sessionId?: string; /** Read the reference from the locally synced snapshot; never ask the authority. */ cached?: boolean; } /** A station receipt reduced to what this receipt compares. */ export interface ProvenanceStationObservation { profileId: string; profileRevision: string; appliedAt: string; workspaceId?: string; selections: readonly { slug: string; version: string; }[]; } export interface SelectionProvenanceOptions extends SelectionCacheOptions { /** Injected by the SDK and tests; defaults to the authenticated reads. */ readSelected?: (profileId: string) => Promise<{ profileId: string; profileRevision: string; authority?: string; workspaceId?: string; selections: readonly { slug: string; version: string; }[]; }>; readStation?: (stationId: string) => Promise; } export declare function readSelectionProvenance(input: SelectionProvenanceInput, options?: SelectionProvenanceOptions): Promise;