Skip to content

Hooks & Side Effects

HookResult

Bases: BaseModel

Result returned by a sync hook.

event class-attribute instance-attribute

event = None

The replacement payload when action is "modify".

Typed loosely because a sync hook receives whatever its trigger passes, and only one of them passes a RoomEvent: BEFORE_TTS receives a string, the bridge triggers receive frames, the tool and generation triggers receive their own event types. Restricting this to RoomEvent made "modify" impossible for all of them — the hook raised, the engine logged and carried on, and the unmodified payload continued on its way.

Consumers must check the type they expect before using it.

allow classmethod

allow(injected=None)

Allow the event to proceed.

block classmethod

block(reason, injected=None, tasks=None, observations=None)

Block the event from proceeding.

modify classmethod

modify(event, injected=None)

Replace the payload before it proceeds.

Takes whatever the trigger passed the hook — a string for BEFORE_TTS, a RoomEvent for BEFORE_BROADCAST — because restricting it to RoomEvent left every other sync trigger unable to use its own constructor.

InjectedEvent

Bases: BaseModel

An event injected by a hook as a side effect.

Task

Bases: BaseModel

A task assigned within a room.

Observation

Bases: BaseModel

An observation produced by an intelligence channel.