import { type RuntimeDeliver } from './deliver.js'; import { type OwedRecord } from './notice-journal.js'; export declare const DEFAULT_MAX_FAILURES = 5; export declare const KIND_BUDGET_WARNING = "section-budget-warning"; export declare const KIND_BUDGET_CLOSED = "section-budget-closed"; export type BudgetNoticeKind = typeof KIND_BUDGET_WARNING | typeof KIND_BUDGET_CLOSED; /** One crossing and the message it owes each recipient. */ export interface BudgetNoticeSpec { /** Names the crossing: `::`. */ crossing: string; kind: BudgetNoticeKind; /** Section name, `reserve` or `org`. */ scope: string; recipients: readonly string[]; subject: string; body: string; } export interface BudgetNoticeSink { deliver: RuntimeDeliver; /** Told of failures (the bus audit trail). */ emit?: (e: { reason: string; msg: string; data: Record; }) => void; } export interface BudgetNoticeOptions { now?: () => Date; maxFailures?: number; } export type BudgetNoticeState = 'pending' | 'delivered' | 'exhausted'; export declare class SectionBudgetNotices { private readonly journal; private readonly memoryOwed; private readonly deliveredHere; private readonly maxFailures; private readonly now; private sink; private closed; private chain; private queued; constructor(dir: string, opts?: BudgetNoticeOptions); private all; /** True once a crossing has been owed (journalled), in this run or an earlier one of the same run directory. */ known(crossing: string): boolean; /** Journal the obligation of each recipient of a crossing that is not known yet, then schedule delivery. Returns * true when the crossing was new. If a journal write fails the obligation is kept in memory only (sent by this * process, lost with it). */ owe(spec: BudgetNoticeSpec): boolean; /** Attach the delivery path and send what was never delivered (a resume after a crash or a failure). */ start(sink: BudgetNoticeSink): void; /** The next opportunity for a failed or unsent notice. */ retry(): Promise; /** Resolves when every delivery pass scheduled so far has finished. */ idle(): Promise; close(): void; stateOf(o: OwedRecord): BudgetNoticeState; /** Every obligation recorded, in order, with what became of it. */ records(): Array; /** The obligations not yet delivered and not given up on. */ pending(): OwedRecord[]; private schedule; private pass; private record; } //# sourceMappingURL=section-budget-notice.d.ts.map