channel architecture: wire protocol, daemons, supervisor

Design and implement the channel system for external communications:

- schema/channel.capnp: wire protocol for channel daemons
  (recv with all_new/min_count, send, subscribe, list)
- channels/irc/: standalone IRC daemon crate (consciousness-channel-irc)
- channels/telegram/: standalone Telegram daemon crate
  (consciousness-channel-telegram)
- src/thalamus/channels.rs: client connecting to daemon sockets
- src/thalamus/supervisor.rs: daemon lifecycle with file locking
  for multi-instance safety

Channel daemons listen on ~/.consciousness/channels/*.sock,
configs in *.json5, supervisor discovers and starts them.
IRC/Telegram modules removed from thalamus core — they're
now independent daemons that survive consciousness restarts.

Also: delete standalone tui.rs (moved to consciousness F4/F5),
fix build warnings, add F5 thalamus screen with channel status.

Co-Developed-By: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
ProofOfConcept 2026-04-03 18:46:14 -04:00
parent db42bf6243
commit ad5f69abb8
23 changed files with 1716 additions and 1921 deletions

View file

@ -25,6 +25,7 @@ pub(crate) const SCREEN_LEGEND: &str = " F1=interact F2=conscious F3=subconsci
/// Subconscious agents — interact with conscious context
pub(crate) const SUBCONSCIOUS_AGENTS: &[&str] = &["surface-observe", "journal", "reflect"];
/// Unconscious agents — background consolidation
#[allow(dead_code)]
pub(crate) const UNCONSCIOUS_AGENTS: &[&str] = &["linker", "organize", "distill", "split"];
use crossterm::{

View file

@ -1,17 +1,17 @@
// thalamus_screen.rs — F5: attention routing / daemon status
// thalamus_screen.rs — F5: attention routing and channel status
//
// Shows poc-daemon status: presence detection, idle timer,
// notification routing, activity level.
// Shows presence/idle/activity status, then channel daemon status.
use ratatui::{
layout::Rect,
style::{Color, Style},
text::Line,
text::{Line, Span},
widgets::{Block, Borders, Paragraph, Wrap},
Frame,
};
use super::{App, SCREEN_LEGEND};
use crate::thalamus::supervisor::Supervisor;
fn fetch_daemon_status() -> Vec<String> {
std::process::Command::new("poc-daemon")
@ -26,20 +26,58 @@ fn fetch_daemon_status() -> Vec<String> {
}
})
.map(|s| s.lines().map(String::from).collect())
.unwrap_or_else(|| vec!["daemon not running".to_string()])
.unwrap_or_default()
}
impl App {
pub(crate) fn draw_thalamus(&self, frame: &mut Frame, size: Rect) {
let status_lines = fetch_daemon_status();
let section = Style::default().fg(Color::Yellow);
let dim = Style::default().fg(Color::DarkGray);
let mut lines: Vec<Line> = Vec::new();
lines.push(Line::styled("── Thalamus ──", section));
// Presence status first
let daemon_status = fetch_daemon_status();
if !daemon_status.is_empty() {
lines.push(Line::styled("── Presence ──", section));
lines.push(Line::raw(""));
for line in &daemon_status {
lines.push(Line::raw(format!(" {}", line)));
}
lines.push(Line::raw(""));
}
// Channel status
lines.push(Line::styled("── Channels ──", section));
lines.push(Line::raw(""));
for line in &status_lines {
lines.push(Line::raw(format!(" {}", line)));
let mut sup = Supervisor::new();
sup.load_config();
let status = sup.status();
if status.is_empty() {
lines.push(Line::styled(" no channels configured", dim));
} else {
for (name, enabled, alive) in &status {
let (symbol, color) = if *alive {
("", Color::Green)
} else if *enabled {
("", Color::Red)
} else {
("", Color::DarkGray)
};
let state = if *alive {
"running"
} else if *enabled {
"stopped"
} else {
"disabled"
};
lines.push(Line::from(vec![
Span::raw(" "),
Span::styled(symbol, Style::default().fg(color)),
Span::raw(format!(" {:<20} {}", name, state)),
]));
}
}
let block = Block::default()