import type { SkillScope, TransferEvent } from "../types.js";
export interface TransferRequest {
    plugin: string;
    skill: string;
    fromScope: SkillScope;
    toScope: SkillScope;
    root: string;
    home: string;
    overwrite?: boolean;
}
export interface TransferResult {
    sourcePath: string;
    destPath: string;
    filesWritten: number;
}
export type SSEEmit = (e: TransferEvent) => void;
export declare class CollisionError extends Error {
    readonly path: string;
    readonly code: "collision";
    constructor(path: string);
}
export declare class MissingSourceError extends Error {
    readonly path: string;
    readonly code: "missing-source";
    constructor(path: string);
}
export declare function resolveScopePath(scope: SkillScope, root: string, skill: string, home: string): string;
/**
 * Count files written recursively into a directory — used for the SSE
 * `copied` and `deleted` event payloads. Returns 0 for missing dirs so
 * callers can use it on paths that may have been removed mid-flight.
 *
 * Skips symlinks (lstat) to avoid following loops, and caps depth at
 * MAX_RECURSION_DEPTH so a pathological tree can't blow the call stack.
 */
export declare function countFiles(dir: string, depth?: number): number;
/**
 * Pre-flight check that a transfer can succeed. Throws MissingSourceError /
 * CollisionError without touching the filesystem. Routes call this BEFORE
 * opening an SSE stream so failure cases return clean HTTP 404 / 409 with
 * a JSON body instead of opening SSE then immediately emitting an error.
 */
export declare function validatePaths(sourcePath: string, destPath: string, overwrite: boolean): void;
export declare function transfer(req: TransferRequest, emit: SSEEmit): Promise<TransferResult>;
