export declare const RECORD_BEARING_FLAGS: number;
/**
 * Decide whether an audit entry pulled from the unflushed log is safe to replay.
 * Returns `null` if the entry should be replayed, or a short reason string if it should
 * be skipped (the loop logs the aggregate skip count once at the end).
 *
 * Operates on the raw integer `action` field rather than the decoded type string: when
 * `readAuditEntry` catches a header decode error it returns `{}`, so both `action` and
 * `tableId` are `undefined` — the same signal — and matching the record-bearing flags
 * directly against the action mirrors how the writer set them in `auditStore.ts`.
 *
 * @param action      `auditRecord.extendedType` — the variable-length action field with
 *                    the event type in the low nibble and HAS_* flags above it
 * @param tableId     `auditRecord.tableId`
 * @param hasRecord   `true` if `auditRecord.getValue(...)` produced a non-undefined value
 */
export declare function classifyAuditEntryForReplay(action: number | undefined, tableId: number | undefined, hasRecord: boolean): 'corrupt-header' | 'missing-record' | null;
/**
 * Whether an audit entry runs `validate()` during replay but its record body failed to decode,
 * and so must be skipped.
 *
 * `RecordEncoder.decode` returns `null` (not `undefined`, and it does not throw) when a value
 * fails to decode — e.g. structure-dictionary divergence, which surfaces as msgpackr's
 * "Data read, but end of buffer not reached". `classifyAuditEntryForReplay` only catches a
 * `undefined` body, so a `null` slips through; the replay path then calls `validate()`, which
 * dereferences the record and crashes on the missing body.
 *
 * Scoped to the actions whose replay reaches `validate()`: `put`/`patch` (via `_writeUpdate` →
 * `save()`) and `message` (via `_writePublish` → `transaction.addWrite` → `save()`; the publish
 * `validate` hook fires whenever the replay context has no `source`, which it never does). Other
 * record-bearing actions must NOT be skipped on a `null` body — notably `invalidate`, which
 * legitimately stores a `null` partial record on a table with no index fields and never reaches
 * `validate()`; `relocate`/`delete` ignore the body entirely. See harper#1255.
 */
export declare function isUndecodableValidatedWrite(type: string | undefined, record: unknown): boolean;
export declare const REPLAY_NO_PROGRESS_COUNT_LIMIT = 100000;
export declare const REPLAY_NO_PROGRESS_TIME_LIMIT_MS = 60000;
export declare const REPLAY_NO_PROGRESS_TIME_SKIP_FLOOR = 1000;
/**
 * Whether boot replay should abort because it is making no forward progress — a backlog of
 * unwritable entries (undecodable/corrupt, or for a dropped table) that produces no writes
 * (harper#1266). Returns `true` once the contiguous run of no-progress entries since the last
 * successful write crosses the count bound, or once it has both built up past the time-skip floor
 * AND burned the time bound. All inputs are measured since the last write, so a productive replay
 * (which keeps resetting them) never trips this; only a genuinely stalled, write-free grind does.
 *
 * @param noProgressRun   consecutive entries processed without a successful write
 * @param msSinceProgress wall-clock ms elapsed since the last successful write
 */
export declare function shouldAbortStalledReplay(noProgressRun: number, msSinceProgress: number, countLimit?: number, timeLimitMs?: number, timeSkipFloor?: number): boolean;
/**
 * Wraps a transaction-log query iterator so a corrupt/torn frame ends that log's iteration
 * cleanly instead of escaping as an uncaughtException. rocksdb-js throws a bounded RangeError
 * when an entry's framing is broken; framing loss means the next entry can't be located, so the
 * frame marks end-of-log (entries before it were already yielded) and startup replay /
 * replication broadcast continue. `onCorruptFrame` fires once, latched — kept a callback (not a
 * direct log) so this module stays out of the Harper module graph and is unit-testable.
 */
export declare function endIteratorOnCorruptFrame<T>(iterator: Iterator<T>, onCorruptFrame: (error: RangeError) => void): IterableIterator<T>;
