export type ReadBeforeWriteMode = 'off' | 'warn' | 'enforce';
export interface ReadBeforeWriteGateOptions {
    /**
     * 'off'     — disabled; all writes pass through.
     * 'warn'    — log a warning but allow the write.
     * 'enforce' — block the write and return an error result.
     * Default: 'warn'.
     */
    mode?: ReadBeforeWriteMode;
    /**
     * When true (default), creating a brand-new file bypasses the gate
     * because the file didn't exist to read. Set false to require an
     * explicit exemption even for new files.
     */
    allowNewFiles?: boolean;
    /**
     * Paths (absolute or relative to cwd) that are always allowed to be
     * written without a prior read — e.g. dedicated output files, logs.
     */
    exemptPaths?: string[];
}
export interface ReadBeforeWriteViolation {
    path: string;
    tool: string;
    timestamp: string;
}
export interface ReadBeforeWriteCheck {
    allowed: boolean;
    /** True when the path was in the read ledger before the write. */
    wasRead: boolean;
    /** True when the path was created (didn't exist) — exempted by default. */
    isNewFile: boolean;
    /** True when the path matched an explicit exemption. */
    isExempt: boolean;
    /** Human-readable reason, populated when allowed === false. */
    reason?: string;
}
export declare class ReadBeforeWriteGate {
    private readonly mode;
    private readonly allowNewFiles;
    private readonly exemptPaths;
    /** Normalized absolute paths read during this session. */
    private readonly readLedger;
    /** Violations recorded during the session. */
    readonly violations: ReadBeforeWriteViolation[];
    constructor(options?: ReadBeforeWriteGateOptions);
    /**
     * Record a file path as having been read. Call this after every
     * successful file_read (or file_edit which reads before writing).
     */
    recordRead(filePath: string): void;
    /**
     * Record reads for multiple paths at once (e.g. after a grep that
     * returned file paths).
     */
    recordReads(filePaths: string[]): void;
    /**
     * Check whether a write to `filePath` is allowed under the current mode.
     * Does NOT mutate state — call `recordRead` separately when reads succeed.
     */
    checkWrite(filePath: string, toolName: string): ReadBeforeWriteCheck;
    /**
     * The hook for the ToolDispatcher. Call this from a pre-dispatch gate:
     *   - records reads for file_read calls
     *   - checks gate for file_write / file_edit calls
     *
     * Returns { allowed, reason } compatible with ToolDispatcher permissionCheck.
     */
    gateTool(toolName: string, input: Record<string, unknown>): {
        allowed: boolean;
        reason?: string;
        pendingReadPath?: string;
    };
    /** Confirm that a read tool executed successfully. Call after successful execution. */
    confirmRead(filePath: string): void;
    /** How many distinct paths have been read. */
    get readCount(): number;
    /** Snapshot of the read ledger (absolute paths). */
    get readPaths(): string[];
    /** Clear state for a new run. */
    reset(): void;
}
//# sourceMappingURL=readBeforeWriteGate.d.ts.map