Skip to main content

astrid_events/
lib.rs

1//! Astrid Events - Event bus and types for the Astrid secure agent runtime.
2//!
3//! This crate provides:
4//! - IPC payload types and LLM message schemas (re-exported from `astrid-types`)
5//! - Broadcast-based event bus for async subscribers
6//! - Subscriber registry for synchronous handlers
7
8#![deny(unsafe_code)]
9#![deny(missing_docs)]
10#![deny(clippy::all)]
11#![deny(unreachable_pub)]
12#![deny(clippy::unwrap_used)]
13#![cfg_attr(test, allow(clippy::unwrap_used))]
14
15pub mod prelude;
16
17mod bus;
18mod event;
19pub mod ipc;
20pub mod rate_limiter;
21mod route;
22mod subscriber;
23
24// Re-export shared types for backward compatibility. `kernel_api` lives in
25// `astrid-core` (it references `PrincipalId`/`Quotas`); `llm` is in
26// `astrid-types` (the WASM-compatible side, zero `astrid-core` dep).
27pub use astrid_core::kernel_api;
28pub use astrid_types::llm;
29
30pub use bus::{EventBus, EventReceiver};
31pub use event::{AstridEvent, EventMetadata};
32pub use ipc::IpcMessage;
33pub use ipc::IpcPayload;
34pub use ipc::IpcRateLimiter;
35pub use route::{
36    DRR_QUANTUM_MIN_BYTES, MAX_SUBSCRIPTION_BUDGET_BYTES, METRIC_ROUTE_ACTIVE_PRINCIPALS,
37    METRIC_ROUTE_BUDGET_BYTES_IN_USE, METRIC_ROUTE_BYTE_EVICTIONS_TOTAL,
38    METRIC_ROUTE_QUANTUM_STARVED_TOTAL, PrincipalKey, RouteKey, RoutedEventReceiver, TopicMatcher,
39    ipc_size_of, principal_class_label, topic_pattern_matches,
40};