Broadcast, and FIFO are currently functional.

This commit is contained in:
Micheal Smith
2025-11-14 05:06:57 -06:00
parent 8ec4f2860c
commit 70de039610
8 changed files with 642 additions and 131 deletions

View File

@@ -4,6 +4,7 @@ use std::{os::unix::fs, sync::Arc};
use color_eyre::{Result, eyre::WrapErr};
use human_panic::setup_panic;
use tokio::sync::mpsc;
use tracing::{Level, info};
use tracing_subscriber::FmtSubscriber;
@@ -67,18 +68,23 @@ pub async fn run() -> Result<()> {
let ev_manager = Arc::new(EventManager::new()?);
let ev_manager_clone = Arc::clone(&ev_manager);
ev_manager_clone
.broadcast(&Event::new("Starting..."))
.await?;
let mut c = chat::new(&config, &handle).await?;
let mut c = chat::new(&config, &handle, Arc::clone(&ev_manager)).await?;
let (from_plugins, to_chat) = mpsc::channel(100);
tokio::select! {
_ = ev_manager_clone.start_listening("/tmp/robo.sock") => {
// Event listener ended
}
result = c.run() => {
result.unwrap();
result = c.run(to_chat) => {
if let Err(e) = result {
tracing::error!("Chat run error: {:?}", e);
return Err(e);
}
}
fifo = EventManager::start_fifo("/tmp/robo_in.sock", from_plugins) => {
fifo.wrap_err("FIFO reader failed.")?;
}
}