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
chore(search): remove unused proxy module
Steven Enamakel50597ddd3c53
diff --git a/crates/openhuman-core/src/modules/ops.rs b/crates/openhuman-core/src/modules/ops.rsindex 17900fd544..87462e325f 100644--- a/crates/openhuman-core/src/modules/ops.rs+++ b/crates/openhuman-core/src/modules/ops.rs@@ -429,8 +429,7 @@ pub(super) fn load_local(/// for embedding and chat compute; the other modules need no host config.fn module_config(config: &Config, id: &str) -> serde_json::Value {if id == super::search::MODULE_ID {- return serde_json::to_value(super::search::module_config(config))- .expect("TinySearch config serializes");+ return super::search::load_configuration(config);}if id == super::desktop::MODULE_ID {return super::desktop::module_config(config);diff --git a/crates/openhuman-core/src/modules/search/mod.rs b/crates/openhuman-core/src/modules/search/mod.rsindex 3b0416ac99..e3b1213f69 100644--- a/crates/openhuman-core/src/modules/search/mod.rs+++ b/crates/openhuman-core/src/modules/search/mod.rs@@ -20,6 +20,16 @@ mod proxy;pub use proxy::{execute_tool, list_tools, refresh_loaded};+/// [`module_config`] as the JSON the module is loaded with, recorded as the+/// configuration the module holds so the first call knows whether to+/// reconfigure it.+pub(crate) fn load_configuration(config: &Config) -> serde_json::Value {+ let configuration =+ serde_json::to_value(module_config(config)).expect("TinySearch config serializes");+ proxy::record_load_configuration(&configuration);+ configuration+}+pub const MODULE_ID: &str = "tinysearch";/// Private direct-route settings for one provider: key, base URL, limits.diff --git a/crates/openhuman-core/src/modules/search/proxy.rs b/crates/openhuman-core/src/modules/search/proxy.rsindex 2256714e1b..5e87b1d0af 100644--- a/crates/openhuman-core/src/modules/search/proxy.rs+++ b/crates/openhuman-core/src/modules/search/proxy.rs@@ -44,9 +44,31 @@ pub(super) fn execute_tool_timeout_for(tool_budget_secs: u64) -> std::time::Dura)}-fn last_config() -> &'static tokio::sync::Mutex<Option<u64>> {- static LAST: OnceLock<tokio::sync::Mutex<Option<u64>>> = OnceLock::new();- LAST.get_or_init(|| tokio::sync::Mutex::new(None))+/// Fingerprint of the configuration the loaded module holds: recorded when+/// this host builds its load-time configuration and after every+/// reinitialization. `None` when unknown — the module was admitted from the+/// module search path with no host configuration, or a reinitialization+/// failed partway — so the next call reconfigures it.+fn held() -> &'static std::sync::Mutex<Option<u64>> {+ static HELD: OnceLock<std::sync::Mutex<Option<u64>>> = OnceLock::new();+ HELD.get_or_init(|| std::sync::Mutex::new(None))+}++fn set_held(value: Option<u64>) {+ *held()+ .lock()+ .unwrap_or_else(std::sync::PoisonError::into_inner) = value;+}++fn held_fingerprint() -> Option<u64> {+ *held()+ .lock()+ .unwrap_or_else(std::sync::PoisonError::into_inner)+}++/// Record `configuration` as what the module is about to be loaded with.+pub(super) fn record_load_configuration(configuration: &serde_json::Value) {+ set_held(Some(fingerprint(configuration)));}fn fingerprint(value: &serde_json::Value) -> u64 {@@ -55,6 +77,11 @@ fn fingerprint(value: &serde_json::Value) -> u64 {hasher.finish()}+/// The module proxy, with the module reconfigured to `config` first when it+/// holds anything else. Callers hold the module call lock+/// ([`with_module_lock`]) through the bus call that follows, so a call never+/// runs under another caller's configuration — two agents with different+/// pinned keys take turns, each reconfiguring the module for its own call.async fn proxy(config: &Config) -> Result<tinybus::Proxy, String> {crate::modules::ops::ensure_loaded_within(config,@@ -69,25 +96,15 @@ async fn proxy(config: &Config) -> Result<tinybus::Proxy, String> {let configuration =serde_json::to_value(module_config(config)).map_err(|error| error.to_string())?;let current = fingerprint(&configuration);- // Caller holds the module call lock through the subsequent bus call.- let mut previous = last_config().lock().await;- match *previous {- // The first call after a lazy load: `ensure_loaded_within` initialized- // the module with `module_config(config)` for this same config, so it- // already holds this configuration. Reinitializing now would race the- // module's own initialization.- None => {- tracing::debug!(- "[modules][search] first call; module holds the load-time configuration"- );- }- Some(last) if last == current => {}- Some(_) => {- tracing::debug!("[modules][search] configuration changed; reinitializing module");- reinitialize(runtime, configuration).await?;- }+ if held_fingerprint() != Some(current) {+ tracing::debug!(+ host_pinned = config.search.is_host_pinned(),+ "[modules][search] module holds another configuration; reinitializing"+ );+ set_held(None);+ reinitialize(runtime, configuration).await?;+ set_held(Some(current));}- *previous = Some(current);runtime.proxy(names::INTERFACE, names::OBJECT_PATH).map_err(|error| format!("search module proxy unavailable: {error}"))@@ -139,7 +156,18 @@ whereresult}+/// The config a search call runs under.+///+/// A config carrying host-pinned search credentials+/// ([`crate::config::SearchConfig::pin_host_credential`]) is authoritative:+/// it is one agent's in-memory config, its keys exist nowhere else, and a+/// reload of the shared `config_path` would drop them. Any other config is+/// reloaded so a settings or login change is honoured on the next call.async fn current_config(config: &Config) -> Result<Config, String> {+ if config.search.is_host_pinned() {+ tracing::debug!("[modules][search] host-pinned search credentials; using the agent's config");+ return Ok(config.clone());+ }crate::config::ops::reload_config_from_paths(&config.config_path, &config.workspace_dir).await}