mind: zero UI dependencies — init() + run() split
Mind::init() restores conversation from log and starts scoring. No UiMessages sent. The UI event loop reads Mind's state after init and displays startup info (model, restored conversation) by reading the agent directly. mind/mod.rs has zero UiMessage imports or sends. Complete separation between cognitive state machine and user interface. Co-Authored-By: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
parent
3ee1aa69b0
commit
9d597b5eff
2 changed files with 25 additions and 40 deletions
|
|
@ -181,7 +181,6 @@ pub async fn run(
|
|||
mut app: tui::App,
|
||||
agent: Arc<Mutex<Agent>>,
|
||||
shared_mind: crate::mind::SharedMindState,
|
||||
|
||||
turn_watch: tokio::sync::watch::Receiver<bool>,
|
||||
mind_tx: tokio::sync::mpsc::UnboundedSender<MindCommand>,
|
||||
ui_tx: ui_channel::UiSender,
|
||||
|
|
@ -202,6 +201,18 @@ pub async fn run(
|
|||
|
||||
terminal.hide_cursor()?;
|
||||
|
||||
// Startup info
|
||||
let _ = ui_tx.send(UiMessage::Info("consciousness v0.3 (tui)".into()));
|
||||
{
|
||||
let ag = agent.lock().await;
|
||||
let _ = ui_tx.send(UiMessage::Info(format!(" model: {}", ag.model())));
|
||||
// Replay restored conversation to UI
|
||||
if !ag.entries().is_empty() {
|
||||
ui_channel::replay_session_to_ui(ag.entries(), &ui_tx);
|
||||
let _ = ui_tx.send(UiMessage::Info("--- restored from conversation log ---".into()));
|
||||
}
|
||||
}
|
||||
|
||||
// Initial render
|
||||
app.drain_messages(&mut ui_rx);
|
||||
terminal.draw(|f| app.draw(f))?;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue