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
feat(modules): load search-path modules with host config
Steven Enamakel15d946510604
diff --git a/crates/openhuman-core/src/modules/boot.rs b/crates/openhuman-core/src/modules/boot.rsindex 248d693b8c..45b8ee7238 100644--- a/crates/openhuman-core/src/modules/boot.rs+++ b/crates/openhuman-core/src/modules/boot.rs@@ -40,9 +40,11 @@ pub async fn load_declared_modules(config: &Config) {// Search paths first: an artifact an operator has placed deliberately should// win over a download, and `ensure_loaded` below then finds it already// serving rather than fetching a second copy.- for outcome in- super::search_path::load_enabled(runtime.host(), &ops::disabled_lib_stems(config))- {+ for outcome in super::search_path::load_enabled(+ runtime.host(),+ &ops::disabled_lib_stems(config),+ |id| ops::module_config(config, id),+ ) {match outcome {Ok(info) => log::info!("[modules] loaded '{}' {} from the module search path",diff --git a/crates/openhuman-core/src/modules/ops.rs b/crates/openhuman-core/src/modules/ops.rsindex fc4fba23cd..581e6c2193 100644--- a/crates/openhuman-core/src/modules/ops.rs+++ b/crates/openhuman-core/src/modules/ops.rs@@ -146,6 +146,8 @@ pub fn resolver(config: &Config) -> Resolver {}let gate_config = Arc::clone(&shared);let module_config_source = Arc::clone(&shared);+ let mut search_skip = disabled_lib_stems(config);+ search_skip.extend(super::search_path::configured_module_lib_stems());Resolver::new(ResolverInputs {enabled: config.modules.enabled,install_dir: install_dir(config),@@ -153,7 +155,7 @@ pub fn resolver(config: &Config) -> Resolver {bundled_dir: bundled_releases_dir(),sources,linked: linked_factories,- search_skip: disabled_lib_stems(config),+ search_skip,gate: Some(Arc::new(move |id| disabled_component(&gate_config, id))),on_resolved: Some(Arc::new(on_resolved)),records: registry::release_records(),@@ -300,7 +302,7 @@ pub fn state_of(id: &str) -> ModuleState {/// Credentials are intentionally absent. TinyMemory calls back into the host/// for embedding and chat compute, and TinyMCP receives the shared host/// storage service name; the other modules need no host config.-fn module_config(config: &Config, id: &str) -> serde_json::Value {+pub(super) fn module_config(config: &Config, id: &str) -> serde_json::Value {if id == "tinymcp" {return serde_json::json!({"storage_callback": tinystoragedrivers_bus::STORAGE_INTERFACE,diff --git a/crates/openhuman-core/src/modules/search_path.rs b/crates/openhuman-core/src/modules/search_path.rsindex 8544d85b0b..5ed198c5d8 100644--- a/crates/openhuman-core/src/modules/search_path.rs+++ b/crates/openhuman-core/src/modules/search_path.rs@@ -9,6 +9,26 @@ use std::path::Path;use tinybus::module::{ModuleHost, ModuleInfo};+/// Modules that need host-supplied configuration cannot be admitted by+/// TinyBus's generic search-path loader, which initializes them with `{}`.+/// Leave those artifacts for the configured load below.+pub fn configured_module_lib_stems() -> Vec<String> {+ let Some(record) = super::registry::find("tinymcp") else {+ return Vec::new();+ };+ let stem = record.source.lib_name.to_string();+ [format!("lib{stem}"), stem]+}++fn module_id_for_artifact(path: &Path) -> Option<&'static str> {+ let stem = path.file_stem()?.to_str()?;+ let stem = stem.strip_prefix("lib").unwrap_or(stem);+ let stem = stem.strip_suffix("_module").unwrap_or(stem);+ super::registry::ALL.iter().find_map(|record| {+ (record.id == stem || record.source.lib_name.as_str() == stem).then_some(record.id)+ })+}+/// Whether `path` is a library file whose stem is in `skip`.fn is_skipped(path: &Path, skip: &[String]) -> bool {path.file_stem()@@ -21,7 +41,17 @@ fn is_skipped(path: &Path, skip: &[String]) -> bool {/// A directory with nothing to skip goes through `load_dir` unchanged, which/// keeps tinybus's dependency ordering. Only a directory holding a skipped/// artifact is loaded file by file.-pub fn load_enabled(host: &ModuleHost, skip: &[String]) -> Vec<Result<ModuleInfo, tinybus::Error>> {+pub fn load_enabled(+ host: &ModuleHost,+ skip: &[String],+ module_config: impl Fn(&str) -> serde_json::Value,+) -> Vec<Result<ModuleInfo, tinybus::Error>> {+ let disabled = skip.to_vec();+ let configured = configured_module_lib_stems();+ let mut skip = disabled.clone();+ skip.extend(configured.iter().cloned());+ skip.sort();+ skip.dedup();if skip.is_empty() {return host.load_search_paths();}@@ -44,10 +74,18 @@ pub fn load_enabled(host: &ModuleHost, skip: &[String]) -> Vec<Result<ModuleInfocontinue;}for file in files {- if is_skipped(&file, skip) {+ if is_skipped(&file, &disabled) {log::debug!("[modules] search-path artifact skipped: component disabled");continue;}+ if is_skipped(&file, &configured) {+ if let Some(id) = module_id_for_artifact(&file) {+ outcomes.push(host.load_file_with_config(&file, module_config(id)));+ continue;+ }+ log::debug!("[modules] configured module artifact has no registry entry");+ continue;+ }if file.extension().is_some_and(|e| matches!(e.to_str(), Some("so" | "dylib" | "dll")))