export interface GatewayPaths { dataDir: string; db: string; lock: string; socket: string; sessions: string; session: string; archive: string; media: string; backups: string; journal: string; stdout: string; stderr: string; } export declare function gatewayPaths(dataDir?: string): GatewayPaths; export type PermissionRepairReporter = (path: string, mode: number) => void; /** Creates and validates the daemon-private structural layout. */ export declare function ensurePrivateLayout(paths?: GatewayPaths, onRepair?: PermissionRepairReporter): GatewayPaths; export declare function structuralPathExists(path: string): boolean; export declare function ensurePrivateFile(path: string, onRepair?: PermissionRepairReporter): void; export interface GatewayLock { release(): void; } /** Stable error for an actively held OS advisory lock. */ export declare class GatewayLockContendedError extends Error { readonly code = "GATEWAY_LOCKED"; constructor(path: string, cause?: unknown); } /** * Acquires a non-blocking OS-held advisory lock. The regular lock file is * deliberately retained: lock ownership belongs to this descriptor, not to a * PID value or the path's presence. */ export declare function acquireGatewayLock(paths?: GatewayPaths, options?: { createLayout?: boolean; createFile?: boolean; writeMetadata?: boolean; readOnly?: boolean; onRepair?: PermissionRepairReporter; }): GatewayLock; export declare function assertPrivateSocket(path: string): void; export interface PathDiagnostic { path: string; exists: boolean; mode?: string; uid?: number; kind?: string; symlink?: boolean; } export declare function pathDiagnostic(path: string): PathDiagnostic; export declare function pathDiagnostics(paths?: GatewayPaths): PathDiagnostic[];