import { type MonotonicityOutcome, type StateMarker, type StateMarkerScope, type UnplaceableDisposition } from './types.js'; /** Thrown when a caller asks for a marker the vocabulary does not allow. A shape rule * broken at construction is a programming error, not a verdict. Mirrors * `LifecycleStateError` in src/v2/lifecycle-state/. */ export declare class AuthorityStateError extends Error { readonly code: string; constructor(code: string, message: string); } export declare function isStateMarkerScope(value: unknown): value is StateMarkerScope; export declare function isMonotonicityOutcome(value: unknown): value is MonotonicityOutcome; export declare function isUnplaceableDisposition(value: unknown): value is UnplaceableDisposition; export interface StateMarkerInput { readonly value: string; readonly scope: StateMarkerScope; readonly scope_ref?: string; } /** * Build a `StateMarker`, enforcing its shape rules. * * 1. `value` is a canonical unsigned decimal integer, as a string. A number would lose * exactness past 2^53 - 1 and would admit `1.0`, `1e3` and `-1`, none of which orders * the way a generation counter has to. * 2. `scope` is one of the four. There is no fifth and there is no default: which thing a * generation is counted within is the choice the proposed text does not make, so it has * to be stated rather than assumed. * 3. `scope_ref` is present and non-empty exactly when `scope` is not `global`. A * per-delegation marker that does not say which delegation cannot be compared against * anything. * * Proposed. Concept source: aeoess/agent-authority-lifecycle, `Authority epoch`. */ export declare function stateMarker(input: StateMarkerInput): StateMarker; /** Whether two markers are counted in the same thing and can therefore be ordered. */ export declare function sameScope(a: StateMarker, b: StateMarker): boolean; /** * Place a presented marker against what a verifier has established. * * | established | presented | outcome | * |-------------|--------------------|---------------| * | `null` | any | `unplaceable` | * | any | `null` | `unplaceable` | * | any | a different scope | `unplaceable` | * | m | >= m | `forward` | * | m | < m | `regressed` | * * Equal is `forward`, not a third thing: a view that has not moved has not gone backwards. * * `unplaceable` is where the honesty of the whole module sits. It is returned for a first * read and for a cross-scope comparison, it is NOT a verdict, and nothing downstream turns * it into one on its own. The proposed text gives a verifier with no prior observation * nothing to compare against and does not say whether such a read is trusted or refused. * * Comparison is integer, through BigInt, never lexical: "10" is after "9". * * Never throws for a malformed marker. A marker this function cannot read is one it cannot * place, which is `unplaceable`, and throwing on the read path of a state comparison would * turn a data problem into a crash in a verifier. */ export declare function compareStateMarker(established: StateMarker | null | undefined, presented: StateMarker | null | undefined): MonotonicityOutcome; /** * The high-water mark a verifier holds after reading a presented view. * * It only ever moves forward. A regressed view does not lower it, an unplaceable view does * not replace it, and a verifier that had none adopts the presented one. This is the * "monotonicity against what the verifier has established" limb of CAND-08, which is * weaker than a rule against global truth and is the honest strength available: a verifier * that has never seen the newer state cannot detect a regression and is not at fault. */ export declare function advanceHighWaterMark(established: StateMarker | null | undefined, presented: StateMarker | null | undefined): StateMarker | null; //# sourceMappingURL=marker.d.ts.map