feat(sdk): event bus — lightweight publish-subscribe for inter-addon messaging #382

Open
opened 2026-03-03 23:02:08 +00:00 by forbes · 0 comments
Owner

Summary

Add a centralized event bus so addons can communicate without importing each other directly. Avoids circular dependencies and keeps addons loosely coupled.

Current state (MISSING)

No pub/sub, no named event channels, no emit()/on() API. Addons are fully isolated — confirmed that no addon imports another (import silo, from gears, etc. do not appear anywhere in mods/). The only shared state is through the context and origin systems.

Proposed API

import kindred_sdk as sdk

sdk.emit("silo.document_locked", {"doc_id": "abc", "user": "forbes"})
sdk.on("silo.document_locked", my_handler)
sdk.off("silo.document_locked", my_handler)
  • Namespaced by convention: silo.document_locked, gears.generation_complete, etc.
  • Synchronous dispatch (no async queue) — keeps the mental model simple
  • Payload is an arbitrary dict

Implementation notes

  • Pure Python implementation in kindred_sdk/events.py
  • Internal dict of event_name -> [callbacks]
  • Thread-safe (Qt main thread only, but guard against re-entrancy)
  • Export from kindred_sdk.__init__

Roadmap

v0.2.0 — SDK Core

## Summary Add a centralized event bus so addons can communicate without importing each other directly. Avoids circular dependencies and keeps addons loosely coupled. ## Current state (MISSING) No pub/sub, no named event channels, no `emit()`/`on()` API. Addons are fully isolated — confirmed that no addon imports another (`import silo`, `from gears`, etc. do not appear anywhere in `mods/`). The only shared state is through the context and origin systems. ## Proposed API ```python import kindred_sdk as sdk sdk.emit("silo.document_locked", {"doc_id": "abc", "user": "forbes"}) sdk.on("silo.document_locked", my_handler) sdk.off("silo.document_locked", my_handler) ``` - Namespaced by convention: `silo.document_locked`, `gears.generation_complete`, etc. - Synchronous dispatch (no async queue) — keeps the mental model simple - Payload is an arbitrary dict ## Implementation notes - Pure Python implementation in `kindred_sdk/events.py` - Internal dict of `event_name -> [callbacks]` - Thread-safe (Qt main thread only, but guard against re-entrancy) - Export from `kindred_sdk.__init__` ## Roadmap v0.2.0 — SDK Core
forbes added the enhancement label 2026-03-03 23:02:08 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: kindred/create#382