import type { KeyValueStorage } from "../game/keyValueStore.js"; import type { EditorDocument } from "./types.js"; /** Bounds and catalog permissions for player-authored documents. */ export interface CreatorPolicy { maxDocuments: number; maxBytes: number; maxObjects: number; maxPathPoints: number; maxGridCells: number; maxTerrainVertices: number; allowedKinds: readonly string[]; allowedAssets: readonly string[]; allowedCatalogIds?: readonly string[]; /** Total standing/weather pools plus capacity for 32 concurrent collision child bursts. */ maxSimulationParticles?: number; maxFireCells?: number; maxPopulation?: number; maxForceFields?: number; /** Additional game-specific constraints; throw to reject the candidate atomically. */ validate?: (document: EditorDocument) => void; } /** A named scene save with a storage-format version and optimistic revision. */ export interface CreatorDocument { version: 1; id: string; name: string; revision: number; document: EditorDocument; } /** Injected durable storage. Save rejects stale revisions; null creates a new id. */ export interface CreatorDocumentStorage { list(): Promise[]>; load(id: string): Promise; save(value: CreatorDocument, expectedRevision: number | null): Promise; } /** Creator configuration shared by a host and its lazily loaded editor. */ export interface CreatorConfig { storage: CreatorDocumentStorage; policy: CreatorPolicy; initialDocument: () => EditorDocument; createPlayable: (document: EditorDocument) => TPlayable; createId?: () => string; } /** Validates schema, finite work budgets, and approved catalog references before cloning. */ export declare function validateCreatorDocument(value: unknown, policy: CreatorPolicy): EditorDocument; /** Imports scene JSON using the same validation as commands and durable saves. */ export declare function importCreatorDocument(json: string, policy: CreatorPolicy): EditorDocument; /** Exports validated, schema-versioned scene JSON. * @capability creator-export export validated player scenes with approved catalogs and finite budgets */ export declare function exportCreatorDocument(document: EditorDocument, policy: CreatorPolicy): string; /** Durable browser-compatible adapter over injected key/value storage; one atomic catalog write. * @capability creator-storage save and reopen named versioned player creations through injected durable storage */ export declare function createCreatorDocumentStorage(config: { storage: KeyValueStorage; key: string; policy: CreatorPolicy; }): CreatorDocumentStorage;