UNPKG

automata-metaverse

Version:

Automaton execution engines for self-referential CanvasL/JSONL systems

69 lines (60 loc) 1.91 kB
/** * 0D-Topology Automaton * * Foundation automaton for topology operations (0D dimension) */ import { MLVectorClockAutomaton, type MetaLog, type SwarmContext, type AutomatonMessage, type AutomatonState } from '../ml-vector-clock-automaton.js'; /** * 0D-Topology Automaton * * Manages quantum vacuum topology and identity processes */ export class A0_TopologyAutomaton extends MLVectorClockAutomaton { constructor(id: string | number = 0, metaLog: MetaLog | null = null) { super(id, metaLog); this.state.dimension = 0; this.state.cellCounts = { C0: 1, // Single point topology C1: 0, C2: 0, C3: 0, C4: 0 }; } /** * Execute 0D topology tick * * @param {SwarmContext | null} swarm - Swarm context * @returns {Promise<void>} */ protected async executeTick(swarm: SwarmContext | null): Promise<void> { // 0D topology operations // Maintain empty pattern () and point topology // Ensure trivial fiber bundle integrity // Update cell counts if needed this.state.cellCounts.C0 = Math.max(1, this.state.cellCounts.C0); } /** * Execute receive for 0D topology * * @param {string | number} from - Sender automaton ID * @param {AutomatonMessage} message - Received message * @returns {Promise<void>} */ protected async executeReceive(from: string | number, message: AutomatonMessage): Promise<void> { if (message.type === 'coordinate') { // Coordinate with other automata // 0D topology provides base for all higher dimensions } } /** * Validate homology for 0D topology * * @param {AutomatonState} state - State to validate * @returns {Promise<boolean>} True if valid */ async validateHomology(state: AutomatonState): Promise<boolean> { // 0D topology: Must have at least one C0 cell return (state.cellCounts?.C0 || 0) >= 1; } }