Skip to content

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

feat(tools): place host tool sources at catalogue anchors

Steven Enamakel08219375aac6
diff --git a/crates/openhuman-core/src/tools/ops.rs b/crates/openhuman-core/src/tools/ops.rs
index a0145a2f11..8e3ef39f2d 100644
--- a/crates/openhuman-core/src/tools/ops.rs
+++ b/crates/openhuman-core/src/tools/ops.rs
@@ -400,6 +400,27 @@ pub fn all_tools_with_runtime(
tools.extend(crate::search::build_search_tools(root_config));
+ // What every registered tool source can see (`tools::sources`).
+ let source_ctx = crate::tools::sources::ToolSourceCtx {
+ config: &config,
+ root_config,
+ security,
+ runtime: &runtime,
+ audit: &audit,
+ browser_config,
+ http_config,
+ action_dir,
+ agents,
+ approval_workspace_root,
+ };
+
+ // Sources placed after the search tools (a host's media and file-storage
+ // tools), where the catalogue has always listed them.
+ tools.extend(crate::tools::sources::build_registered_tool_sources(
+ &source_ctx,
+ Some(crate::tools::sources::ANCHOR_AFTER_SEARCH),
+ ));
+
// Media generation roots. The `media_generate_*` tools themselves come from
// a host's registered tool source (the core ships no media generators);
// this records the files roots their reference policy reads. Gated by the
@@ -467,6 +488,13 @@ pub fn all_tools_with_runtime(
)));
}
+ // Sources placed after the delegation tool (a host's place and market-data
+ // tools), ahead of the Composio tools.
+ tools.extend(crate::tools::sources::build_registered_tool_sources(
+ &source_ctx,
+ Some(crate::tools::sources::ANCHOR_AFTER_DELEGATE),
+ ));
+
let composio_tools = crate::integrations::composio::all_composio_agent_tools(root_config);
if composio_tools.is_empty() {
tracing::debug!("[integrations] composio unavailable — skipping");
diff --git a/crates/openhuman-embed/src/host_internals.rs b/crates/openhuman-embed/src/host_internals.rs
index 2f8551de1a..4198bcea53 100644
--- a/crates/openhuman-embed/src/host_internals.rs
+++ b/crates/openhuman-embed/src/host_internals.rs
@@ -291,8 +291,9 @@ pub mod util {
/// Tool sources: tools an outside crate appends to the agent catalogue.
pub mod tool_sources {
pub use openhuman_core::tools::sources::{
- register_tool_source, register_tool_source_in, unregister_tool_source, ToolSourceCtx,
- ToolSourceFactory,
+ register_tool_source, register_tool_source_at, register_tool_source_in,
+ unregister_tool_source, ToolSourceCtx, ToolSourceFactory, ToolSourcePlacement,
+ ANCHOR_AFTER_DELEGATE, ANCHOR_AFTER_SEARCH,
};
}
diff --git a/crates/openhuman-tinyhumans/src/integrations/media/mod.rs b/crates/openhuman-tinyhumans/src/integrations/media/mod.rs
index d106228301..c13237fddd 100644
--- a/crates/openhuman-tinyhumans/src/integrations/media/mod.rs
+++ b/crates/openhuman-tinyhumans/src/integrations/media/mod.rs
@@ -13,7 +13,9 @@ pub mod provider;
use std::sync::Arc;
use openhuman_embed::__host::media::generation::media_tools_for_config;
-use openhuman_embed::__host::tool_sources::register_tool_source;
+use openhuman_embed::__host::tool_sources::{
+ register_tool_source_at, ToolSourcePlacement, ANCHOR_AFTER_SEARCH,
+};
pub use provider::{managed_generators, OPENROUTER_PROXY_PATH};
@@ -22,7 +24,10 @@ pub const TOOL_SOURCE_ID: &str = "tinyhumans-media";
/// Registers the media tool source with the core. Idempotent.
pub(crate) fn register() {
- register_tool_source(TOOL_SOURCE_ID, |ctx| {
+ register_tool_source_at(
+ TOOL_SOURCE_ID,
+ ToolSourcePlacement::After(ANCHOR_AFTER_SEARCH),
+ |ctx| {
let Some(generators) = managed_generators(ctx.root_config) else {
log::debug!("[tinyhumans] media: no managed generators; media tools skipped");
return Vec::new();
diff --git a/crates/openhuman-tinyhumans/src/integrations/mod.rs b/crates/openhuman-tinyhumans/src/integrations/mod.rs
index caee3d24c3..bd035b837b 100644
--- a/crates/openhuman-tinyhumans/src/integrations/mod.rs
+++ b/crates/openhuman-tinyhumans/src/integrations/mod.rs
@@ -26,25 +26,32 @@ pub use types::{
BackendResponse, IntegrationPricing, IntegrationPricingEntry, PricingIntegrations,
};
-use openhuman_embed::__host::tool_sources::register_tool_source;
+use openhuman_embed::__host::tool_sources::{
+ register_tool_source_at, ToolSourcePlacement, ANCHOR_AFTER_DELEGATE, ANCHOR_AFTER_SEARCH,
+};
use crate::install::InstallOptions;
/// Registers this area's hooks with the core. Idempotent.
///
/// The tool sources register in the order the core used to build them inline
-/// (media, file storage, then the Google Places / stock tools), but they now
-/// follow every built-in tool in the catalogue instead of sitting between the
-/// search and hosting tools.
+/// (media, file storage, then the Google Places / stock tools) and at the
+/// anchors it built them at: media and file storage right after the search
+/// tools, the Google Places / stock tools right after the delegation tool, so
+/// the catalogue order (a prompt-cache layout input) is unchanged.
pub(crate) fn register(_options: &InstallOptions) {
#[cfg(feature = "media")]
media::register();
- register_tool_source(FILE_STORAGE_SOURCE_ID, |ctx| {
- file_storage::build_file_storage_tools(ctx.root_config, ctx.action_dir)
- });
- register_tool_source(INTEGRATION_TOOLS_SOURCE_ID, |ctx| {
- tools::build_integration_tools(ctx.root_config)
- });
+ register_tool_source_at(
+ FILE_STORAGE_SOURCE_ID,
+ ToolSourcePlacement::After(ANCHOR_AFTER_SEARCH),
+ |ctx| file_storage::build_file_storage_tools(ctx.root_config, ctx.action_dir),
+ );
+ register_tool_source_at(
+ INTEGRATION_TOOLS_SOURCE_ID,
+ ToolSourcePlacement::After(ANCHOR_AFTER_DELEGATE),
+ |ctx| tools::build_integration_tools(ctx.root_config),
+ );
#[cfg(feature = "web3")]
web3::register();
composio::register();