import type { CardOutcomeEvidenceProvider } from "./CardOutcomeEvidence.js"; import type { CardOutcomeLedger } from "./CardOutcomeLedger.js"; import { type OutcomeEvidenceSink } from "./CoreOutcomeEvidenceClient.js"; import type { OutcomeEvidenceStore } from "./OutcomeEvidenceStore.js"; /** * How far back a run reads facts. A card purchase's facts all arrive within its intent's * lifetime and the claim's lease, minutes after its decision; three days covers that with room * for a publisher that was down, and owed evidence is kept in the store until Core takes it. */ export declare const OUTCOME_LOOKBACK_DAYS = 3; /** What one run did, in counts and codes: what the security stream and the tests read. */ export interface OutcomePublishSummary { collected: number; recorded: number; unchanged: number; exhausted: number; invalid: number; submitted: number; accepted: number; duplicates: number; conflicts: number; /** A refusal that stopped the run: Core's, the store's or the ledger's code; null when none. */ refused: string | null; /** Whether the refusal is one a later run may get past (Core unreachable, for one). */ retry: boolean; } export interface OutcomeEvidencePublisherOptions { readonly ledger: CardOutcomeLedger; readonly provider: CardOutcomeEvidenceProvider; readonly store: OutcomeEvidenceStore; readonly sink: OutcomeEvidenceSink; /** The Decionis organization the evidence is about. */ readonly orgId: string; /** How often a run starts while nothing is owed or refused. */ readonly intervalMs: number; /** Told what each run did; never awaited, and a throw is ignored. */ readonly report?: (summary: OutcomePublishSummary) => void; readonly clock?: () => Date; /** At most the contract's 1000. */ readonly batchSize?: number; } /** * Feeds Core's outcome meter with the card purchases' evidence, after the fact and off the * request path: a timer this process runs, never an authorization. A run reads the recorded * facts, states each purchase through the producer, records a subject at a new revision only * when its evidence changed, then sends what Core has not accepted, at most a thousand subjects * per request. Nothing unchanged is ever sent again, so a run is idempotent and a restart * resends nothing Core already holds. Core alone classifies and calculates. * * Core refuses a batch whole. A revision conflict (Core holds that revision with other content) * moves the subject to its next revision and the batch goes again; a refusal the same batch * cannot pass (a producer Core does not allow, evidence it refuses) stops the run until the next * interval with the evidence still owed; an outage is retried sooner, backing off. A run never * throws, and only one runs at a time. */ export declare class OutcomeEvidencePublisher { private readonly options; private readonly clock; private readonly batchSize; private running; private timer; private failures; private stopped; constructor(options: OutcomeEvidencePublisherOptions); /** Runs now, then every interval, sooner after an outage; the timer never holds the process open. */ start(): void; stop(): void; /** One run; a run already under way is joined rather than doubled. */ publish(): Promise; private schedule; /** The interval, or after an outage a shorter wait that grows fourfold and never exceeds it. */ private nextDelay; private run; /** States every purchase in the window and records what changed. */ private sync; /** Sends what Core has not accepted, a batch at a time; Core's acceptance marks each revision sent. */ private submit; /** A failure's own code when it carries one in the outcome vocabulary; a generic one otherwise. */ private static code; } //# sourceMappingURL=OutcomeEvidencePublisher.d.ts.map