forked from kent/consciousness
poc-daemon: subscribe to channel notifications, drop config.rs
Wire poc-daemon into channel daemon notifications via subscribe_all(). Channel notifications (IRC, telegram, tmux) now flow through the existing notification pipeline instead of the dead module system. Remove claude/config.rs — daemon config is fully covered by channel config files in ~/.consciousness/channels/. Co-Authored-By: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
parent
1941624249
commit
8c1fef3c69
5 changed files with 22 additions and 180 deletions
|
|
@ -7,7 +7,6 @@
|
|||
// The daemon protocol (daemon_capnp) and universal infrastructure
|
||||
// (channels, supervisor, notify) remain in thalamus/.
|
||||
|
||||
pub mod config;
|
||||
pub mod context;
|
||||
pub mod hook;
|
||||
pub mod idle;
|
||||
|
|
@ -443,7 +442,6 @@ async fn server_main() -> Result<(), Box<dyn std::error::Error>> {
|
|||
let pid = std::process::id();
|
||||
std::fs::write(pid_path(), pid.to_string()).ok();
|
||||
|
||||
let daemon_config = Rc::new(RefCell::new(config::Config::load()));
|
||||
|
||||
let state = Rc::new(RefCell::new(idle::State::new()));
|
||||
state.borrow_mut().load();
|
||||
|
|
@ -452,13 +450,22 @@ async fn server_main() -> Result<(), Box<dyn std::error::Error>> {
|
|||
|
||||
tokio::task::LocalSet::new()
|
||||
.run_until(async move {
|
||||
// Start modules
|
||||
let (_notify_tx, mut notify_rx) = tokio::sync::mpsc::unbounded_channel::<notify::Notification>();
|
||||
|
||||
// External modules (IRC, Telegram) now run as separate daemons.
|
||||
// They connect via the notification channel when implemented.
|
||||
let _irc_state: Option<()> = None;
|
||||
let _telegram_state: Option<()> = None;
|
||||
// Subscribe to channel daemon notifications
|
||||
let (notify_tx, mut notify_rx) = tokio::sync::mpsc::unbounded_channel::<notify::Notification>();
|
||||
{
|
||||
let channel_rx = crate::thalamus::channels::subscribe_all();
|
||||
let tx = notify_tx.clone();
|
||||
std::thread::spawn(move || {
|
||||
while let Ok(cn) = channel_rx.recv() {
|
||||
let _ = tx.send(notify::Notification {
|
||||
ntype: cn.channel,
|
||||
urgency: cn.urgency,
|
||||
message: cn.preview,
|
||||
timestamp: crate::thalamus::now(),
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
let listener = UnixListener::bind(&sock)?;
|
||||
#[cfg(unix)]
|
||||
|
|
@ -528,7 +535,6 @@ async fn server_main() -> Result<(), Box<dyn std::error::Error>> {
|
|||
|
||||
let daemon_impl = rpc::DaemonImpl::new(
|
||||
state.clone(),
|
||||
daemon_config.clone(),
|
||||
);
|
||||
let client: daemon_capnp::daemon::Client =
|
||||
capnp_rpc::new_client(daemon_impl);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue