import { type UsagePeriod } from "./UsagePeriod.js"; export declare const USAGE_MODES: readonly ["ENFORCEMENT", "SHADOW"]; export declare const USAGE_VERDICTS: readonly ["ALLOW", "ESCALATE", "BLOCK"]; export type UsageMode = (typeof USAGE_MODES)[number]; export type UsageVerdict = (typeof USAGE_VERDICTS)[number]; /** One `EDGE_DECISION` line, as linked on the evidence chain. */ export interface UsageLine { readonly at: string; readonly mode: unknown; readonly verdict: unknown; readonly delegated: unknown; readonly jti: unknown; readonly seq: number; readonly hash: string; } /** The chain range a period's counts were taken from; all null when nothing was counted. */ export interface UsageRange { readonly first_seq: number | null; readonly first_hash: string | null; readonly last_seq: number | null; readonly last_hash: string | null; } /** What one period counted: the usage report's `counts`, `delegated`, range and `bundles`. */ export interface PeriodUsage extends UsageRange { readonly counts: { readonly by_mode: Readonly>; readonly by_verdict: Readonly>; readonly total: number; }; /** Decisions handed to Decionis (an enforcement `ESCALATE`), which Decionis meters itself. */ readonly delegated: number; /** The bundle `jti`s decided on, sorted, each once. */ readonly bundles: readonly string[]; } /** A period with nothing counted. */ export declare function emptyUsage(): PeriodUsage; /** * The count of `EDGE_DECISION` lines per UTC month, the same count whether * it is kept as lines are written or recounted later from the chain. A line * is counted in the period its `at` falls in; lines arrive in chain order, * so the first and last counted lines are the period's range. Every edge * decision is counted once in `total`; the delegated ones are also counted * in `delegated`, which Decionis subtracts because it meters those itself. */ export declare class UsageTally { private readonly periods; constructor(initial?: Readonly>); /** * Counts `line` in its period and returns that period, or null for a line * that is not a countable decision: an unknown mode or verdict, a * `delegated` that is not a boolean, a `jti` that is not a string, an `at` * that is not a time. A line outside `only`, when given, is not counted. */ add(line: UsageLine, only?: UsagePeriod): string | null; /** What `period` counted; the empty usage when it counted nothing. */ usage(period: string): PeriodUsage; /** The periods that counted anything, oldest first. */ counted(): readonly string[]; /** Forgets `period`, once its report is delivered and it is old enough to need no recount. */ forget(period: string): void; snapshot(): Readonly>; } //# sourceMappingURL=UsageTally.d.ts.map