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(hooks): share the hook engine behind an Arc
Steven Enamakel390924f3eb37
diff --git a/crates/openhuman-core/src/hooks/host.rs b/crates/openhuman-core/src/hooks/host.rsindex 7a0797d347..b7b2cf594a 100644--- a/crates/openhuman-core/src/hooks/host.rs+++ b/crates/openhuman-core/src/hooks/host.rs@@ -10,9 +10,7 @@ use crate::core::runtime::DispatchCtx;use std::sync::{Arc, LazyLock};use async_trait::async_trait;-use tinyagents_hooks::command::{- config, HookConfig, HookEngine, HookEnvironment, PromptEvaluator,-};+use tinyagents_hooks::command::{HookConfig, HookEngine, HookEnvironment, PromptEvaluator, config};/// Product name handed to the engine: `ProgramData\OpenHuman`,/// `/Library/Application Support/OpenHuman`, `/etc/openhuman`, `.openhuman`,@@ -34,10 +32,11 @@ fn environment() -> HookEnvironment {.with_prompt_evaluator(Arc::new(HostPromptEvaluator))}-static ENGINE: LazyLock<HookEngine> = LazyLock::new(|| HookEngine::new(environment()));+static ENGINE: LazyLock<Arc<HookEngine>> =+ LazyLock::new(|| Arc::new(HookEngine::new(environment())));/// The process-global engine.-pub fn engine() -> &'static HookEngine {+pub fn engine() -> &'static Arc<HookEngine> {&ENGINE}diff --git a/crates/openhuman-core/src/hooks/ops.rs b/crates/openhuman-core/src/hooks/ops.rsindex 8bfad7f36d..81733bf9c4 100644--- a/crates/openhuman-core/src/hooks/ops.rs+++ b/crates/openhuman-core/src/hooks/ops.rs@@ -12,7 +12,7 @@ use std::path::PathBuf;use std::time::Duration;use tinyagents_hooks::command::context::{- build_input, set_host_context, HostContext, TurnIdentity,+ HostContext, TurnIdentity, build_input, set_host_context,};use tinyagents_hooks::command::types::{CompactPayload, HookEvent, HookPayload, PromptPayload, SessionPayload, SubagentPayload,@@ -57,7 +57,7 @@ pub async fn init(ctx: &DispatchCtx, config: &crate::config::schema::Config) {}crate::agent::hooks::replace_embedder_tool_hook("configured_hooks",- Some(std::sync::Arc::new((*super::host::engine()).clone())),+ Some(std::sync::Arc::clone(super::host::engine())),);}diff --git a/crates/openhuman-core/src/profiles/capabilities.rs b/crates/openhuman-core/src/profiles/capabilities.rsindex 5cac4cb0d8..0927c9935e 100644--- a/crates/openhuman-core/src/profiles/capabilities.rs+++ b/crates/openhuman-core/src/profiles/capabilities.rs@@ -270,7 +270,7 @@ impl ToolHook<OpenHumanRunContext> for ProfilePermission {|| !self.capabilities.admits(&dispatch, &context.tool_name){return ToolHookDecision::deny(- "tool is outside the hosted profile capability boundary".into(),+ "tool is outside the hosted profile capability boundary",);}match &self.capabilities.permission {@@ -283,9 +283,7 @@ impl ToolHook<OpenHumanRunContext> for ProfilePermission {let mut rewritten = false;if let Some(canonical) = canonical.filter(|name| *name != context.tool_name) {if !self.capabilities.admits_capability(canonical) {- return ToolHookDecision::deny(- "canonical search capability is denied".into(),- );+ return ToolHookDecision::deny("canonical search capability is denied");}let mut original = context.clone();original.tool_name = canonical.to_owned();