Clean up mind loop: fix double locks, async agent triggers, input peek

- push_node: notify before dropping state lock instead of relocking
- Mind::run: single lock for timeout + turn_active + has_input;
  single lock for turn_handle + complete_turn
- Agent triggers (subconscious/unconscious) spawned as async tasks
  so they don't block the select loop
- has_pending_input() peek for DMN sleep guard — don't sleep when
  there's user input waiting
- unconscious: merge collect_results into trigger, single store load

Co-Authored-By: Proof of Concept <poc@bcachefs.org>
This commit is contained in:
ProofOfConcept 2026-04-09 00:21:46 -04:00
parent 0314619579
commit d82a2ae90d
3 changed files with 49 additions and 52 deletions

View file

@ -275,9 +275,9 @@ impl Agent {
eprintln!("warning: failed to log entry: {:#}", e);
}
}
st.changed.notify_one();
drop(st);
self.context.lock().await.push(Section::Conversation, node);
self.state.lock().await.changed.notify_one();
}
/// Run the agent turn loop: assemble prompt, stream response,