Skip to main content

kollabor-events

kollabor-events is Kollabor's event bus and hook foundation.

It provides the shared event models, hook registry, hook executor, event processor, permission models, ready-message aggregation, and small utility helpers used by the CLI, plugins, engine, agent runtime, and TUI.

Current Role

  • Register and execute hooks for core and plugin-defined event types.
  • Order hook execution by priority and preserve hook status/error metadata.
  • Provide event, command, permission, and conversation data models.
  • Store cross-package services on the event bus for loose coupling.
  • Provide utility helpers for safe execution and nested dict access.

Architecture

Module Responsibility
bus.py EventBus, service registry, hook registration, event emission
models.py event types, hooks, command definitions, UI models
registry.py hook storage and enable/disable/status lookup
executor.py hook execution, timeout/retry/error behavior
processor.py event phase mapping and ordered processing
hook_adapter.py sync/async hook compatibility
permissions_models.py / permissions_config.py approval and risk models
data_models.py conversation/session metadata models
ready_message.py startup/ready message collection
dict_utils.py / error_utils.py safe utility helpers

Hook Priorities

Priority Value Purpose
SYSTEM 1000 core lifecycle/system hooks
SECURITY 900 permission and policy hooks
PREPROCESSING 500 input/request transforms
LLM 100 LLM orchestration hooks
POSTPROCESSING 50 response/result transforms
DISPLAY 10 display/UI hooks

Usage

from kollabor_events import EventBus, EventType, Hook, HookPriority

bus = EventBus()


async def on_tool_pre(data, event):
    data["checked"] = True
    return data


await bus.register_hook(Hook(
    plugin_name="example",
    name="check_tool",
    event_type=EventType.TOOL_CALL_PRE,
    priority=HookPriority.SECURITY.value,
    callback=on_tool_pre,
))

result = await bus.emit_with_hooks(
    EventType.TOOL_CALL_PRE,
    {"tool_data": {"type": "terminal"}},
    source="example",
)

Known Gaps

  • The event model is broad and shared across many packages; event ownership and schema expectations should be documented closer to each event type.
  • String-based custom events are supported, but typed contracts are stronger for core events.
  • Hook error/timeout behavior is configurable, so callers should test important security and lifecycle hooks under failure conditions.

Roadmap

Phase 1: Event contract docs

  • Document core event payload schemas and expected mutation behavior.
  • Add examples for common hook categories: security, display, LLM, and plugins.
  • Link event types to the package that owns their primary behavior.

Phase 2: Safer extension points

  • Add optional typed payload helpers for high-risk events.
  • Expand tests for cancellation, timeout, retry, and hook ordering behavior.
  • Make plugin-defined event naming conventions explicit.

Phase 3: Observability

  • Improve hook status snapshots for diagnostics and UI display.
  • Add structured hook execution traces for debugging event-heavy flows.

Development

Targeted validation examples:

python -m py_compile packages/kollabor-events/src/kollabor_events/*.py
python -m pytest tests/unit/test_hub_native_param_compat.py -q

Dependencies

None. This package is intentionally stdlib-only.

License

MIT

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kollabor_events-0.5.24.tar.gz (25.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

kollabor_events-0.5.24-py3-none-any.whl (30.1 kB view details)

Uploaded Python 3

File details

Details for the file kollabor_events-0.5.24.tar.gz.

File metadata

  • Download URL: kollabor_events-0.5.24.tar.gz
  • Upload date:
  • Size: 25.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.13

File hashes

Hashes for kollabor_events-0.5.24.tar.gz
Algorithm Hash digest
SHA256 400dc0d29d44ca45830cd17b352ebcb15b8987768a1dea3bdbd62a22e33faba7
MD5 a46312489875ed09787e346fed7c1a86
BLAKE2b-256 251a83c6c80e05569ad33efc3075174e5a94a6c85560cb0e5772b3a9f4112d51

See more details on using hashes here.

File details

Details for the file kollabor_events-0.5.24-py3-none-any.whl.

File metadata

File hashes

Hashes for kollabor_events-0.5.24-py3-none-any.whl
Algorithm Hash digest
SHA256 8b6ea3f3772c3a45a348641f586a818312a18c0fd735209a81e323d3f62cbf57
MD5 6ea8c36ce62912454a69813cb4dd74d4
BLAKE2b-256 6b8cf20b325fb9172aeebe51211a19a30e830de737f369d04c9b966d8a70b3d9

See more details on using hashes here.

Release history Release notifications | RSS feed

1.0.1

2 files

1.0.0

2 files

0.7.2

2 files

0.7.1

2 files

0.7.0

2 files

0.6.1

2 files

0.6.0

2 files

This release

0.5.24 This release

2 files

0.5.23

2 files

0.5.22

2 files

0.5.20

2 files

0.5.19

2 files

0.5.18

2 files

0.5.16

2 files

0.5.15

2 files

0.5.14

2 files

0.5.13

2 files

0.5.12

2 files

0.5.11

2 files

0.5.8

2 files

0.5.7

2 files

0.5.5

2 files

0.4.22

2 files

0.4.21

2 files

0.4.19

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page