import type { ObservationTrace } from './behavior.ts'; /** * Accumulated evidence mass for one entity. D1, D3. * * `a` and `b` are evidence mass only: the Beta(1,1) prior is structural and * lives outside them, so a fresh entity is (0, 0) and reads as exactly flat. * Both timestamps are milliseconds since the epoch: * * - `lastSeen` anchors decay (D3) * - `lastMeaningfulUpdate` anchors retention (D6) */ export type EntityState = { readonly a: number; readonly b: number; readonly lastSeen: number; readonly lastMeaningfulUpdate: number; /** * Bounded window of recent observations, for the anomaly features of D36. * * Kept beside the trust state so one store round trip serves both dimensions, * and so a purge (D22) or an expiry (D6) removes behavioral history along with * everything else rather than leaving an orphan. */ readonly window: readonly ObservationTrace[]; }; export declare function freshState(now: number): EntityState; /** * Decay factor over an elapsed interval. D3. * * lambda(dt) = 2^(-dt/H) * * Composable: lambda(dt1 + dt2) === lambda(dt1) * lambda(dt2), which is why * decaying once across a whole gap is exact rather than an approximation. */ export declare function decayFactor(elapsedMs: number, halfLifeHours?: number): number; /** Evidence mass decayed to `now`, without mutating stored state. */ export declare function decayedMass(state: EntityState, now: number, halfLifeHours?: number): { a: number; b: number; }; /** * Apply evidence. D3 write-time rule: decay to now, then add. * * The order matters. Decay-then-add is what bounds mass at * `w / (1 - lambda(T))` for arrivals every `T`; add-then-decay-on-read lets it * grow without limit. * * `positive` and `negative` are masses and must not be negative, sign is * carried by which parameter they land in, never by the number itself. D4. */ export declare function applyEvidence(state: EntityState, evidence: { positive?: number; negative?: number; }, now: number, halfLifeHours?: number): EntityState; /** Expected trust, E[p] = alpha / (alpha + beta). D2a. */ export declare function expectedTrust(state: EntityState, now: number, halfLifeHours?: number): number; /** Uncertainty, Var[p]. D2a. Flat Beta(1,1) gives 1/12. */ export declare function uncertainty(state: EntityState, now: number, halfLifeHours?: number): number; /** * Evidence mass, `n = alpha + beta`. D5 revision. * * Includes the prior, so a fresh entity reads exactly 2, which is what makes * "has any evidence arrived at all" answerable rather than inferred from the mean. */ export declare function evidenceMass(state: EntityState, now: number, halfLifeHours?: number): number; /** * Has state passed the retention horizon? D6. * * Measured from the last meaningful update, not the last sighting, so trivial * traffic cannot keep state alive indefinitely. Expiry is a retention boundary, * not a trust judgement: expired state is deleted, and the same reference * arriving later starts again from the cold-start prior. */ export declare function isExpired(state: EntityState, now: number, retentionHours: number): boolean; //# sourceMappingURL=trust.d.ts.map