/**
 * Structured audit log for permission decisions.
 *
 * DecisionLog provides an in-memory circular buffer of PermissionDecision
 * records with structured output suitable for debugging and compliance auditing.
 *
 * Decisions are appended on every evaluation. The buffer is bounded to prevent
 * unbounded memory growth during long sessions.
 */
import type { PermissionDecision } from './types.js';
/**
 * A decorated audit log entry wrapping a PermissionDecision with
 * a monotonic sequence number for ordered retrieval.
 */
export interface DecisionLogEntry {
    /** Monotonic sequence number (1-based, increments per decision). */
    seq: number;
    /** The full permission decision record. */
    decision: PermissionDecision;
}
/** Filters for querying the decision log. */
export interface DecisionLogQuery {
    /** Return only decisions for this tool name. */
    toolName?: string | undefined;
    /** Return only allow or only deny decisions. */
    allowed?: boolean | undefined;
    /** Return decisions after this timestamp (epoch ms, inclusive). */
    since?: number | undefined;
    /** Maximum number of entries to return (default: all). */
    limit?: number | undefined;
}
/**
 * DecisionLog — Bounded circular buffer for permission decision audit records.
 *
 * Thread-safe for single-threaded Bun/Node runtimes (no async gaps in write path).
 * Oldest entries are evicted when the buffer is full; `totalRecorded` and
 * `summary().evicted` expose rollover.
 *
 * Implements a true O(1) ring buffer with head/tail indexing to avoid O(n)
 * Array.shift() evictions.
 */
export declare class DecisionLog {
    /** Ring buffer storage (fixed-size array). */
    private readonly buffer;
    /** Write head: index where next entry will be written. */
    private head;
    /** Total entries currently stored (≤ maxEntries). */
    private count;
    private seq;
    private readonly maxEntries;
    constructor(maxEntries?: number);
    /**
     * append — Records a permission decision in the audit log.
     *
     * If the buffer has reached `maxEntries`, the oldest entry is evicted in O(1)
     * time via ring buffer head advancement. Rollover is observable via
     * `totalRecorded` and `summary().evicted`.
     *
     * @param decision — The completed PermissionDecision to record.
     */
    append(decision: PermissionDecision): void;
    /**
     * toArray — Returns all current entries in chronological order (oldest first).
     */
    private toArray;
    /**
     * query — Returns filtered log entries in chronological order.
     *
     * @param filters — Optional filter criteria.
     */
    query(filters?: DecisionLogQuery): DecisionLogEntry[];
    /**
     * latest — Returns the most recent decision, or undefined if the log is empty.
     */
    latest(): DecisionLogEntry | undefined;
    /**
     * size — Returns the current number of entries in the buffer.
     */
    get size(): number;
    /**
     * totalRecorded — Returns the total number of decisions ever recorded
     * (including evicted entries). Monotonically increasing.
     */
    get totalRecorded(): number;
    /**
     * clear — Empties the log and resets the sequence counter.
     * Primarily useful in tests.
     */
    clear(): void;
    /**
     * summary — Returns aggregate counts of allow/deny decisions.
     */
    summary(): {
        total: number;
        allowed: number;
        denied: number;
        evicted: number;
    };
}
//# sourceMappingURL=decision-log.d.ts.map