/**
 * VCS-pluggable worktree adapter. One improvement = one worktree, PR-like
 * (multiple commits allowed). A code-tier proposer's `propose()` creates a
 * worktree, an agent commits the change into it, and `finalize()` returns a
 * `CodeSurface{ worktreeRef }` the measurement checks out to run the worker
 * against the changed code. On promotion the worktree becomes the PR branch.
 *
 * The interface is VCS-agnostic so a future `jj` ([jj-vcs](https://github.com/jj-vcs/jj))
 * adapter can slot in without touching proposer code. Only the git adapter
 * ships today. See `docs/design/loop-taxonomy.md`.
 */
import type { CodeSurface } from '../types';
export interface Worktree {
    /** Absolute path to the checked-out worktree directory. */
    path: string;
    /** The branch the worktree is on (becomes the PR branch on promotion). */
    branch: string;
    /** The ref the worktree was forked from. */
    baseRef: string;
}
export interface WorktreeAdapter {
    /** Create an isolated worktree on a fresh branch off `baseRef`. */
    create(opts: {
        baseRef: string;
        label: string;
    }): Promise<Worktree>;
    /** Commit any pending changes in the worktree, then return a CodeSurface
     *  pointing at it. The agent has already written its change into
     *  `worktree.path` by the time this is called. */
    finalize(worktree: Worktree, summary: string): Promise<CodeSurface>;
    /** Remove the worktree (and its branch) — called for losing candidates. */
    discard(worktree: Worktree): Promise<void>;
}
export declare class WorktreeAdapterError extends Error {
    readonly cause?: unknown | undefined;
    constructor(message: string, cause?: unknown | undefined);
}
export interface GitWorktreeAdapterOptions {
    /** Repo root the worktrees fork from. */
    repoRoot: string;
    /** Directory worktrees are created under. Default: `<repoRoot>/.worktrees`. */
    worktreeDir?: string;
    /** Branch-name prefix. Default: `improve`. */
    branchPrefix?: string;
    /** Test seam — defaults to a real `git` runner. */
    git?: (args: string[], cwd: string) => string;
}
export declare function gitWorktreeAdapter(opts: GitWorktreeAdapterOptions): WorktreeAdapter;
/** Resolve a `CodeSurface`'s worktreeRef to a directory the measurement can
 *  run the worker in. A path ref is returned as-is; anything else is treated
 *  as a ref under the adapter's worktree dir. */
export declare function resolveWorktreePath(surface: CodeSurface, worktreeDir?: string): string;
//# sourceMappingURL=index.d.ts.map