/** * Content hashing for the cross-agent installer (spec 03 §3.3-§3.6, OQ-4). * * Drift detection is decided by SHA-256 *content* hashing, NEVER mtime. The tree digest is a * function of the set of `{ relativePosixPath, fileContentHash }` pairs only, so two * materializations of the same bundle at different paths/times hash identically. Zero runtime * dependencies — only `node:` built-ins. */ /** * SHA-256 of a single file's bytes, hex-encoded (OQ-4 — content hash, never mtime). * * @param filePath - Absolute path to a regular file. * @returns 64-char lowercase hex digest of the file's bytes. * @throws Propagates the underlying node:fs error (ENOENT/EACCES) — an *unexpected* IO failure * for an already-located, integrity-checked bundle, caught at the operation boundary. */ export declare function sha256File(filePath: string): string; /** * SHA-256 of a UTF-8 string, hex-encoded. Used to fingerprint a managed-block region (A4b) so the * planner can tell a clean prior block (recorded hash matches) from a user-edited one. Pure. */ export declare function sha256String(s: string): string; /** * Deterministic SHA-256 over a directory tree's file set (OQ-4). The digest is a function of the * set of `{ relativePosixPath, fileContentHash }` pairs ONLY — never of mtime, inode, or * traversal order. * * Canonical form: walk regular files, compute POSIX-relative paths, sort byte-wise, then fold a * single hash over `update(rel); update("\0"); update(contentHash); update("\n")` per file. * * @param dir - Absolute path to the directory whose tree to hash. * @returns 64-char lowercase hex digest, invariant under relocation and traversal order. */ export declare function sha256Tree(dir: string): string; /** * Compute the `sourceHash` stored in InstallManifest (spec 00 §3, spec 03 §3.4). It is exactly * `sha256Tree(bundlePath)` — the sorted-path canonical digest over the bundle's file set, so two * materializations of the same bundle produce the SAME hash (REQ-IDEM-01 basis). * * @param bundlePath - Absolute path to a *located, integrity-checked* bundle dir. * @returns 64-char lowercase hex digest — store verbatim in `InstallManifest.sourceHash`. */ export declare function computeSourceHash(bundlePath: string): string; /** * The bundle's per-file inventory: every regular file under `bundlePath`, each as its * bundle-relative POSIX path plus the content `sha256`. Sorted by relative POSIX path — the SAME * sorted walk `sha256Tree` folds over, so the inventory and `sourceHash` always agree. * * @param bundlePath - Absolute path to a located, integrity-checked bundle dir. * @returns Array of `{ relpath, sha256 }`, sorted by `relpath` (POSIX `/` separators). */ export declare function listBundleFiles(bundlePath: string): Array<{ relpath: string; sha256: string; }>;