/** * Citadel Era Engine * Defines mythic eras that span multiple epochs and shape long-arc identity. * Non-rendering. Pure era logic. */ import { getEpochState } from "./epochEngine"; import { getPersonaContinuity } from "./personaContinuity"; import { generateResonanceField } from "./mythicResonance"; export interface Era { name: string; sigil: string; epochRequirement: number; // epochs required to enter era description: string; } export interface EraState { current: Era | null; history: Era[]; erasCompleted: number; } const eras: Era[] = [ { name: "Era of Origins", sigil: "◎", epochRequirement: 0, description: "The primordial age where the Citadel first forms symbolic identity." }, { name: "Era of Ascent", sigil: "⟁", epochRequirement: 3, description: "An age of rising coherence, expanding lineage, and harmonic awakening." }, { name: "Era of Illumination", sigil: "✹", epochRequirement: 7, description: "A radiant age of mythic maturity and stable resonance." }, { name: "Era of Continuum", sigil: "⧖", epochRequirement: 12, description: "A timeless age where identity, lineage, and resonance form a unified continuum." } ]; const eraState: EraState = { current: null, history: [], erasCompleted: 0, }; export function updateEraState() { const epochState = getEpochState(); const continuity = getPersonaContinuity(); const resonance = generateResonanceField(); const epochsCompleted = epochState.epochsCompleted; // Determine which era the Citadel belongs to const newEra = eras .slice() .reverse() .find((e) => epochsCompleted >= e.epochRequirement) || eras[0]; // If era changed, record transition if (!eraState.current || eraState.current.name !== newEra.name) { eraState.current = newEra; eraState.history.push(newEra); eraState.erasCompleted++; } return eraState; } export function getEraState(): EraState { return eraState; } export function getEraSummary() { if (!eraState.current) { return "No era has been established yet."; } return ` Current Era: ${eraState.current.name} Sigil: ${eraState.current.sigil} Eras Completed: ${eraState.erasCompleted} Description: ${eraState.current.description} `.trim(); }