Expand description
The event bus (spec 3.2 §7.6).
Every state change in the kernel is a KernelEvent: process transitions from the
worker’s S1 hooks (never polled), wakes, holds and decisions, rule hits, spend,
governance and health. EventBus numbers each one with a cursor and delivers it to
subscribers and EventSinks. The bus is bounded per sink; a slow sink drops Health
first and never blocks a process. A reconnecting surface catches up by cursor
(EventBus::subscribe_after) rather than by holding a subscription open.
The receivers are the control plane’s SSE stream (GET /kernel/events, a subscriber),
the signed audit log (AuditSink) for the events that are audit records (§9.3), and
outbound webhooks (WebhookSink, feature webhooks): each event an EventFilter
selects, signed with Standard Webhooks signatures as the webhook ingress verifies them.
Driver events come from the MCP manager’s status channel (spec 3.2 §10 T1), never
polled. With a ledger (feature proc), the kernel’s ledger sink writes a content-free
row for every event but Health (spec 3.2 §7.10).
Structs§
- Audit
Sink - Writes the events that are audit records to the signed audit log (spec 3.2 §7.6, §9.3),
kind
Other(KERNEL_AUDIT_KIND)with thekernel.*actions ofcrate::audit. - Event
Bus - The kernel’s event bus (spec 3.2 §7.6).
- Event
Filter - Which
KernelEvents a sink delivers, by kind (spec 3.2 §7.6). - Event
Record - A numbered
KernelEventas the bus delivers it (spec 3.2 §7.6). - Event
Subscriber - A subscription to the
EventBus(spec 3.2 §7.6). - Spend
Delta - Usage a process committed (spec 3.2 §7.6): the cost in micro-USD as
SpendLedgercounts it, the model calls and tokens a run budget counts, and the usage perUsageUnit. - Webhook
Sink - Delivers the kernel’s events to an HTTP endpoint as signed webhooks (spec 3.2 §7.6).
Enums§
- Event
Kind - The kind of a
KernelEvent, named as itstypefield serializes it (spec 3.2 §7.6). - Kernel
Event - A change in the kernel (spec 3.2 §7.6).
Constants§
- DEFAULT_
EVENT_ CAPACITY - How many events a subscriber may fall behind before it skips ahead.
Traits§
- Event
Sink - A destination for kernel events (spec 3.2 §7.6): the SSE stream, a channel notifier, an outbound webhook, the audit log.