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
//! Event export trait for streaming HiveEvents to external observability systems.
//!
//! [`EventExporter`] enables PulseHive to forward events to tools like PulseVision
//! for real-time visualization. Implementations handle the wire protocol (WebSocket,
//! HTTP, file, etc.); the SDK calls `export()` on each event emission.
//!
//! # Example
//! ```rust,ignore
//! use pulsehive_core::export::EventExporter;
//! use pulsehive_core::event::HiveEvent;
//!
//! struct FileExporter { path: PathBuf }
//!
//! #[async_trait]
//! impl EventExporter for FileExporter {
//! async fn export(&self, event: &HiveEvent) {
//! let json = serde_json::to_string(event).unwrap();
//! tokio::fs::write(&self.path, json).await.ok();
//! }
//! async fn flush(&self) {}
//! }
//! ```
use async_trait;
use crateHiveEvent;
/// Trait for exporting HiveEvents to external observability systems.
///
/// When registered with `HiveMindBuilder::event_exporter()`, the exporter
/// receives every event emitted by the agent runtime. Export is fire-and-forget —
/// errors are logged but don't block agent execution.
///
/// Must be `Send + Sync` for use across Tokio tasks.