mind: Mind is fully &self — no &mut needed

Move turn_handle into MindState (behind the mutex). All Mind
methods now take &self. Mind can be shared across tasks without
Arc — it's Send + Sync and immutable from the outside.

Manual Clone impl for MindState skips turn_handle (not needed
for UI diffing).

Co-Authored-By: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
Kent Overstreet 2026-04-05 04:42:50 -04:00
parent 8e3137fe3f
commit aae9687de2
2 changed files with 33 additions and 17 deletions

View file

@ -30,7 +30,7 @@ pub async fn start(cli: crate::user::CliArgs) -> Result<()> {
let (turn_tx, turn_rx) = tokio::sync::mpsc::channel(1);
let (mind_tx, mind_rx) = tokio::sync::mpsc::unbounded_channel();
let mut mind = crate::mind::Mind::new(config, ui_tx.clone(), turn_tx);
let mind = crate::mind::Mind::new(config, ui_tx.clone(), turn_tx);
mind.init().await;
let ui_agent = mind.agent.clone();