import type { AgentTool } from "../types.js";
import { fuzzyFindText } from "./edit-diff.js";
import { type CheckpointHandle } from "./checkpoint.js";
import { type ReadStateHandle } from "./read-state.js";
export interface MatchingStrategy {
    find(content: string, oldText: string): ReturnType<typeof fuzzyFindText>;
}
declare const editSchema: import("@sinclair/typebox").TObject<{
    path: import("@sinclair/typebox").TString;
    oldText: import("@sinclair/typebox").TString;
    newText: import("@sinclair/typebox").TString;
    replaceAll: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
}>;
export interface EditToolDetails {
    /** Formatted diff showing what changed. */
    diff: string;
    /** First changed line (1-based) in the new file; handy for positioning the cursor there. */
    firstChangedLine?: number;
}
/**
 * Pluggable filesystem callbacks for the edit tool. Override them to direct
 * edits at an alternate backend, for instance an SSH or remote-mount layer.
 */
export interface EditOperations {
    /** Read a file's raw bytes. */
    readFile: (absolutePath: string) => Promise<Buffer>;
    /** Write replacement text to a file. */
    writeFile: (absolutePath: string, content: string) => Promise<void>;
    /** Verify the file is both readable and writable, raising if not. */
    access: (absolutePath: string) => Promise<void>;
}
export interface EditToolOptions {
    /** Swap out the filesystem callbacks; the local disk is used by default. */
    operations?: EditOperations;
    matchingStrategy?: MatchingStrategy;
    /**
     * Optional read-before-edit gate store. When present, the edit is refused
     * unless the file was read this session and has not drifted on disk since.
     * Absent → no gate (no-op), preserving the prior behaviour exactly.
     */
    readState?: ReadStateHandle;
    /**
     * Optional file-checkpoint sink. When present, the file's ORIGINAL
     * pre-edit on-disk content is captured exactly once before the edit is
     * applied, so a later rewind can roll the working tree back. The edit tool
     * only ever targets an existing file, so the snapshot is its old bytes (never
     * `null`). Absent → no snapshot (no-op).
     */
    checkpoint?: CheckpointHandle;
}
export declare function createEditTool(cwd: string, options?: EditToolOptions): AgentTool<typeof editSchema>;
/** Ready-to-use edit tool bound to the current working directory. */
export declare const editTool: AgentTool<import("@sinclair/typebox").TObject<{
    path: import("@sinclair/typebox").TString;
    oldText: import("@sinclair/typebox").TString;
    newText: import("@sinclair/typebox").TString;
    replaceAll: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
}>, any>;
export {};
