feat(events): add generic Event Bus and /events/wait endpoint for agent wakeups

This commit is contained in:
Riz Ashraf committed 2026-09-26 02:05:18 +01:00
1 parent b8d58b2e64
commit efcab4a7b4
5 files changed
+69

No files matched your search

+9
View File
@@ -5,6 +5,13 @@ use std::collections::HashMap;
use std::path::PathBuf;
use std::sync::{Arc, RwLock};
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct GenericEvent {
pub topic: String,
pub session_id: Option<String>,
pub payload: serde_json::Value,
}
pub struct MemoryState {
pub base_dir: PathBuf,
pub graph: Store<KnowledgeGraph>,
@@ -29,6 +36,7 @@ pub struct MemoryState {
pub context_workspaces: Store<Vec<ContextWorkspace>>,
pub recent_activities: Store<std::collections::VecDeque<serde_json::Value>>,
pub activity_tx: tokio::sync::broadcast::Sender<String>,
pub event_bus_tx: tokio::sync::broadcast::Sender<GenericEvent>,
}
impl MemoryState {
@@ -72,6 +80,7 @@ impl MemoryState {
context_workspaces: Store::new("context_workspaces", db.clone()),
recent_activities: Store::new("recent_activities", db.clone()),
activity_tx: tokio::sync::broadcast::channel(100).0,
event_bus_tx: tokio::sync::broadcast::channel(1000).0,
}
}