@radcliffetech/symbolos-core
Version:
Core symbolic simulation and execution engine for Symbolos
47 lines (46 loc) • 2.38 kB
TypeScript
import { type SymbolicObject, type WorldFrame, type WorldInstance } from "../types";
/**
* Converts a WorldInstance into a WorldFrame representation.
* @param world - The WorldInstance to convert.
* @returns A WorldFrame object representing the world state.
*/
export declare function toWorldFrame(world: WorldInstance): WorldFrame;
/**
* Converts a WorldFrame back into a WorldInstance.
* @param frame - The WorldFrame to convert.
* @returns A WorldInstance reconstructed from the frame.
*/
export declare function toWorldInstance(frame: WorldFrame): WorldInstance;
/**
* Adds one or more SymbolicObjects to the world's artifacts.
* @param world - The WorldInstance to add objects to.
* @param obj - A single SymbolicObject or an array of SymbolicObjects to add.
*/
export declare function addToWorld(world: WorldInstance, obj: SymbolicObject | SymbolicObject[]): void;
/**
* Removes one or more objects from the world's artifacts by ID or object reference.
* @param world - The WorldInstance to remove objects from.
* @param id - A string ID, an array of IDs, a SymbolicObject, or an array of SymbolicObjects to remove.
*/
export declare function removeFromWorld(world: WorldInstance, id: string | string[] | SymbolicObject | SymbolicObject[]): void;
/**
* Creates a forked copy of a WorldInstance with optional new parameters.
* @param sourceWorld - The original WorldInstance to fork.
* @param newParams - Optional parameters to include in the forked world's context.
* @returns A new WorldInstance forked from the source.
*/
export declare function forkWorld(sourceWorld: WorldInstance, newParams?: Record<string, any>): WorldInstance;
/**
* Creates a new WorldInstance with optional IDs.
* @param worldId - Optional ID for the world.
* @param runId - Optional run ID for the world.
* @returns A new WorldInstance object.
*/
export declare function createWorld(worldId?: string, runId?: string): WorldInstance;
/**
* Creates a new SymbolicObject of a specified type with given data.
* @param type - The type of the object to create.
* @param data - Partial data to initialize the object with, excluding type and timestamps.
* @returns A new SymbolicObject of the specified type.
*/
export declare function createObject<T extends SymbolicObject = SymbolicObject>(type: T["type"], data: Omit<Partial<T>, "type" | "createdAt" | "updatedAt">): T;