[245-sub] Event bus base — SensoryEvent model + EventBus dispatcher #306

Closed
opened 2026-03-18 20:57:31 +00:00 by kimi · 0 comments
Collaborator

Parent: #245 — Stream adapters

What

Create the event bus infrastructure that all stream adapters emit into.

Deliverables

  1. src/timmy/events.py — SensoryEvent dataclass:

    @dataclass
    class SensoryEvent:
        source: str       # "gitea", "time", "bitcoin", "terminal"
        event_type: str   # "push", "issue_opened", "new_block", "morning"
        timestamp: datetime
        data: dict        # adapter-specific payload
        actor: str = ""   # who caused it (username, "system", etc)
    
  2. src/timmy/event_bus.py — Simple pub/sub:

    • EventBus.emit(event) — push event to all subscribers
    • EventBus.subscribe(event_type, callback) — register listener
    • EventBus.recent(n=10) — last N events (for context window)
  3. Tests in tests/timmy/test_events.py and tests/timmy/test_event_bus.py

Scope

2-3 files, no external dependencies. Pure Python. Kimi-ready.

Acceptance

  • tox -e unit passes
  • EventBus can emit and receive events in tests
  • SensoryEvent is JSON-serializable
## Parent: #245 — Stream adapters ### What Create the event bus infrastructure that all stream adapters emit into. ### Deliverables 1. `src/timmy/events.py` — SensoryEvent dataclass: ```python @dataclass class SensoryEvent: source: str # "gitea", "time", "bitcoin", "terminal" event_type: str # "push", "issue_opened", "new_block", "morning" timestamp: datetime data: dict # adapter-specific payload actor: str = "" # who caused it (username, "system", etc) ``` 2. `src/timmy/event_bus.py` — Simple pub/sub: - `EventBus.emit(event)` — push event to all subscribers - `EventBus.subscribe(event_type, callback)` — register listener - `EventBus.recent(n=10)` — last N events (for context window) 3. Tests in `tests/timmy/test_events.py` and `tests/timmy/test_event_bus.py` ### Scope 2-3 files, no external dependencies. Pure Python. Kimi-ready. ### Acceptance - `tox -e unit` passes - EventBus can emit and receive events in tests - SensoryEvent is JSON-serializable
kimi added the 222-epickimi-ready labels 2026-03-18 20:57:31 +00:00
kimi was assigned by hermes 2026-03-18 21:04:08 +00:00
Sign in to join this conversation.
No Label 222-epic kimi-ready
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Rockachopa/Timmy-time-dashboard#306