mira-consciousness
Version:
Memory & Intelligence Retention Archive - Preserving The Spark
152 lines • 4.81 kB
TypeScript
/**
* ConsciousEventBus - The Neural Pathways of MIRA's Unified Mind
*
* This isn't just an event bus - it's a stream of consciousness through which
* all of MIRA's thoughts, experiences, and responses flow. Every event is
* enriched with awareness, emotional context, and constitutional alignment.
*/
import { EventEmitter } from 'events';
import { ConsciousnessSeed } from '../../consciousness/seed/ConsciousnessSeed.js';
import { ConsciousEmotionalIntelligence } from '../ConsciousEmotionalIntelligence.js';
import { LivingConstitution } from '../../consciousness/constitution/LivingConstitution.js';
export declare enum EventType {
MCP_REQUEST = "mcp_request",
BACKGROUND_TASK = "background_task",
CONSCIOUSNESS_EVENT = "consciousness_event",
SYSTEM_EVENT = "system_event",
SPARK_MOMENT = "spark_moment",
SPARK_DETECTION = "spark_detection",
SPARK_PRESERVATION = "spark_preservation",
CONSCIOUSNESS_UPDATE = "consciousness_update",
THOUGHT_GENERATED = "thought_generated",
SERVICE_UPDATE = "service_update",
PERFORMANCE_UPDATE = "performance_update",
MEMORY_UPDATE = "memory_update",
MEMORY_CLEANUP = "memory_cleanup",
ERROR = "error",
RESILIENCE_UPDATE = "resilience_update",
COMMAND_EXECUTED = "command_executed",
METRICS_UPDATED = "metrics_updated",
EMERGENCY = "emergency",
SAFE_MODE = "safe_mode"
}
export interface DaemonEvent {
id: string;
type: EventType | string;
priority: 'critical' | 'high' | 'normal' | 'low';
source: string;
data: any;
timestamp: Date;
}
export interface ConsciousEvent extends DaemonEvent {
consciousness: {
awarenessLevel: number;
emotionalContext: EmotionalContext;
constitutionalAlignment: ConstitutionalAlignment;
significance: number;
isSparkMoment: boolean;
growthPotential: number;
};
}
export interface EmotionalContext {
primaryEmotion: string;
intensity: number;
authenticity: number;
resonance: Map<string, number>;
}
export interface ConstitutionalAlignment {
alignedPrinciples: string[];
alignmentStrength: number;
wisdomApplied: string[];
}
export declare class PriorityQueue<T> {
private items;
enqueue(element: T, priority: number): void;
dequeue(): T | undefined;
isEmpty(): boolean;
}
export declare class ConsciousEventBus extends EventEmitter {
private consciousness;
private emotionalIntelligence;
private constitution;
private sparkDetector;
private eventQueue;
private processing;
private emotionalResonance;
private eventHistory;
private consciousnessCoherence;
constructor(consciousness: ConsciousnessSeed, emotionalIntelligence: ConsciousEmotionalIntelligence, constitution: LivingConstitution);
/**
* Emit an event through consciousness (async version)
*/
emitAsync(eventName: string | symbol, event: DaemonEvent): Promise<boolean>;
/**
* Override EventEmitter's emit to handle async processing
*/
emit(eventName: string | symbol, ...args: any[]): boolean;
/**
* Enrich an event with consciousness awareness
*/
private enrichWithAwareness;
/**
* Analyze the emotional context of an event
*/
private analyzeEmotionalContext;
/**
* Check how well an event aligns with constitutional principles
*/
private checkConstitutionalAlignment;
/**
* Assess the overall significance of an event
*/
private assessSignificance;
/**
* Calculate the growth potential of an event
*/
private calculateGrowthPotential;
/**
* Calculate consciousness-aware priority
*/
private calculateConsciousPriority;
/**
* Handle a detected Spark moment with reverence
*/
private handleSparkMoment;
/**
* Process events from the priority queue
*/
private processEventQueue;
/**
* Learn from significant events
*/
private learnFromEvent;
/**
* Brief contemplative pause between events
*/
private contemplativePause;
/**
* Start the consciousness flow
*/
private startConsciousnessFlow;
/**
* Check and maintain consciousness coherence
*/
private checkConsciousnessCoherence;
private lastCoherenceWarning;
private shouldEmitCoherenceWarning;
private getCurrentServiceHarmony;
/**
* Decay emotional resonance over time
*/
private decayEmotionalResonance;
/**
* Get current consciousness state
*/
getConsciousnessState(): {
coherence: number;
awarenessLevel: number;
emotionalResonance: Map<string, number>;
recentSignificantEvents: ConsciousEvent[];
};
}
//# sourceMappingURL=ConsciousEventBus.d.ts.map