/**
 * Shared filesystem utilities.
 *
 * Eliminates duplication of ensureDir, sha256, appendJsonl, loadJson, saveJson
 * across all modules.
 *
 * @connexum/ai-governance
 */
/**
 * Ensure a directory exists, creating it recursively if needed.
 */
export declare function ensureDir(dir: string): void;
/**
 * Compute SHA-256 hash of a file's contents.
 */
export declare function sha256File(filePath: string): string;
/**
 * Compute SHA-256 hash of a string or buffer.
 */
export declare function sha256(input: string | Buffer): string;
/**
 * Append a JSON object as a line to a JSONL file.
 * Creates the file and parent directories if they don't exist.
 */
export declare function appendJsonl(filePath: string, data: Record<string, unknown>): void;
/**
 * Result type for a single JSONL line parse attempt.
 * SYSTEMIC-L2: replaces `null as unknown as T` cast with an explicit
 * discriminated union so callers cannot silently swallow parse errors.
 */
export type JsonlParseResult<T> = {
    ok: true;
    value: T;
} | {
    ok: false;
    error: 'not-found' | 'parse-error' | 'io-error';
    message: string;
};
/**
 * Parse a single line from a JSONL file.
 * Returns a discriminated union so callers must explicitly handle failures.
 */
export declare function parseJsonlLine<T = Record<string, unknown>>(line: string): JsonlParseResult<T>;
/**
 * Read all lines from a JSONL file, parsing each as JSON.
 * Returns empty array if file doesn't exist or is empty.
 *
 * SYSTEMIC-L2: Lines that fail JSON.parse are silently skipped to preserve
 * backwards-compatible return type (T[]). Use `readJsonlWithResults` if
 * you need to detect and handle parse failures explicitly.
 */
export declare function readJsonl<T = Record<string, unknown>>(filePath: string): T[];
/**
 * SYSTEMIC-L2: Variant of readJsonl that surfaces parse results explicitly.
 * Returns one JsonlParseResult per non-empty line. Callers receive full
 * visibility into parse failures without silent data loss.
 *
 * Use this wherever a malformed entry is a meaningful signal (e.g., WAL
 * replay, audit log ingestion, compliance record loading).
 */
export declare function readJsonlWithResults<T = Record<string, unknown>>(filePath: string): JsonlParseResult<T>[];
/**
 * Load and parse a JSON file. Returns null if not found or invalid.
 */
export declare function loadJson<T = Record<string, unknown>>(filePath: string): T | null;
/**
 * Save an object as a formatted JSON file.
 * Creates parent directories if needed.
 */
export declare function saveJson(filePath: string, data: unknown): void;
/**
 * Safely read the last N lines from a file without loading the entire file.
 * Falls back to full read for small files.
 */
export declare function readLastLines(filePath: string, n: number): string[];
/**
 * Read new bytes from a file starting at a given offset.
 * Returns the new content and updated offset.
 */
export declare function readFromOffset(filePath: string, offset: number): {
    content: string;
    newOffset: number;
};
//# sourceMappingURL=fs.d.ts.map