/** * Canonical JSON serializer + SHA-256 hash for `case_corrections.target_ref`. * * Phase 1 of MAMA Case-First Memory System (spec §5.4 Option C). * * Behavior: * - recursively sort object keys in lexicographic UTF-8 order * - preserve array order (semantic) * - reject undefined values with typed error code `canonicalize.undefined_value` * - reject function values with typed error code `canonicalize.function_value` * - reject non-finite numbers (NaN, +/- Infinity) with `canonicalize.non_finite_number` * - serialize normalized value via JSON.stringify (after normalization) * - hash canonical JSON string with SHA-256 over UTF-8 bytes → 32-byte Buffer * * No top-level await. No ESM-only runtime dependency. Safe for CJS consumers * (mcp-server, claude-code-plugin) via package export `./canonicalize`. * * @module canonicalize */ export type CanonicalizeErrorCode = 'canonicalize.undefined_value' | 'canonicalize.function_value' | 'canonicalize.non_finite_number'; export declare class CanonicalizeError extends Error { readonly code: CanonicalizeErrorCode; constructor(code: CanonicalizeErrorCode, message: string); } /** * Produce a canonical JSON string for `value`. * * Two calls with semantically equivalent input produce byte-identical output. */ export declare function canonicalizeJSON(value: unknown): string; /** * Produce the 32-byte SHA-256 digest of the canonical JSON form of `value`. * * Invariant: `targetRefHash(obj)` === `targetRefHash(canonicalizeJSON(obj))`. */ export declare function targetRefHash(value: unknown): Buffer; export declare function targetRefHashCanonicalJSON(canonicalJson: string): Buffer; //# sourceMappingURL=canonicalize.d.ts.map