interface CacheKeyOpts {
    packages: string[];
    registries?: Record<string, string>;
}
/** Stable, sorted JSON hash of inputs. */
export declare function createCacheKey(opts: CacheKeyOpts): string;
/** $XDG_CACHE_HOME/gjsify/dlx — created if missing. */
export declare function dlxCacheRoot(): string;
/** Per-key cache directory: <root>/<sha>. */
export declare function cacheDirFor(cacheKey: string): string;
/** A fresh prepare directory under the per-key cache, named timestamp-pid. */
export declare function makePrepareDir(cacheDir: string): string;
/**
 * If <cacheDir>/pkg points to a target whose mtime + maxAge < now, return its
 * realpath. Returns undefined when the link doesn't exist, isn't a symlink,
 * has been removed, or has expired.
 */
export declare function getValidCachedPkg(cacheDir: string, maxAgeMinutes?: number): string | undefined;
/**
 * Atomically swap `<cacheDir>/pkg` to point at `prepareDir`.
 *
 * Strategy:
 *   1. Create new symlink `<cacheDir>/pkg-<rand>` → prepareDir.
 *   2. `rename(pkg-<rand>, pkg)` — POSIX guarantees rename-over-existing is atomic.
 *
 * Returns the realpath of the new live target. EBUSY/EEXIST indicates a race
 * — a parallel process won, return its realpath.
 */
export declare function symlinkSwap(cacheDir: string, prepareDir: string): string;
/** Clean up `<cacheDir>/<oldPrepareDir>` siblings older than `maxAgeMinutes`. */
export declare function cleanupStalePrepareDirs(cacheDir: string, _maxAgeMinutes?: number): void;
/** Resolve absolute path to the installed package's directory inside cache. */
export declare function resolveInstalledPkgDir(cachedRoot: string, pkgName: string): string;
export {};
