agora.matrix.sync
Event stream → domain-event dispatcher.
Components register async handlers for specific domain events. EventDispatcher.handle()
takes a raw Matrix event dict, parses it, and fans out to all registered handlers.
The dispatcher intentionally does not own a sync loop — Sprint 2 keeps the surface small.
A production sync loop is wired up by the orchestrator (Sprint 3), which calls
handle for each event yielded by AsyncClient.sync_forever.
Classes
Routes parsed Agora events (and a few Matrix-native ones we care about). |
|
Parsed |
|
A |
- class agora.matrix.sync.ReactionEvent[source]
Bases:
objectParsed
m.reactionpointing at a target message.- __init__(event_id, target_event_id, key, sender)
- class agora.matrix.sync.ReplyEvent[source]
Bases:
objectA
m.room.messagethat carriesm.in_reply_toto another event.- __init__(event_id, target_event_id, body, sender)
- class agora.matrix.sync.EventDispatcher[source]
Bases:
objectRoutes parsed Agora events (and a few Matrix-native ones we care about).
Components register async handlers for specific event types via the
on_*methods;handle()takes a raw Matrix event dict, parses it into the matching domain type (Task,TaskResult,PhaseChange,Learning,ReactionEvent,ReplyEvent, plus MSC3381 poll responses and/agoracommands), and fans out to every registered handler in registration order.Idempotency: every parsed event is keyed by its Matrix
event_idand duplicate deliveries (which Conduit can produce on reconnect) are silently skipped. Handlers run sequentially within a single event; parallelism between distinct events is the caller’s responsibility.The dispatcher does not own a sync loop — the orchestrator wires one up via
agora.observe.sync_service.SyncService, which callshandle()for each event yielded byAsyncClient.sync_forever.