Expand description
Astrid Events - Event bus and types for the Astrid secure agent runtime.
This crate provides:
- IPC payload types and LLM message schemas (re-exported from
astrid-types) - Broadcast-based event bus for async subscribers
- Subscriber registry for synchronous handlers
Re-exports§
pub use ipc::IpcRateLimiter;
Modules§
- ipc
- IPC types — re-exported from
astrid-typeswith runtime additions. - kernel_
api - Kernel management API request and response types.
- llm
- LLM types for messages, tools, and streaming.
- prelude
- Prelude module - commonly used types for convenient import.
- rate_
limiter - IPC rate limiter for publish events.
Structs§
- Event
Bus - Event bus for broadcasting events to all subscribers.
- Event
Metadata - Metadata attached to every event.
- Event
Receiver - Receiver for events from the event bus.
- IpcMessage
- A cross-boundary message sent over the event bus between WASM guests and the host.
- Route
Key - Composite identity of a single routed subscription on the bus.
- Routed
Event Receiver - Receiver-side handle returned by
EventBus::subscribe_topic_routed. - Topic
Matcher - Compiled topic-pattern matcher. Mirrors the segment-aware matching
semantics of
EventReceiver::matchesso the broadcast and routed paths agree on what each pattern means.
Enums§
- Astrid
Event - All events that can occur in the Astrid runtime.
- IpcPayload
- Standardized cross-boundary payload schemas.
Constants§
- DRR_
QUANTUM_ MIN_ BYTES - Per-round DRR floor. 5000 active principals × 4
KiB= 20MiBof theoretical per-round throughput, well above the 1MiBtotal budget, so a round always serves something for every principal in the rotation rather than starving the long tail. - MAX_
SUBSCRIPTION_ BUDGET_ BYTES - Maximum bytes a single subscription will hold across all its per-principal sub-queues before publish-side head-eviction kicks in. Matches the per-call IPC payload ceiling so any single message still fits within one budget.
- METRIC_
ROUTE_ ACTIVE_ PRINCIPALS - Gauge: number of active principal sub-queues currently held by a
route. Labelled by
capsule. - METRIC_
ROUTE_ BUDGET_ BYTES_ IN_ USE - Gauge: bytes currently held by a route across all its sub-queues.
Labelled by
capsule. - METRIC_
ROUTE_ BYTE_ EVICTIONS_ TOTAL - Counter: head messages evicted from a per-principal sub-queue because
the route’s global byte budget would otherwise be exceeded. Labelled
by
capsule(the subscribing capsule) and boundedprincipal_class. - METRIC_
ROUTE_ QUANTUM_ STARVED_ TOTAL - Counter: rounds in which a principal’s deficit-round-robin quantum could not cover its queue head message (sustained back pressure). Diagnostic — not a drop signal.
Functions§
- ipc_
size_ of - Approximate the byte cost of an event for budget bookkeeping. The
Arc<AstridEvent>size in memory dwarfs theIpcPayloadcontent for small messages; we charge the payload’s JSON length so a flood of 1-byte payloads doesn’t masquerade as a 0-byte stream. Non-IPC events fall back to a flat constant since they don’t route through here in practice. - principal_
class_ label - Label for telemetry classification. Identical mapping to
astrid_capsule::principal_class::PrincipalClass::as_labelsoprincipal_classlabels collide across both crates. - topic_
pattern_ matches - True iff
topicmatchespatternusing trailing-*-is-subtree semantics: a trailing*matches one OR MORE remaining segments at any depth, a mid-segment*matches exactly one segment, otherwise segment counts must be equal. Allocation-free — iterates the segment splits directly.
Type Aliases§
- Principal
Key - Principal identity key for a fan-out bucket.
None= system (kernel) principal;Some(s)= user/agent principal string.