/** * Stable content hash for a Sanity document, used to decide whether the * cached AI brief is still valid for this doc. * * "Same hash" must mean: nothing the LLM brief endpoint cared about has * changed. Things that DON'T affect the brief (and so are stripped): * - `_rev` / `_updatedAt` / `_createdAt` — change on every save, no * semantic meaning to the brief. * - `_id`, `_key` — identity, not content. * - Bare references (`{_type:'reference',_ref:...}`) — opaque pointers; * the server can't fetch them without a separate query, so they don't * contribute to the brief. * * Things that DO matter (and so are kept): * - title, description, body text, plain field values * - portable text (flattened to plain strings, the same way the server * does it in `compactDocForPrompt`) * * The hash itself is djb2 (xor variant) → 32-bit unsigned → hex. Not * cryptographic — we only need stable equality detection for cache lookups. * This stays in 8 hex chars max. Browser-safe, no crypto.subtle dependency. */ /** * Compute a stable hash of the brief-relevant content of a Sanity doc. * Returns a stable hex string; `null` when the input isn't a usable doc. * * Same doc → same hash. `_rev`/`_updatedAt` changes alone → same hash. * Title or body change → different hash. */ export declare function hashDocForBrief(doc: unknown): string | null;