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(runtime): move embedder config accessors into a submodule
Steven Enamakel7e8323ddae43
diff --git a/crates/openhuman-core/src/core/runtime/context.rs b/crates/openhuman-core/src/core/runtime/context.rsindex fff565f516..793540a129 100644--- a/crates/openhuman-core/src/core/runtime/context.rs+++ b/crates/openhuman-core/src/core/runtime/context.rs@@ -506,33 +506,6 @@ impl CoreContext {self.embedder_config.as_ref()}- /// The embedder-supplied config for the current dispatch, if there is one.- ///- /// The read path for `config::ops::load_config_with_timeout`.- pub fn current_embedder_config() -> Option<crate::config::Config> {- Self::current().and_then(|ctx| ctx.latest_embedder_config())- }-- pub(crate) fn latest_embedder_config(&self) -> Option<crate::config::Config> {- let snapshot = self.latest_embedder_config.as_ref()?;- let mut config = snapshot.lock().ok()?.clone();- config.context_snapshot = Some(Arc::downgrade(snapshot));- Some(config)- }-- /// Read the embedder-supplied config for the current dispatch without- /// cloning it. Prefer this over [`Self::current_embedder_config`] when only- /// a field or a predicate is needed: a `Config` clone is a large copy.- pub fn with_current_embedder_config<R>(- f: impl FnOnce(&crate::config::Config) -> R,- ) -> Option<R> {- Self::current().and_then(|ctx| {- let snapshot = ctx.latest_embedder_config.as_ref()?;- let config = snapshot.lock().ok()?;- Some(f(&config))- })- }-/// Rebind the process default context to the current active user's/// workspace. Desktop login, logout, and pending-session revalidation can/// switch the active workspace after boot without rebuilding the core.@@ -751,6 +724,9 @@ mod agent_parts;mod overlay;pub use overlay::ContextOverlay;+#[path = "context_config.rs"]+mod config_access;+#[cfg(test)]#[path = "context_test_support.rs"]mod test_support;diff --git a/crates/openhuman-core/src/core/runtime/context_config.rs b/crates/openhuman-core/src/core/runtime/context_config.rsnew file mode 100644index 0000000000..a88fbe8d28--- /dev/null+++ b/crates/openhuman-core/src/core/runtime/context_config.rs@@ -0,0 +1,32 @@+use std::sync::Arc;++use super::CoreContext;++impl CoreContext {+ /// The embedder-supplied config for the current dispatch, if there is one.+ ///+ /// The read path for `config::ops::load_config_with_timeout`.+ pub fn current_embedder_config() -> Option<crate::config::Config> {+ Self::current().and_then(|ctx| ctx.latest_embedder_config())+ }++ pub(crate) fn latest_embedder_config(&self) -> Option<crate::config::Config> {+ let snapshot = self.latest_embedder_config.as_ref()?;+ let mut config = snapshot.lock().ok()?.clone();+ config.context_snapshot = Some(Arc::downgrade(snapshot));+ Some(config)+ }++ /// Read the embedder-supplied config for the current dispatch without+ /// cloning it. Prefer this over [`Self::current_embedder_config`] when only+ /// a field or a predicate is needed: a `Config` clone is a large copy.+ pub fn with_current_embedder_config<R>(+ f: impl FnOnce(&crate::config::Config) -> R,+ ) -> Option<R> {+ Self::current().and_then(|ctx| {+ let snapshot = ctx.latest_embedder_config.as_ref()?;+ let config = snapshot.lock().ok()?;+ Some(f(&config))+ })+ }+}