subscribe to channel daemon notifications
consciousness binary subscribes to all channel daemons on startup. Notifications forwarded via NotifyForwarder callback through mpsc. Pending notifications stored for thalamus agent consumption. Channel list refreshed automatically when notifications arrive. Co-Developed-By: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
parent
7d1637a2f0
commit
b24e8e87a2
2 changed files with 144 additions and 2 deletions
|
|
@ -825,6 +825,11 @@ async fn run(cli: cli::CliArgs) -> Result<()> {
|
|||
});
|
||||
}
|
||||
|
||||
// Subscribe to channel daemon notifications
|
||||
let notify_rx = poc_memory::thalamus::channels::subscribe_all();
|
||||
let mut pending_notifications: Vec<poc_memory::thalamus::channels::ChannelNotification> = Vec::new();
|
||||
|
||||
|
||||
// Create UI channel
|
||||
let (ui_tx, mut ui_rx) = ui_channel::channel();
|
||||
|
||||
|
|
@ -999,6 +1004,17 @@ async fn run(cli: cli::CliArgs) -> Result<()> {
|
|||
// Update idle state for F5 screen
|
||||
idle_state.decay_ewma();
|
||||
app.update_idle(&idle_state);
|
||||
|
||||
// Drain channel notifications into thalamus pending list
|
||||
while let Ok(notif) = notify_rx.try_recv() {
|
||||
pending_notifications.push(notif);
|
||||
// Refresh channel list when notifications arrive
|
||||
let tx = channel_tx.clone();
|
||||
tokio::spawn(async move {
|
||||
let result = poc_memory::thalamus::channels::fetch_all_channels().await;
|
||||
let _ = tx.send(result).await;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// DMN timer (only when no turn is running)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue