WIP: Agent/AgentState — 36 errors remaining, all .lock() → .state.lock() or .context.lock()

Bulk replaced Arc<Mutex<Agent>> with Arc<Agent> across all files.
Fixed control.rs, memory.rs tool handlers. Fixed oneshot Backend.
Remaining errors are all agent.lock() → agent.state.lock() or
agent.context.lock() in mind/, user/, and a few in mod.rs.

Co-Authored-By: Proof of Concept <poc@bcachefs.org>
This commit is contained in:
Kent Overstreet 2026-04-08 15:40:36 -04:00
parent e73135a8d0
commit 1d61b091b0
9 changed files with 30 additions and 30 deletions

View file

@ -98,7 +98,7 @@ fn dispatch_command(input: &str) -> Option<SlashCommand> {
/// Switch model — used by both /model command and tool-initiated switches.
pub async fn cmd_switch_model(
agent: &std::sync::Arc<tokio::sync::Mutex<crate::agent::Agent>>,
agent: &std::sync::Arc<crate::agent::Agent>,
name: &str,
) {
let resolved = {
@ -129,7 +129,7 @@ pub async fn cmd_switch_model(
}
}
fn notify_help(agent: &std::sync::Arc<tokio::sync::Mutex<crate::agent::Agent>>) {
fn notify_help(agent: &std::sync::Arc<crate::agent::Agent>) {
if let Ok(mut ag) = agent.try_lock() {
let mut help = String::new();
for cmd in &commands() {
@ -380,14 +380,14 @@ pub(crate) struct InteractScreen {
last_entries: Vec<AstNode>,
pending_display_count: usize,
/// Reference to agent for state sync
agent: std::sync::Arc<tokio::sync::Mutex<crate::agent::Agent>>,
agent: std::sync::Arc<crate::agent::Agent>,
shared_mind: std::sync::Arc<crate::mind::SharedMindState>,
mind_tx: tokio::sync::mpsc::UnboundedSender<crate::mind::MindCommand>,
}
impl InteractScreen {
pub fn new(
agent: std::sync::Arc<tokio::sync::Mutex<crate::agent::Agent>>,
agent: std::sync::Arc<crate::agent::Agent>,
shared_mind: std::sync::Arc<crate::mind::SharedMindState>,
mind_tx: tokio::sync::mpsc::UnboundedSender<crate::mind::MindCommand>,
) -> Self {

View file

@ -10,12 +10,12 @@ use super::widgets::{SectionTree, SectionView, section_to_view, pane_block, rend
use crate::agent::context::{AstNode, NodeBody, Ast};
pub(crate) struct ConsciousScreen {
agent: std::sync::Arc<tokio::sync::Mutex<crate::agent::Agent>>,
agent: std::sync::Arc<crate::agent::Agent>,
tree: SectionTree,
}
impl ConsciousScreen {
pub fn new(agent: std::sync::Arc<tokio::sync::Mutex<crate::agent::Agent>>) -> Self {
pub fn new(agent: std::sync::Arc<crate::agent::Agent>) -> Self {
Self { agent, tree: SectionTree::new() }
}