Initial commit: 2125_GCE project
This commit is contained in:
Regular → Executable
+5
-4
@@ -6,8 +6,11 @@ Exposes glyph activation and resonance changes as first-class events.
|
||||
"""
|
||||
|
||||
import time
|
||||
import logging
|
||||
from typing import Callable, Dict, List, Optional, TypedDict, Literal, Any
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
# Event type definitions
|
||||
EventType = Literal[
|
||||
"cognition.started",
|
||||
@@ -61,7 +64,7 @@ class EventBus:
|
||||
try:
|
||||
self._subscribers[event_type].remove(handler)
|
||||
except ValueError:
|
||||
pass
|
||||
logger.debug(f"Handler not found for {event_type} during unsubscribe")
|
||||
|
||||
def publish(self, event_type: EventType, payload: Dict[str, Any]) -> Event:
|
||||
"""Create an Event, append to history, and invoke all handlers.
|
||||
@@ -88,9 +91,7 @@ class EventBus:
|
||||
try:
|
||||
handler(event)
|
||||
except Exception as e:
|
||||
# Silently catch handler errors to prevent cascade failures
|
||||
# In production, could log to a logger
|
||||
pass
|
||||
logger.warning(f"Event handler error for {event_type}: {e}")
|
||||
|
||||
return event
|
||||
|
||||
|
||||
Reference in New Issue
Block a user