Skip to content

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

refactor(update): register tools from update domain

Steven Enamakel9d0f7c4ba74b
diff --git a/crates/openhuman-core/src/platform/update/tools.rs b/crates/openhuman-core/src/platform/update/tools.rs
index ac11ab4f4f..1b55e2a1f6 100644
--- a/crates/openhuman-core/src/platform/update/tools.rs
+++ b/crates/openhuman-core/src/platform/update/tools.rs
@@ -223,6 +223,14 @@ impl UpdateApplyTool {
}
}
+/// Build the update domain's tools in their persisted catalogue order.
+pub(crate) fn registered_tools(security: Arc<SecurityPolicy>) -> Vec<Box<dyn Tool>> {
+ vec![
+ Box::new(UpdateCheckTool::new()),
+ Box::new(UpdateApplyTool::new(security)),
+ ]
+}
+
#[cfg(test)]
#[path = "tools_tests.rs"]
mod tests;
diff --git a/crates/openhuman-core/src/platform/update/tools_tests.rs b/crates/openhuman-core/src/platform/update/tools_tests.rs
index 9299d24feb..8e78953428 100644
--- a/crates/openhuman-core/src/platform/update/tools_tests.rs
+++ b/crates/openhuman-core/src/platform/update/tools_tests.rs
@@ -1,6 +1,14 @@
use super::*;
use crate::security::AutonomyLevel;
+#[test]
+fn update_family_registration_preserves_tool_names_and_order() {
+ let tools = registered_tools(std::sync::Arc::new(SecurityPolicy::default()));
+ let names = tools.iter().map(|tool| tool.name()).collect::<Vec<_>>();
+
+ assert_eq!(names, ["update_check", "update_apply"]);
+}
+
#[test]
fn update_check_name_and_permission() {
let tool = UpdateCheckTool::new();
diff --git a/crates/openhuman-core/src/tools/ops.rs b/crates/openhuman-core/src/tools/ops.rs
index fd55f73648..d09a5fc8b1 100644
--- a/crates/openhuman-core/src/tools/ops.rs
+++ b/crates/openhuman-core/src/tools/ops.rs
@@ -3,7 +3,6 @@ use super::implementations::network::{McpListServersTool, McpListToolsTool};
use super::*;
use crate::config::Config;
use crate::modules::tinybox::host_runtime::{NativeRuntime, RuntimeAdapter};
-use crate::platform::update::{UpdateApplyTool, UpdateCheckTool};
use crate::security::{AuditLogger, SecurityPolicy};
use std::sync::Arc;
use tinyagents_harness_tools::{CurrentTimeTool, ResolveTimeTool};
@@ -172,8 +171,11 @@ pub fn all_tools_with_runtime_and_pack_handle(
root_config.clone(),
)),
Box::new(ProxyConfigTool::new(config.clone(), security.clone())),
- Box::new(UpdateCheckTool::new()),
- Box::new(UpdateApplyTool::new(security.clone())),
+ ]);
+ tools.extend(crate::platform::update::tools::registered_tools(
+ security.clone(),
+ ));
+ tools.append(&mut vec![
Box::new(GitOperationsTool::new(
security.clone(),
action_dir.to_path_buf(),