1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
//! Astrid Events - Event bus for the Astrid secure agent runtime.
//!
//! This crate provides:
//! - Event types for all runtime operations
//! - Broadcast-based event bus for async subscribers
//! - Subscriber registry for synchronous handlers
//!
//! # Architecture
//!
//! Events are published to an `EventBus` which broadcasts them to all
//! subscribers. There are two ways to subscribe:
//!
//! 1. **Async receivers**: Use `bus.subscribe()` to get an `EventReceiver`
//! that can be polled asynchronously.
//!
//! 2. **Synchronous subscribers**: Register implementations of `EventSubscriber`
//! with the registry for immediate callback-based notification.
//!
//! # Example
//!
//! ```rust
//! use astrid_events::{EventBus, AstridEvent, EventMetadata};
//!
//! # async fn example() {
//! // Create an event bus
//! let bus = EventBus::new();
//!
//! // Subscribe to events
//! let mut receiver = bus.subscribe();
//!
//! // Publish an event
//! bus.publish(AstridEvent::RuntimeStarted {
//! metadata: EventMetadata::new("runtime"),
//! version: "0.1.0".to_string(),
//! });
//!
//! // Receive the event
//! let event = receiver.recv().await.unwrap();
//! assert_eq!(event.event_type(), "runtime_started");
//! # }
//! ```
pub use ;
pub use ;
pub use ;
pub use ;