src.core.events module#
Event Distribution System for Marcus.
Simple event system that allows components to publish and subscribe to events without complex dependencies. Events enable loose coupling between systems.
- class src.core.events.Events[source]#
Bases:
objectSimple event distribution system for Marcus.
Features: - Publish/subscribe pattern - Async event handling - Event history (optional) - Error isolation (one subscriber error doesn’t affect others) - Optional persistence to disk
- async publish(event_type, source, data, metadata=None, wait_for_handlers=True)[source]#
Publish an event to all subscribers.
- Parameters:
event_type (
str) – Type of event (e.g., ‘task_assigned’, ‘progress_updated’).source (
str) – Source of the event (e.g., ‘marcus’, ‘agent_123’).metadata (
Optional[Dict[str,Any]]) – Optional metadata (confidence scores, etc.).wait_for_handlers (
bool) – If False, handlers run asynchronously without waiting (default: True).
- Return type:
- Returns:
The published Event object
- async get_history(event_type=None, source=None, limit=100)[source]#
Get event history with optional filtering.
- class src.core.events.EventTypes[source]#
Bases:
objectStandard event types used in Marcus.
- TASK_REQUESTED = 'task_requested'#
- TASK_ASSIGNED = 'task_assigned'#
- TASK_STARTED = 'task_started'#
- TASK_PROGRESS = 'task_progress'#
- TASK_COMPLETED = 'task_completed'#
- TASK_BLOCKED = 'task_blocked'#
- BLOCKER_RESOLVED = 'blocker_resolved'#
- AGENT_REGISTERED = 'agent_registered'#
- AGENT_STATUS_CHANGED = 'agent_status_changed'#
- AGENT_SKILL_UPDATED = 'agent_skill_updated'#
- PROJECT_CREATED = 'project_created'#
- PROJECT_UPDATED = 'project_updated'#
- PROJECT_COMPLETED = 'project_completed'#
- SYSTEM_STARTUP = 'system_startup'#
- SYSTEM_SHUTDOWN = 'system_shutdown'#
- KANBAN_CONNECTED = 'kanban_connected'#
- KANBAN_ERROR = 'kanban_error'#
- CONTEXT_UPDATED = 'context_updated'#
- DEPENDENCY_DETECTED = 'dependency_detected'#
- IMPLEMENTATION_FOUND = 'implementation_found'#
- DECISION_LOGGED = 'decision_logged'#
- PATTERN_DETECTED = 'pattern_detected'#
- PLANNING_INTENT_FIDELITY = 'planning_intent_fidelity'#
- PREDICTION_MADE = 'prediction_made'#
- AGENT_LEARNED = 'agent_learned'#
- ERROR = 'error'#
- WARNING = 'warning'#