The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
refactor(agent): keep plan-mode handles in the agent context's slot (#7032)
oxoxDevdeefaeaf8c9b
diff --git a/crates/openhuman-core/src/agent/tinyagents/run_mode.rs b/crates/openhuman-core/src/agent/tinyagents/run_mode.rsindex a8e3438fa0..bb11a50a40 100644--- a/crates/openhuman-core/src/agent/tinyagents/run_mode.rs+++ b/crates/openhuman-core/src/agent/tinyagents/run_mode.rs@@ -16,7 +16,7 @@//! for the thread.use std::collections::HashMap;-use std::sync::OnceLock;+use std::sync::Arc;use parking_lot::Mutex;use tinyagents_harness::middleware::{RunMode, RunModeHandle};@@ -24,9 +24,10 @@ use tinyagents_harness::middleware::{RunMode, RunModeHandle};use crate::core::bus::BUS;use crate::core::events::DomainEvent;-fn registry() -> &'static Mutex<HashMap<String, RunModeHandle>> {- static REGISTRY: OnceLock<Mutex<HashMap<String, RunModeHandle>>> = OnceLock::new();- REGISTRY.get_or_init(|| Mutex::new(HashMap::new()))+type RunModeRegistry = Mutex<HashMap<String, RunModeHandle>>;++fn registry() -> Arc<RunModeRegistry> {+ crate::core::runtime::current_slot::<RunModeRegistry>()}/// Returns the [`RunModeHandle`] for `thread_id`, creating one (starting in@@ -34,7 +35,8 @@ fn registry() -> &'static Mutex<HashMap<String, RunModeHandle>> {/// the same underlying atomic, so every clone (a live turn's middleware, this/// registry's own copy, a later RPC call) observes the same live value.pub fn handle_for_thread(thread_id: &str) -> RunModeHandle {- let mut map = registry().lock();+ let registry = registry();+ let mut map = registry.lock();map.entry(thread_id.to_string()).or_insert_with(|| RunModeHandle::new(RunMode::Build)).clone()