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

Apache-2.0

Metadata

Release files for kollabor-events 0.21.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for kollabor-events 0.21.0
File Size Uploaded Provenance Actions
kollabor_events-0.21.0.tar.gz 24.5 kB Without provenance Details for kollabor_events-0.21.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for kollabor-events 0.21.0
File Interpreter ABI Platform Actions
kollabor_events-0.21.0-py3-none-any.whl Python 3 none any Details for kollabor_events-0.21.0-py3-none-any.whl

Total release size: 52.5 kB

Release files / kollabor_events-0.21.0.tar.gz

Download URL kollabor_events-0.21.0.tar.gz
Size 24.5 kB
Tags Source
SHA-256 checksum
How to use checksums
d578da9ff67b803b37ff3018a2d0e09b7d565a840368b39171fb6f491983be1f
BLAKE2b-256 checksum
How to use checksums
744b1a49dcd5846cbef9cd190162f240dbc54d07a649adfbb5eb1a177425f2bc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / kollabor_events-0.21.0-py3-none-any.whl

Download URL kollabor_events-0.21.0-py3-none-any.whl
Size 28.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9dcb3ce7685c2e83fde9c63ec5fa9c85846b9ffc1b803d9fcedd8dc6c745799b
BLAKE2b-256 checksum
How to use checksums
0236da1c361aa73c5a5458a9ae063f5822e0b636734b5a9decc2ff67436f2645
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Security for kollabor-events 0.21.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.21.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page