mind: move CycleAutonomy to event_loop, simplify MindCommand

CycleAutonomy just flips DMN state — handled directly in event_loop
by locking shared MindState. MindCommand::Hotkey replaced with
MindCommand::Interrupt — the only command that needs Mind's async
context (abort handles, kill processes).

Remove dmn_interval() wrapper — inline self.dmn.interval().

MindCommand is now: Turn, Compact, Score, Interrupt, NewSession, None.

Co-Authored-By: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
Kent Overstreet 2026-04-05 03:41:47 -04:00
parent 402bae4178
commit 2d6a17e773
2 changed files with 10 additions and 15 deletions

View file

@ -377,8 +377,11 @@ pub async fn run(
match action {
HotkeyAction::CycleReasoning => cmd_cycle_reasoning(&agent, &ui_tx),
HotkeyAction::KillProcess => cmd_kill_processes(&agent, &ui_tx).await,
HotkeyAction::Interrupt => { let _ = mind_tx.send(MindCommand::Hotkey(action)); }
HotkeyAction::CycleAutonomy => { let _ = mind_tx.send(MindCommand::Hotkey(action)); }
HotkeyAction::Interrupt => { let _ = mind_tx.send(MindCommand::Interrupt); }
HotkeyAction::CycleAutonomy => {
let label = shared_mind.lock().unwrap().cycle_autonomy();
let _ = ui_tx.send(UiMessage::Info(format!("DMN → {} (Ctrl+P to cycle)", label)));
}
HotkeyAction::AdjustSampling(param, delta) => cmd_adjust_sampling(&agent, param, delta),
}
}