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(hooks): add public reload function that re-resolves the home directory
Steven Enamakel4248b3f6f7b2
diff --git a/crates/openhuman-core/src/hooks/host.rs b/crates/openhuman-core/src/hooks/host.rsindex a88ff35429..8aad17f48f 100644--- a/crates/openhuman-core/src/hooks/host.rs+++ b/crates/openhuman-core/src/hooks/host.rs@@ -9,7 +9,9 @@use std::sync::{Arc, LazyLock};use async_trait::async_trait;-use tinyagents_runtime::command_hooks::{HookEngine, HookEnvironment, PromptEvaluator};+use tinyagents_runtime::command_hooks::{+ config, HookConfig, HookEngine, HookEnvironment, PromptEvaluator,+};/// Product name handed to the engine: `ProgramData\OpenHuman`,/// `/Library/Application Support/OpenHuman`, `/etc/openhuman`, `.openhuman`,@@ -37,3 +39,31 @@ static ENGINE: LazyLock<HookEngine> = LazyLock::new(|| HookEngine::new(environmepub fn engine() -> &'static HookEngine {&ENGINE}++/// Re-read every `hooks.json` layer and install the result.+///+/// The engine's own [`HookEngine::reload`] reuses the environment it was built+/// with, which froze the home directory at first use. Discovery resolves the+/// user layer against the home directory **now**, as it did before the engine+/// moved upstream, so a reload after `HOME` changes reads the right file.+pub async fn reload(+ project_dir: Option<std::path::PathBuf>,+ workspace_dir: Option<std::path::PathBuf>,+) -> Arc<HookConfig> {+ let current = environment();+ let loaded = tokio::task::spawn_blocking(move || {+ config::load(¤t, project_dir.as_deref(), workspace_dir.as_deref())+ })+ .await+ .unwrap_or_default();+ for warning in &loaded.warnings {+ log::warn!("[hooks] {warning}");+ }+ log::info!(+ "[hooks] active configuration: {} hook(s) across {} file(s)",+ loaded.len(),+ loaded.sources.len()+ );+ ENGINE.install(loaded).await;+ ENGINE.snapshot().await+}diff --git a/crates/openhuman-core/src/hooks/ops.rs b/crates/openhuman-core/src/hooks/ops.rsindex 4accf59872..9e2c06c940 100644--- a/crates/openhuman-core/src/hooks/ops.rs+++ b/crates/openhuman-core/src/hooks/ops.rs@@ -42,12 +42,11 @@ pub async fn init(config: &crate::config::schema::Config) {super::host::engine().set_default_timeout(Duration::from_secs(settings.default_timeout_secs)).await;- let loaded = super::host::engine()- .reload(- Some(config.action_dir.clone()),- Some(config.workspace_dir.clone()),- )- .await;+ let loaded = super::host::reload(+ Some(config.action_dir.clone()),+ Some(config.workspace_dir.clone()),+ )+ .await;if loaded.is_empty() {// Nothing configured: keep the bridge out of the harness entirely so an// unconfigured host pays not even a task-local lookup per tool call.