/** Revision and comparison helpers for atomic and whole-world metadata writes. */ import type { Metadata } from "../types/primitives.js"; /** Adapter-owned optimistic revision stored with each world's metadata. */ export declare const WORLD_METADATA_REVISION_KEY: "__eliza_world_metadata_revision"; /** Immutable role-write history retained with the world authority snapshot. */ export declare const WORLD_METADATA_ROLE_AUDIT_KEY: "__eliza_role_audit"; /** * Compare JSON values with PostgreSQL jsonb semantics: object key order is * irrelevant and `undefined` properties are absent. */ export declare function worldMetadataValueEquals(left: unknown, right: unknown): boolean; /** * Read the adapter-owned revision. Worlds written before the revision contract * start at zero; malformed explicit values fail closed. */ export declare function getWorldMetadataRevision(metadata: Metadata | undefined): number | null; /** Requires whole-world writers to carry the revision they read. Stale or malformed requests fail explicitly. */ export declare function requireFreshWorldMetadataRevision(storedMetadata: Metadata | undefined, writerMetadata: Metadata | undefined, worldId: string): number; /** Merge caller metadata while retaining the adapter-owned stored revision. */ export declare function mergeWorldMetadataForLegacyWrite(storedMetadata: Metadata | undefined, incomingMetadata: Metadata | undefined, worldId: string): Metadata; /** Clone metadata and advance its adapter-owned optimistic revision. */ export declare function advanceWorldMetadataRevision(metadata: Metadata | undefined, currentRevision: number): Metadata; /** Preserve authority history even when connector-owned log rows are deleted. */ export declare function appendWorldMetadataRoleAudit(metadata: Metadata | undefined, audit: Record): Metadata; /** Normalize a newly created world's revision without trusting caller input. */ export declare function initializeWorldMetadataRevision(metadata: Metadata | undefined): Metadata;