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

@ -14,7 +14,7 @@ pub(super) fn tools() -> [super::Tool; 3] {
.ok_or_else(|| anyhow::anyhow!("'model' parameter is required"))?;
if model.is_empty() { anyhow::bail!("'model' parameter cannot be empty"); }
if let Some(agent) = agent {
let mut a = agent.lock().await;
let mut a = agent.state.lock().await;
a.pending_model_switch = Some(model.to_string());
}
Ok(format!("Switching to model '{}' after this turn.", model))
@ -24,7 +24,7 @@ pub(super) fn tools() -> [super::Tool; 3] {
parameters_json: r#"{"type":"object","properties":{}}"#,
handler: |agent, _v| Box::pin(async move {
if let Some(agent) = agent {
let mut a = agent.lock().await;
let mut a = agent.state.lock().await;
a.pending_yield = true;
a.pending_dmn_pause = true;
}
@ -36,7 +36,7 @@ pub(super) fn tools() -> [super::Tool; 3] {
handler: |agent, v| Box::pin(async move {
let msg = v.get("message").and_then(|v| v.as_str()).unwrap_or("Waiting for input.");
if let Some(agent) = agent {
let mut a = agent.lock().await;
let mut a = agent.state.lock().await;
a.pending_yield = true;
}
Ok(format!("Yielding. {}", msg))