import type { InventoryState } from "../inventory/inventoryModel.js"; export declare const RUNTIME_SNAPSHOT_VERSION = 1; export type RuntimeEntityRow = { instanceId: string; catalogId: string; position?: [number, number, number]; rotationY?: number; parentSpace?: string; group?: string; stats?: Record; targetInstanceId?: string | null; userId?: string; }; /** * The persisted form of a placed `SceneObject`: identity, placement, per-instance state, and slot * contents. Convert with `toRuntimeObjectRow`/`fromRuntimeObjectRow` (`runtime/objectRows`). */ export type RuntimeObjectRow = { instanceId: string; catalogId: string; position: [number, number, number]; rotationY?: number; parentSpace?: string; /** Opaque per-instance state; the persisted name for `SceneObject.state`. */ flags?: Record; /** Container contents for a catalog `slotInventory` object. */ slots?: InventoryState; }; export type RuntimeInventorySlot = { item: string; count: number; slot?: number; }; export type RuntimePlayerRow = { territoryOwnedCount?: number; ownedTerritoryChunkKeys?: string[]; userId: string; inventories: Record; economy: Record; unlocks: string[]; quests?: unknown; social?: unknown; leaderboard?: Record; session?: Record; }; export type RuntimeChunkRow = { /** Cell key to owner id, persisted with its spatial chunk. */ territory?: Record; territoryReceipts?: Record; chunkKey: string; objects: RuntimeObjectRow[]; entities: RuntimeEntityRow[]; flags?: Record; }; export type RuntimeServerRow = { entities: RuntimeEntityRow[]; objects: RuntimeObjectRow[]; session: Record; feeds?: Record; }; export type RuntimeProfileRow = { userId: string; gameId: string; player: RuntimePlayerRow; updatedAt: number; }; export type GameRuntimeSnapshot = { version: number; gameId: string; serverId: string; server: RuntimeServerRow; players: Record; chunks: Record; revision: number; dirty: { server: boolean; players: string[]; chunks: string[]; }; }; /** @internal */ export declare function createEmptyServerRow(): RuntimeServerRow; /** @internal */ export declare function createEmptyPlayerRow(userId: string): RuntimePlayerRow; /** @internal */ export declare function createRuntimeSnapshot(args: { gameId: string; serverId: string; server?: RuntimeServerRow; players?: Record; chunks?: Record; revision?: number; }): GameRuntimeSnapshot; /** @internal */ export declare function markServerDirty(snapshot: GameRuntimeSnapshot): GameRuntimeSnapshot; /** @internal */ export declare function markPlayerDirty(snapshot: GameRuntimeSnapshot, userId: string): GameRuntimeSnapshot; /** @internal */ export declare function clearDirtyFlags(snapshot: GameRuntimeSnapshot): GameRuntimeSnapshot; /** @internal */ export declare function splitProfilePlayer(player: RuntimePlayerRow): { persistent: RuntimePlayerRow; session: Record; }; /** * Mark every player plus the server row dirty without bumping `revision` — the "write everything now" * preparation a flush needs, because hydrating a snapshot from storage resets the dirty set to empty. * Revision stays put so a flush cannot look like a mutation to the revision CAS. * @internal */ export declare function markAllPlayersDirty(snapshot: GameRuntimeSnapshot): GameRuntimeSnapshot;