Hooks¶
HookEngine ¶
HookRegistration
dataclass
¶
HookRegistration(trigger, execution, fn, priority=0, name='', timeout=30.0, channel_types=None, channel_ids=None, directions=None)
A registered hook function.
Attributes:
| Name | Type | Description |
|---|---|---|
trigger |
HookTrigger
|
When the hook fires (BEFORE_BROADCAST, AFTER_BROADCAST, etc.) |
execution |
HookExecution
|
SYNC (can block/modify) or ASYNC (fire-and-forget) |
fn |
SyncHookFn | AsyncHookFn
|
The hook function |
priority |
int
|
Lower numbers run first (default: 0) |
name |
str
|
Optional name for logging and removal |
timeout |
float
|
Max execution time in seconds (default: 30.0) |
channel_types |
set[ChannelType] | None
|
Only run for events from these channel types (None = all) |
channel_ids |
set[str] | None
|
Only run for events from these channel IDs (None = all) |
directions |
set[ChannelDirection] | None
|
Only run for events with these directions (None = all) |