Skip to content

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

refactor(tools): extract per-domain tool registration into registered_tools

Steven Enamakel63424feaa755
diff --git a/crates/openhuman-core/src/agent/artifacts/tools.rs b/crates/openhuman-core/src/agent/artifacts/tools.rs
index bbf27725cf..0f7e01b51c 100644
--- a/crates/openhuman-core/src/agent/artifacts/tools.rs
+++ b/crates/openhuman-core/src/agent/artifacts/tools.rs
@@ -196,6 +196,17 @@ impl Tool for ArtifactDeleteTool {
}
}
+/// Build this domain's tools in their persisted catalogue order.
+pub(crate) fn registered_tools(
+ config: std::sync::Arc<crate::config::Config>,
+) -> Vec<Box<dyn tinytools::Tool>> {
+ vec![
+ Box::new(ArtifactListTool::new(config.clone())),
+ Box::new(ArtifactGetTool::new(config.clone())),
+ Box::new(ArtifactDeleteTool::new(config.clone())),
+ ]
+}
+
#[cfg(test)]
#[path = "tools_tests.rs"]
mod tests;
diff --git a/crates/openhuman-core/src/config/tools.rs b/crates/openhuman-core/src/config/tools.rs
index 990a12bf20..c19807bd96 100644
--- a/crates/openhuman-core/src/config/tools.rs
+++ b/crates/openhuman-core/src/config/tools.rs
@@ -164,6 +164,21 @@ read_tool!(
"Return the resolved on-disk data directories and workspace marker."
);
+/// Build this domain's tools in their persisted catalogue order.
+pub(crate) fn registered_tools(
+ config: std::sync::Arc<crate::config::Config>,
+) -> Vec<Box<dyn tinytools::Tool>> {
+ vec![
+ Box::new(ConfigSnapshotTool::new(config.clone())),
+ Box::new(ConfigClientConfigTool),
+ Box::new(ConfigAutonomyTool),
+ Box::new(ConfigSearchTool),
+ Box::new(ConfigRuntimeFlagsTool),
+ Box::new(ConfigResolveApiUrlTool),
+ Box::new(ConfigDataPathsTool),
+ ]
+}
+
#[cfg(test)]
#[path = "tools_tests.rs"]
mod tests;
diff --git a/crates/openhuman-core/src/config/workspace/tools.rs b/crates/openhuman-core/src/config/workspace/tools.rs
index 91e6d2ce79..8cb79430c6 100644
--- a/crates/openhuman-core/src/config/workspace/tools.rs
+++ b/crates/openhuman-core/src/config/workspace/tools.rs
@@ -177,6 +177,18 @@ impl Tool for WorkspaceInitTool {
}
}
+/// Build this domain's tools in their persisted catalogue order.
+pub(crate) fn registered_tools(
+ config: std::sync::Arc<crate::config::Config>,
+) -> Vec<Box<dyn tinytools::Tool>> {
+ vec![
+ Box::new(WorkspaceReadPersonaTool::new(config.clone())),
+ Box::new(WorkspaceUpdatePersonaTool::new(config.clone())),
+ Box::new(WorkspaceResetPersonaTool::new(config.clone())),
+ Box::new(WorkspaceInitTool),
+ ]
+}
+
#[cfg(test)]
#[path = "tools_tests.rs"]
mod tests;
diff --git a/crates/openhuman-core/src/desktop/dashboard/tools.rs b/crates/openhuman-core/src/desktop/dashboard/tools.rs
index 5921366b8c..a9ece234ca 100644
--- a/crates/openhuman-core/src/desktop/dashboard/tools.rs
+++ b/crates/openhuman-core/src/desktop/dashboard/tools.rs
@@ -53,6 +53,13 @@ impl Tool for DashboardModelHealthTool {
}
}
+/// Build this domain's tools in their persisted catalogue order.
+pub(crate) fn registered_tools(
+ config: std::sync::Arc<crate::config::Config>,
+) -> Vec<Box<dyn tinytools::Tool>> {
+ vec![Box::new(DashboardModelHealthTool::new(config.clone()))]
+}
+
#[cfg(test)]
#[path = "tools_tests.rs"]
mod tests;
diff --git a/crates/openhuman-core/src/integrations/task_sources/tools.rs b/crates/openhuman-core/src/integrations/task_sources/tools.rs
index 36b8ea4805..3379097a80 100644
--- a/crates/openhuman-core/src/integrations/task_sources/tools.rs
+++ b/crates/openhuman-core/src/integrations/task_sources/tools.rs
@@ -501,6 +501,23 @@ impl Tool for TaskSourceRemoveTool {
}
}
+/// Build this domain's tools in their persisted catalogue order.
+pub(crate) fn registered_tools(
+ config: std::sync::Arc<crate::config::Config>,
+) -> Vec<Box<dyn tinytools::Tool>> {
+ vec![
+ Box::new(TaskSourceListTool::new(config.clone())),
+ Box::new(TaskSourceGetTool::new(config.clone())),
+ Box::new(TaskSourceFetchTool::new(config.clone())),
+ Box::new(TaskSourceListTasksTool::new(config.clone())),
+ Box::new(TaskSourcePreviewFilterTool::new(config.clone())),
+ Box::new(TaskSourceStatusTool::new(config.clone())),
+ Box::new(TaskSourceAddTool::new(config.clone())),
+ Box::new(TaskSourceUpdateTool::new(config.clone())),
+ Box::new(TaskSourceRemoveTool::new(config.clone())),
+ ]
+}
+
#[cfg(test)]
#[path = "tools_tests.rs"]
mod tests;
diff --git a/crates/openhuman-core/src/platform/cost/tools.rs b/crates/openhuman-core/src/platform/cost/tools.rs
index afd1d8e80e..a50bed295a 100644
--- a/crates/openhuman-core/src/platform/cost/tools.rs
+++ b/crates/openhuman-core/src/platform/cost/tools.rs
@@ -150,6 +150,17 @@ impl Tool for CostSummaryTool {
}
}
+/// Build this domain's tools in their persisted catalogue order.
+pub(crate) fn registered_tools(
+ config: std::sync::Arc<crate::config::Config>,
+) -> Vec<Box<dyn tinytools::Tool>> {
+ vec![
+ Box::new(CostDashboardTool::new(config.clone())),
+ Box::new(CostDailyHistoryTool::new(config.clone())),
+ Box::new(CostSummaryTool::new(config.clone())),
+ ]
+}
+
#[cfg(test)]
#[path = "tools_tests.rs"]
mod tests;
diff --git a/crates/openhuman-core/src/platform/doctor/tools.rs b/crates/openhuman-core/src/platform/doctor/tools.rs
index fbc70b3467..b5b43e60d0 100644
--- a/crates/openhuman-core/src/platform/doctor/tools.rs
+++ b/crates/openhuman-core/src/platform/doctor/tools.rs
@@ -113,6 +113,16 @@ impl Tool for DoctorModelsTool {
}
}
+/// Build this domain's tools in their persisted catalogue order.
+pub(crate) fn registered_tools(
+ config: std::sync::Arc<crate::config::Config>,
+) -> Vec<Box<dyn tinytools::Tool>> {
+ vec![
+ Box::new(DoctorHealthTool::new(config.clone())),
+ Box::new(DoctorModelsTool::new(config.clone())),
+ ]
+}
+
#[cfg(test)]
#[path = "tools_tests.rs"]
mod tests;
diff --git a/crates/openhuman-core/src/platform/health/tools.rs b/crates/openhuman-core/src/platform/health/tools.rs
index 241246e257..7ed7d21c6c 100644
--- a/crates/openhuman-core/src/platform/health/tools.rs
+++ b/crates/openhuman-core/src/platform/health/tools.rs
@@ -73,6 +73,11 @@ impl Tool for HealthSystemInfoTool {
}
}
+/// Build this domain's tools in their persisted catalogue order.
+pub(crate) fn registered_tools() -> Vec<Box<dyn tinytools::Tool>> {
+ vec![Box::new(HealthSnapshotTool), Box::new(HealthSystemInfoTool)]
+}
+
#[cfg(test)]
#[path = "tools_tests.rs"]
mod tests;
diff --git a/crates/openhuman-core/src/platform/service/tools.rs b/crates/openhuman-core/src/platform/service/tools.rs
index 691d414a37..9a31c0bab6 100644
--- a/crates/openhuman-core/src/platform/service/tools.rs
+++ b/crates/openhuman-core/src/platform/service/tools.rs
@@ -243,6 +243,23 @@ impl Tool for ServiceShutdownTool {
}
}
+/// Build this domain's tools in their persisted catalogue order.
+pub(crate) fn registered_tools(
+ config: std::sync::Arc<crate::config::Config>,
+) -> Vec<Box<dyn tinytools::Tool>> {
+ vec![
+ Box::new(ServiceStatusTool::new(config.clone())),
+ Box::new(DaemonHostPrefsGetTool::new(config.clone())),
+ Box::new(ServiceStartTool::new(config.clone())),
+ Box::new(ServiceStopTool::new(config.clone())),
+ Box::new(ServiceRestartTool),
+ Box::new(ServiceShutdownTool),
+ Box::new(ServiceInstallTool::new(config.clone())),
+ Box::new(ServiceUninstallTool::new(config.clone())),
+ Box::new(DaemonHostPrefsSetTool::new(config.clone())),
+ ]
+}
+
#[cfg(test)]
#[path = "tools_tests.rs"]
mod tests;
diff --git a/crates/openhuman-core/src/tools/mod.rs b/crates/openhuman-core/src/tools/mod.rs
index 8323186741..a441958aad 100644
--- a/crates/openhuman-core/src/tools/mod.rs
+++ b/crates/openhuman-core/src/tools/mod.rs
@@ -16,14 +16,10 @@ pub(crate) mod user_filter;
#[path = "impl/mod.rs"]
pub(crate) mod implementations;
-pub use crate::agent::artifacts::tools::*;
pub use crate::agent::orchestration::tools::*;
pub use crate::agent::tools::*;
-pub use crate::config::tools::*;
-pub use crate::config::workspace::tools::*;
#[cfg(feature = "modules")]
pub use crate::desktop::control::tools::*;
-pub use crate::desktop::dashboard::tools::*;
#[cfg(feature = "flows")]
pub use crate::flows::builder_tools::*;
#[cfg(feature = "flows")]
@@ -33,15 +29,10 @@ pub use crate::flows::memory_tools::*;
#[cfg(feature = "flows")]
pub use crate::flows::tools::*;
pub use crate::integrations::composio::tools::*;
-pub use crate::integrations::task_sources::tools::*;
pub use crate::integrations::tools::*;
#[cfg(feature = "mcp")]
pub use crate::mcp::registry::tools::*;
pub use crate::memory::tools::{MemoryTool, MEMORY_TOOL_NAME};
-pub use crate::platform::cost::tools::*;
-pub use crate::platform::doctor::tools::*;
-pub use crate::platform::health::tools::*;
-pub use crate::platform::service::tools::*;
#[cfg(feature = "modules")]
pub use crate::search::TinySearchTool;
pub use crate::security::credentials::tools::*;
diff --git a/crates/openhuman-core/src/tools/ops.rs b/crates/openhuman-core/src/tools/ops.rs
index 6be4ed35fd..32a0f03ca5 100644
--- a/crates/openhuman-core/src/tools/ops.rs
+++ b/crates/openhuman-core/src/tools/ops.rs
@@ -386,30 +386,34 @@ pub fn all_tools_with_runtime(
// task_source_add/update/remove) are registered too but ship
// default-OFF via `tools::user_filter` (their toggle IDs default off
// in onboarding). The per-call permission ladder still gates them.
- Box::new(ArtifactListTool::new(config.clone())),
- Box::new(ArtifactGetTool::new(config.clone())),
- Box::new(ArtifactDeleteTool::new(config.clone())),
- Box::new(TaskSourceListTool::new(config.clone())),
- Box::new(TaskSourceGetTool::new(config.clone())),
- Box::new(TaskSourceFetchTool::new(config.clone())),
- Box::new(TaskSourceListTasksTool::new(config.clone())),
- Box::new(TaskSourcePreviewFilterTool::new(config.clone())),
- Box::new(TaskSourceStatusTool::new(config.clone())),
- Box::new(TaskSourceAddTool::new(config.clone())),
- Box::new(TaskSourceUpdateTool::new(config.clone())),
- Box::new(TaskSourceRemoveTool::new(config.clone())),
+ ]);
+ tools.extend(crate::agent::artifacts::tools::registered_tools(
+ config.clone(),
+ ));
+ tools.extend(vec![]);
+ tools.extend(crate::integrations::task_sources::tools::registered_tools(
+ config.clone(),
+ ));
+ tools.extend(vec![
// System & self-management: observability (default-ON) + service
// lifecycle. doctor/health/cost/dashboard/security reads are default-ON.
// service_status / daemon_host_prefs_get default-ON; the lifecycle
// mutators ship default-OFF via `tools::user_filter` (service_lifecycle).
- Box::new(DoctorHealthTool::new(config.clone())),
- Box::new(DoctorModelsTool::new(config.clone())),
- Box::new(HealthSnapshotTool),
- Box::new(HealthSystemInfoTool),
- Box::new(CostDashboardTool::new(config.clone())),
- Box::new(CostDailyHistoryTool::new(config.clone())),
- Box::new(CostSummaryTool::new(config.clone())),
- Box::new(DashboardModelHealthTool::new(config.clone())),
+ ]);
+ tools.extend(crate::platform::doctor::tools::registered_tools(
+ config.clone(),
+ ));
+ tools.extend(vec![]);
+ tools.extend(crate::platform::health::tools::registered_tools());
+ tools.extend(vec![]);
+ tools.extend(crate::platform::cost::tools::registered_tools(
+ config.clone(),
+ ));
+ tools.extend(vec![]);
+ tools.extend(crate::desktop::dashboard::tools::registered_tools(
+ config.clone(),
+ ));
+ tools.extend(vec![
#[cfg(feature = "modules")]
Box::new(DesktopTool::new(config.clone(), DesktopToolKind::Apps)),
#[cfg(feature = "modules")]
@@ -428,25 +432,17 @@ pub fn all_tools_with_runtime(
DesktopToolKind::ContinueGoal,
)),
Box::new(SecurityPolicyInfoTool::new(config.clone())),
- Box::new(ServiceStatusTool::new(config.clone())),
- Box::new(DaemonHostPrefsGetTool::new(config.clone())),
- Box::new(ServiceStartTool::new(config.clone())),
- Box::new(ServiceStopTool::new(config.clone())),
- Box::new(ServiceRestartTool),
- Box::new(ServiceShutdownTool),
- Box::new(ServiceInstallTool::new(config.clone())),
- Box::new(ServiceUninstallTool::new(config.clone())),
- Box::new(DaemonHostPrefsSetTool::new(config.clone())),
+ ]);
+ tools.extend(crate::platform::service::tools::registered_tools(
+ config.clone(),
+ ));
+ tools.extend(vec![
// Config: read-only surface (default-ON). The config_update_* mutators
// are deferred (their apply fns take non-Deserialize patch structs);
// see config/tools.rs.
- Box::new(ConfigSnapshotTool::new(config.clone())),
- Box::new(ConfigClientConfigTool),
- Box::new(ConfigAutonomyTool),
- Box::new(ConfigSearchTool),
- Box::new(ConfigRuntimeFlagsTool),
- Box::new(ConfigResolveApiUrlTool),
- Box::new(ConfigDataPathsTool),
+ ]);
+ tools.extend(crate::config::tools::registered_tools(config.clone()));
+ tools.extend(vec![
// Account & money. The billing / team / referral agent-tool families were
// removed: money movement and team administration are dashboard
// surfaces, not things an agent should reach for mid-turn, and their
@@ -482,11 +478,11 @@ pub fn all_tools_with_runtime(
Box::new(McpRegistryToolCallTool::new(config.clone())),
#[cfg(feature = "mcp")]
Box::new(McpRegistryUninstallTool::new(config.clone())),
- Box::new(WorkspaceReadPersonaTool::new(config.clone())),
- Box::new(WorkspaceUpdatePersonaTool::new(config.clone())),
- Box::new(WorkspaceResetPersonaTool::new(config.clone())),
- Box::new(WorkspaceInitTool),
]);
+ tools.extend(crate::config::workspace::tools::registered_tools(
+ config.clone(),
+ ));
+ tools.extend(vec![]);
// The single `memory` tool (recall | fetch | learn | forget), registered
// only while memory is on: with no usable engine (signed out, no CortexDB