/**
 * File-block Applier
 *
 * Materializes model output into the project tree. Models emit complete
 * files as fenced blocks:
 *
 *   ```file:relative/path/from/root.ts
 *   <entire file content>
 *   ```
 *
 * Whole-file emission is deliberate: small models are far more reliable
 * emitting complete files than unified diffs. Fences of 3+ backticks are
 * supported so file contents containing ``` can be wrapped in ````.
 */
export interface FileBlock {
    path: string;
    content: string;
}
export interface ApplyResult {
    /** Relative paths written to disk */
    filesWritten: string[];
    /** Blocks rejected with the reason (unsafe path, etc.) */
    rejected: Array<{
        path: string;
        reason: string;
    }>;
    /** Set when no file blocks were found at all */
    error?: string;
}
export interface ApplyOptions {
    /**
     * Pre-existing test/spec files (relative, '/'-separated, lower-cased
     * paths) the model must not modify. Gate integrity: a model that rewrites
     * the task's spec to make gates pass has converged on the wrong target.
     * New test files are still allowed — only paths in this set are blocked.
     * Custom Applier implementations MUST honor this set themselves; the
     * loop's prompt tells the model these files are read-only.
     */
    protectedFiles?: ReadonlySet<string>;
    /**
     * Reject writes to test-runner/compiler config files (vitest/jest/mocha
     * configs, tsconfig, pytest.ini…). Without this, protecting the spec is
     * moot — the model can repoint test discovery or relax the compiler
     * instead of modifying the tests the gates run.
     */
    protectGateConfigs?: boolean;
}
export type Applier = (output: string, projectRoot: string, options?: ApplyOptions) => ApplyResult | Promise<ApplyResult>;
export interface RevertibleApply {
    result: ApplyResult;
    /** Restore every written file to its pre-apply state (idempotent). */
    restore: () => void;
}
/** True when a basename is a test-runner/compiler config (gate input). */
export declare function isGateConfigBasename(base: string): boolean;
/**
 * True when a relative '/'-separated path looks like a test/spec file:
 * lives under a test directory, or has a test-style basename
 * (*.test.*, *.spec.*, *_test.*, test_*.py).
 */
export declare function isTestFilePath(relPath: string): boolean;
/**
 * Snapshot the project's pre-existing test/spec files as relative
 * '/'-separated paths. Called once at loop start so files the model creates
 * later are not retroactively protected. Bounded walk; failures return what
 * was found so far — protection degrades, delivery never blocks.
 */
export declare function findProtectedTestFiles(projectRoot: string): Set<string>;
/**
 * The same bounded walk as findProtectedTestFiles but returning the
 * original-case relative paths — needed by callers that must read the files
 * (e.g. spec transitive-import analysis).
 */
export declare function listTestFiles(projectRoot: string): string[];
/** Extract file blocks from model output without writing anything. */
export declare function parseFileBlocks(output: string): FileBlock[];
/**
 * Default applier: parse file blocks and write them under projectRoot.
 * Paths are validated against traversal and .git writes; oversized files
 * are rejected rather than truncated.
 */
export declare function applyFileBlocks(output: string, projectRoot: string, options?: ApplyOptions): ApplyResult;
/**
 * Apply file blocks with a snapshot of the prior state of every target, so
 * the application can be undone. Used by the explorer to evaluate competing
 * candidates against the same baseline tree without git machinery.
 */
export declare function applyFileBlocksWithRollback(output: string, projectRoot: string, options?: ApplyOptions): RevertibleApply;
//# sourceMappingURL=applier.d.ts.map