Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

refactor: alias registered tool dispatch selector

Steven Enamakeld900ccd27e3b
diff --git a/crates/openhuman-core/src/agent/tinyagents/tool_registration.rs b/crates/openhuman-core/src/agent/tinyagents/tool_registration.rs
index c1f923ca39..3708bc00e1 100644
--- a/crates/openhuman-core/src/agent/tinyagents/tool_registration.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/tool_registration.rs
@@ -29,6 +29,11 @@ use crate::agent::tinyagents::use_skill_dispatch::UseSkillDispatch;
use crate::agent::tools::{DelegateToolDispatch, TodoToolDispatch};
use crate::core::runtime::CoreContext;
+type RegisteredToolDispatch = Arc<dyn ToolDispatch<(), OpenHumanRunContext>>;
+type ToolDispatchSelectorFn =
+ dyn Fn(&str, Arc<dyn tinytools::Tool>) -> Option<RegisteredToolDispatch> + Send + Sync;
+type ToolDispatchSelector = Arc<ToolDispatchSelectorFn>;
+
/// Typed-dispatch selection shared by the direct per-turn registration below
/// and by [`UseSkillDispatch`], which must resolve the SAME live-parent
/// dispatch for a packed archetype delegation (`create_image`, `do_crypto`,
@@ -137,13 +142,7 @@ pub(crate) fn shared_tool_adapter(
/// (it is the proxy every packed archetype delegation is reached through and
/// must resolve the SAME live parent a natively advertised delegate tool does,
/// regression R3), everything else goes through [`typed_dispatch_for`].
-fn dispatch_selector(
- tool_sets: Vec<SharedToolSet>,
-) -> Arc<
- dyn Fn(&str, Arc<dyn tinytools::Tool>) -> Option<Arc<dyn ToolDispatch<(), OpenHumanRunContext>>>
- + Send
- + Sync,
-> {
+fn dispatch_selector(tool_sets: Vec<SharedToolSet>) -> ToolDispatchSelector {
Arc::new(move |name, adapter| {
if name != USE_SKILL {
return typed_dispatch_for(name, adapter);