mind: move all slash commands to event_loop dispatch

All slash command routing now lives in user/event_loop.rs. Mind
receives typed messages (NewSession, Score, DmnSleep, etc.) and
handles them as named methods. No more handle_command() dispatch
table or Command enum.

Commands that only need Agent state (/model, /retry) run directly
in the UI task. Commands that need Mind state (/new, /score, /dmn,
/sleep, /wake, /pause) send a MindMessage.

Mind is now purely: turn lifecycle, DMN state machine, and the
named handlers for each message type.

Co-Authored-By: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
Kent Overstreet 2026-04-05 02:40:45 -04:00
parent b05c956ab8
commit 64add58caa
2 changed files with 98 additions and 108 deletions

View file

@ -21,6 +21,12 @@ use crate::user::ui_channel::{self, UiMessage};
pub enum MindMessage {
UserInput(String),
Hotkey(HotkeyAction),
DmnSleep,
DmnWake,
DmnPause,
DmnQuery,
NewSession,
Score,
}
fn send_help(ui_tx: &ui_channel::UiSender) {
@ -232,6 +238,12 @@ pub async fn run(
let _ = ui_tx.send(UiMessage::Info("(busy)".into()));
}
}
"/new" | "/clear" => { let _ = mind_tx.send(MindMessage::NewSession); }
"/dmn" => { let _ = mind_tx.send(MindMessage::DmnQuery); }
"/sleep" => { let _ = mind_tx.send(MindMessage::DmnSleep); }
"/wake" => { let _ = mind_tx.send(MindMessage::DmnWake); }
"/pause" => { let _ = mind_tx.send(MindMessage::DmnPause); }
"/score" => { let _ = mind_tx.send(MindMessage::Score); }
"/retry" => {
let agent = agent.clone();
let ui_tx = ui_tx.clone();