/** * EvidenceRequirement — the per-type evidence schema the §5 soundness predicate * quantifies over (SDD §E; v1.1 §5; registry v0.2). One `EvidenceRequirement` * declares, for a single piece of evidence a claim depends on, how that evidence * must be owned, kept fresh, sourced, and provenance-checked. * * This module is TYPES + a runtime VALIDATOR + the source-integrity ordering. It * does NOT implement `CLAIM_ALLOWED` (that is the soundness validator, a separate * kernel deliverable — SDD §Q.3); it provides the schema those conjuncts read. * * Transcribed VERBATIM from SDD §E / v1.1 §5 — values are not re-derived, * rounded, or paraphrased (SDD zero-drift contract; §P misreadings refused). * Pure & self-contained — no kernel-downstream import (SDD §R kernel purity). */ /** * Ownership policy for one evidence requirement (SDD §E C1). * * - `"required"` — `owns(actor, e.resource)` MUST hold to validate * (ownership is a VALIDATION predicate, not read-auth). * - `"not_applicable"` — public/ownerless evidence; ownership is not gated. * * NOTE (SDD §E C0): a requirement set in which EVERY member is * `not_applicable` does not on its own auto-VALIDATE a claim — non-emptiness * (C0) is a separate, claim-level conjunct of the soundness predicate, not a * property of this field. This module validates the SHAPE of one requirement. */ export type OwnershipPolicy = "required" | "not_applicable"; /** * The `cacheable` freshness tier (SDD §E / v1.1 §5). It MUST carry its `ttl`: * a bare `cacheable` "leaves fresh(e) unenforceable" (SDD §E; v1.1 §5) because * `fresh(e)` needs the per-type window (e.g. STORE_OPEN_NOW 30s vs STORE_HOURS * 1h vs MENU_ITEM_PRICE reindex-bound). * * - `ttl: number` — a finite staleness window (seconds, per registry). * - `ttl: "reindex_bound"` — staleness floored by reindex lag, not a TTL * clock (e.g. MENU_ITEM_PRICE — registry §6). */ export interface CacheableFreshness { readonly kind: "cacheable"; readonly ttl: number | "reindex_bound"; } /** * Freshness policy for one evidence requirement (SDD §E / v1.1 §5), verbatim: * * "static" | { kind: "cacheable"; ttl: number | "reindex_bound" } * | "must_read_this_turn" | "action_outcome" * * - `"static"` — never goes stale (e.g. allergens). * - `CacheableFreshness` — cacheable WITH a mandatory ttl (see above). * - `"must_read_this_turn"` — live state; never cached, never from model memory * (requires Ledger `sourceMode == "live"` — §G). * - `"action_outcome"` — evidence = this turn's Action verdict + dispatch, * not a read (registry §3). */ export type FreshnessPolicy = "static" | CacheableFreshness | "must_read_this_turn" | "action_outcome"; /** * Source-integrity tier for one evidence requirement (SDD §E / v1.1 §5), * verbatim. Classifies the channel SHAPE of the evidence (a claim declares a * `minSourceIntegrity` FLOOR that this must clear — SDD §E C2): * * "structured" | "trusted_service" | "first_party_verified" * | "human_report" | "free_text" * * Ordering is encoded by `sourceIntegrityRank` below. */ export type SourceIntegrity = "structured" | "trusted_service" | "first_party_verified" | "human_report" | "free_text"; /** * Provenance policy for one evidence requirement (SDD §E C3 / v1.1 §5): * * - `"preserve"` — provenance survives persistence; an UNTRUSTED-origin * row stays UNTRUSTED and may never be a validating * value (SDD §J.3). Requires only a non-`UNTRUSTED_DATA` * origin (`FIRST_PARTY` or `TRUSTED_THIRD_PARTY`). * - `"first_party_only"` — only first-party-origin evidence validates: requires * `originProvenance === "FIRST_PARTY"` (a * `TRUSTED_THIRD_PARTY` origin → `REFUSED`), strictly * stronger than `preserve` (SDD §G / §J.3; e.g. payment * owner-attribution — SDD §E worked types). */ export type ProvenancePolicy = "preserve" | "first_party_only"; /** * EvidenceRequirement (SDD §E / v1.1 §5; registry v0.2) — EXACTLY these fields, * transcribed verbatim. The §5 predicate's `∀ e ∈ c.requiredEvidence` quantifies * over a set of these; each conjunct (C1 ownership, fresh, C2 integrity, C3 * provenance) reads one field here. */ export interface EvidenceRequirement { readonly key: string; readonly ownershipPolicy: OwnershipPolicy; readonly freshnessPolicy: FreshnessPolicy; readonly sourceIntegrity: SourceIntegrity; readonly provenancePolicy: ProvenancePolicy; } /** * The rank of a `SourceIntegrity` tier on the low→high ordering (SDD §E): * `free_text(0) < human_report(1) < trusted_service(2) < structured(3) ≈ * first_party_verified(3)`. Higher == higher integrity. `structured` and * `first_party_verified` return the SAME rank (the `≈` tie). Pure & total. */ export declare function sourceIntegrityRank(level: SourceIntegrity): number; /** * Floor comparator (C2): `true` iff `level` meets-or-exceeds the `floor` tier on * the source-integrity ordering (`rank(level) >= rank(floor)`). Usable as the * later `sourceIntegrity(e) >= c.minSourceIntegrity` check (SDD §E C2 / Q3). * * The `structured ≈ first_party_verified` tie means each clears a floor of the * other (equal rank satisfies `>=`). Pure & total. */ export declare function meetsSourceIntegrityFloor(level: SourceIntegrity, floor: SourceIntegrity): boolean; /** * Validate a `freshnessPolicy` value (SDD §E / v1.1 §5). * * **cacheable-requires-ttl (SDD §E; v1.1 §5; §R hard compile error):** a * `cacheable` policy MUST carry a `ttl` of `number | "reindex_bound"`. The bare * string `"cacheable"` is REJECTED (it is not a member of the union), and the * object form `{ kind: "cacheable" }` with no `ttl` is REJECTED — a bare * cacheable "leaves fresh(e) unenforceable." `{ kind: "cacheable", ttl: 30 }` * and `{ kind: "cacheable", ttl: "reindex_bound" }` are ACCEPTED. * * Pure: a deterministic predicate over the value. No clock/RNG/IO. */ export declare function isValidFreshnessPolicy(value: unknown): value is FreshnessPolicy; /** * Runtime predicate: is `value` a structurally-valid `EvidenceRequirement` * (SDD §E / v1.1 §5)? Checks every field against its closed union, and enforces * cacheable-requires-ttl via `isValidFreshnessPolicy`. Pure; no clock/RNG/IO. */ export declare function isValidEvidenceRequirement(value: unknown): value is EvidenceRequirement; /** * Parse-or-throw an `EvidenceRequirement` (SDD §E / v1.1 §5). Returns the value * narrowed to `EvidenceRequirement` when valid; throws a descriptive `Error` * otherwise (fail-closed — an ill-formed requirement must never silently pass to * the soundness predicate). The thrown message names the cacheable-requires-ttl * rule specifically when that is the cause, so the §R compile error is legible. * * Pure: deterministic over the value; no clock/RNG/IO. */ export declare function parseEvidenceRequirement(value: unknown): EvidenceRequirement; /** * The OPTIONAL falsifier-completeness declaration a claim type carries (W6; * inv.17). Additive + optional so every existing claim type compiles unchanged * and defaults to UNKNOWN-only until it opts in (W5 declares falsifiers per type). * * - `falsifierComplete` — `true` asserts the type has ENUMERATED every evidence * whose presence would falsify it. Absent/`false` ⟹ the * type is NOT complete ⟹ UNKNOWN-only (safe default). * - `falsifiers` — the enumerated falsifying evidence, each an * `EvidenceRequirement` on a (typically DIFFERENT) key. * Declaring it does NOT require the falsifier evidence to * be present; the cross-key conflict table fires only * when a falsifier value is actually present & disagrees. */ export interface FalsifierDeclaration { readonly falsifierComplete?: boolean; readonly falsifiers?: readonly EvidenceRequirement[]; } /** * Is this declaration falsifier-COMPLETE — ELIGIBLE to VALIDATE (W6)? `true` IFF * `falsifierComplete === true` AND it enumerates at least one falsifier. Pure; * the soundness eligibility cap reads exactly this. NOTE this does NOT throw on * the lying case — call {@link assertFalsifierDeclaration} for the §R hard error. */ export declare function isFalsifierComplete(decl: FalsifierDeclaration): boolean; /** * §R HARD registry-load guard for a falsifier declaration (W6) — throws ONLY on * the inconsistent LYING case: `falsifierComplete: true` while `falsifiers` is * missing/empty (a type claims it is complete yet enumerates none). Mirrors * `parseEvidenceRequirement`: fail-closed, legible message, returns the value * narrowed on success. Each declared falsifier is itself validated via * `parseEvidenceRequirement`, so a malformed falsifier hard-errors too. * * The SAFE-DEFAULT case (no `falsifierComplete`, no `falsifiers`) does NOT throw — * it is the legitimate "not yet opted in" state that the eligibility cap forces to * UNKNOWN-only. Pure: deterministic over the value; no clock/RNG/IO. */ export declare function assertFalsifierDeclaration(decl: T): T; //# sourceMappingURL=evidence-requirement.d.ts.map