import { type PeriodUsage } from "./UsageTally.js"; import type { UsagePeriod } from "./UsagePeriod.js"; export type UsageFindingCode = "CHAIN_LINE_INVALID" | "CHAIN_HASH_MISMATCH" | "CHAIN_HEAD_UNKNOWN" | "CHAIN_START_MISSING" | "CHAIN_RANGE_BROKEN" | "USAGE_MISMATCH"; export interface UsageFinding { readonly code: UsageFindingCode; /** One-based position in the input, for a finding about one line. */ readonly line?: number; } export interface UsageCount { readonly ok: boolean; readonly usage: PeriodUsage; readonly findings: readonly UsageFinding[]; } /** * Counts a period's edge decisions from collected log lines: the chain of * `stream` that ends at `head` (the last line in the input unless named) is * walked back to its start, and the `EDGE_DECISION` lines on it whose `at` * falls in the period are counted. A tampered line anywhere in the stream, * or a chain that is cut off after the period began, is a finding, and a * report is not made from it. */ export declare function countUsage(lines: Iterable, options: { readonly stream: string; readonly period: UsagePeriod; readonly head?: string; }): UsageCount; /** What a usage report claims about its range and counts. */ export interface ClaimedUsage extends PeriodUsage { readonly stream: string; } /** * Recounts a report's period from collected log lines and checks it: the * range must be one unbroken chain from `first_hash` back from `last_hash`, * and the `EDGE_DECISION` lines on it in the period must count exactly what * the report says, with the same first and last line and the same bundles. * A report that counted nothing names no range and claims nothing to check * beyond its zeros. */ export declare function verifyUsage(lines: Iterable, claimed: ClaimedUsage, period: UsagePeriod): UsageCount; //# sourceMappingURL=UsageCount.d.ts.map