import type { RepositoryIdentity } from "../repository-identity.ts";
import { type LandedFile } from "./landed-file.ts";
import { type MoveAnswer, type MoveLedger } from "./move-ledger.ts";
import { type NameFolding } from "./name-folding.ts";
import { type MoveId } from "./ownership.ts";
export { MoveRefusedError } from "./repository-check.ts";
export interface ImportMovedSessionOptions {
    readonly bundleDir: string;
    readonly targetCwd: string;
    readonly ledger: MoveLedger;
    readonly sessionDir?: string;
    readonly from?: string;
    /** The sha256 each file of an inline bundle was sent with (senpi#6267); checked beside the manifest's. */
    readonly sent?: ReadonlyMap<string, string>;
    readonly readIdentity?: (dir: string) => Promise<RepositoryIdentity | undefined>;
    /** How the session folder's file system folds names (senpi#6472); asked of the folder itself unless a test says. */
    readonly probeNameFolding?: (folder: string) => Promise<NameFolding>;
}
export declare class MoveTargetOccupiedError extends Error {
    readonly code = "move_target_occupied";
    constructor(target: string);
}
export declare class StatusPathMismatchError extends Error {
    readonly code = "move_mismatch";
    constructor(moveId: MoveId, sessionFile: string);
}
/** The session file a `status` asks about, and what it is to the move. */
export interface StatusFile {
    readonly file: string;
    /** `copy`: the copy the import returned, which must record the move. `landing`: where the move would have landed. */
    readonly as: "copy" | "landing";
}
/**
 * The sender's question. The ledger answers, its `accepted` final and marked `revoked` once the import is revoked; a
 * given session file is read in the move's queue and is the authority too (a committed import is accepted, a revoked
 * one revoked), so a file that is not this move's import is refused. A path with no file answers from the ledger.
 *
 * For an accepted move it also says where it landed (senpi#6436). To settle an interrupted step the ledger reads the
 * file at the target its record names, under the record's lock; that same read says what the file is, so nothing is
 * read twice and nothing is opened or written for it. A record that names no target says nothing.
 *
 * A `landing` is read before the ledger is asked, so a move that landed answers `accepted` from its file even when its
 * record is lost, and no record is made for it. A file there that does not record this move (the copy an earlier move
 * of the session left, another session) is no landing: the ledger answers, as it does when no file is there.
 */
export declare function answerMoveStatusAndLanding(ledger: MoveLedger, moveId: MoveId, asked: StatusFile | undefined): Promise<{
    readonly answer: MoveAnswer;
    readonly landed?: LandedFile;
}>;
/**
 * Brings a moved session in. The bundle is verified, the folder must be the same repository (the `--rebind` rule),
 * and everything is assembled in a staging folder: the session file gains its queued input back and then
 * `session_moved_in`, so the rename into the session directory, run under the move's ledger lock, is the single
 * commit point. A read-only copy of the same session already here (it moved away earlier) is replaced; a writable
 * one is refused. Importing a bundle already imported returns the session without changing it.
 */
export declare function importMovedSession(options: ImportMovedSessionOptions): Promise<{
    readonly sessionFile: string;
}>;
//# sourceMappingURL=import.d.ts.map