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
chore(update): remove legacy update_apply and update_check tools
Steven Enamakel8b4c61741a6c
diff --git a/crates/openhuman-core/src/tools/impl/system/update_apply.rs b/crates/openhuman-core/src/platform/update/tools.rssimilarity index 67%rename from crates/openhuman-core/src/tools/impl/system/update_apply.rsrename to crates/openhuman-core/src/platform/update/tools.rsindex ad0e8a40e9..ac11ab4f4f 100644--- a/crates/openhuman-core/src/tools/impl/system/update_apply.rs+++ b/crates/openhuman-core/src/platform/update/tools.rs@@ -1,35 +1,90 @@-//! Tool: `update_apply` — orchestrated check → download → stage →-//! restart of the OpenHuman core binary.+//! Agent-facing tools for the platform update domain.//!-//! Wraps [`crate::platform::update::rpc::update_run`] so the LLM can-//! finish an "update me to the latest version" intent in chat. The-//! underlying RPC already enforces:-//!-//! * `config.update.rpc_mutations_enabled` — fail-closed if disabled.-//! * GitHub host + asset-name validation before any download.-//! * The configured `restart_strategy` (`self_replace` vs-//! `supervisor`) — staging logic stays in the `update` domain.-//!-//! On top of that, this tool layers a tool-level autonomy check-//! (`SecurityPolicy::can_act`) so a read-only session can never trigger-//! a download, even if the policy gate is on.-//!-//! The tool description tells the orchestrator to confirm with the user-//! via `ask_user_clarification` before invoking — applying an update is-//! high impact (replaces a binary on disk, optionally restarts the core-//! process) and must not happen silently.+//! These tools preserve the stable `update_check` and `update_apply` names+//! while keeping their implementation beside the RPC behavior they wrap.use crate::agent::tinyagents::host::run_context::dispatch_ctx_for_tool;use crate::core::runtime::DispatchCtx;-use std::sync::Arc;--use async_trait::async_trait;-use serde_json::{json, Value};-use crate::platform::update;use crate::security::{SecurityPolicy, ToolOperation};+use async_trait::async_trait;+use serde_json::{json, Value};+use std::sync::Arc;use tinytools::{PermissionLevel, Tool, ToolResult};+// Read-only release discovery.+pub struct UpdateCheckTool;++impl UpdateCheckTool {+ pub fn new() -> Self {+ Self+ }+}++impl Default for UpdateCheckTool {+ fn default() -> Self {+ Self::new()+ }+}++#[async_trait]+impl Tool for UpdateCheckTool {+ fn name(&self) -> &str {+ "update_check"+ }++ fn description(&self) -> &str {+ "Check whether a newer OpenHuman core build is available on GitHub \+ Releases. Read-only — performs one HTTPS request to the releases \+ feed and returns version info plus, if a newer build exists, its \+ download URL, asset name, and release notes. Use this when the \+ user asks 'am I up to date', 'is there a new version', or before \+ offering to apply an update with `update_apply`. Does NOT download \+ or install anything."+ }++ fn parameters_schema(&self) -> Value {+ json!({+ "type": "object",+ "properties": {},+ "additionalProperties": false+ })+ }++ fn permission_level(&self) -> PermissionLevel {+ PermissionLevel::ReadOnly+ }++ async fn execute(&self, _args: Value) -> anyhow::Result<ToolResult> {+ tracing::debug!("[update_check] execute start");+ let outcome = update::rpc::update_check().await;+ let body = serde_json::to_string_pretty(&outcome.value)?;+ for log in &outcome.logs {+ tracing::debug!(target: "update_check", "{log}");+ }+ // `update_check` is read-only — both "newer release available"+ // and "you're already on the latest version" are normal success+ // outcomes here, so we only error out when the underlying RPC+ // explicitly surfaces an `error` key (e.g. release feed+ // unreachable, asset metadata malformed). The applied=false+ // tightening that `update_apply` performs is intentionally NOT+ // mirrored — read-only callers must keep treating "no update"+ // as a happy answer.+ let is_error = outcome.value.get("error").is_some();+ tracing::debug!(+ is_error,+ body_len = body.len(),+ "[update_check] execute done"+ );+ Ok(if is_error {+ ToolResult::error(body)+ } else {+ ToolResult::success(body)+ })+ }+}++// Consent-gated download, staging, and restart request.pub struct UpdateApplyTool {security: Arc<SecurityPolicy>,}@@ -169,5 +224,5 @@ impl UpdateApplyTool {}#[cfg(test)]-#[path = "update_apply_tests.rs"]+#[path = "tools_tests.rs"]mod tests;diff --git a/crates/openhuman-core/src/tools/impl/system/update_apply_tests.rs b/crates/openhuman-core/src/platform/update/tools_tests.rssimilarity index 76%rename from crates/openhuman-core/src/tools/impl/system/update_apply_tests.rsrename to crates/openhuman-core/src/platform/update/tools_tests.rsindex 397cdd231e..55c841745a 100644--- a/crates/openhuman-core/src/tools/impl/system/update_apply_tests.rs+++ b/crates/openhuman-core/src/platform/update/tools_tests.rs@@ -1,5 +1,39 @@use super::*;-use crate::security::{AutonomyLevel, SecurityPolicy};++#[test]+fn name_and_permission() {+ let tool = UpdateCheckTool::new();+ assert_eq!(tool.name(), "update_check");+ assert_eq!(tool.permission_level(), PermissionLevel::ReadOnly);+}++#[test]+fn schema_is_closed_object_with_no_properties() {+ let schema = UpdateCheckTool::new().parameters_schema();+ assert_eq!(schema["type"], "object");+ assert_eq!(schema["additionalProperties"], false);+ let props = schema["properties"].as_object().expect("properties object");+ assert!(+ props.is_empty(),+ "update_check takes no arguments — schema must not advertise any"+ );+}++#[test]+fn description_mentions_safety_and_companion_tool() {+ let tool = UpdateCheckTool::new();+ let desc = tool.description();+ assert!(desc.contains("Read-only"));+ assert!(desc.contains("update_apply"));+ assert!(desc.contains("Does NOT download"));+}++#[test]+fn default_constructs_same_as_new() {+ let a = UpdateCheckTool;+ let b = UpdateCheckTool::new();+ assert_eq!(a.name(), b.name());+}use serde_json::json;use std::sync::Arc;diff --git a/crates/openhuman-core/src/tools/impl/system/update_check.rs b/crates/openhuman-core/src/tools/impl/system/update_check.rsdeleted file mode 100644index d2f7e0fcd2..0000000000--- a/crates/openhuman-core/src/tools/impl/system/update_check.rs+++ /dev/null@@ -1,89 +0,0 @@-//! Tool: `update_check` — surface the orchestrator's view of the-//! self-update domain.-//!-//! Read-only wrapper around [`crate::platform::update::rpc::update_check`].-//! Lets the orchestrator answer "is there a new version?" in chat without-//! routing the user to Settings → Developer Options. Implementation is a-//! thin pass-through — release URL discovery and version comparison stay-//! in the `update` domain.--use async_trait::async_trait;-use serde_json::{json, Value};--use crate::platform::update;-use tinytools::{PermissionLevel, Tool, ToolResult};--pub struct UpdateCheckTool;--impl UpdateCheckTool {- pub fn new() -> Self {- Self- }-}--impl Default for UpdateCheckTool {- fn default() -> Self {- Self::new()- }-}--#[async_trait]-impl Tool for UpdateCheckTool {- fn name(&self) -> &str {- "update_check"- }-- fn description(&self) -> &str {- "Check whether a newer OpenHuman core build is available on GitHub \- Releases. Read-only — performs one HTTPS request to the releases \- feed and returns version info plus, if a newer build exists, its \- download URL, asset name, and release notes. Use this when the \- user asks 'am I up to date', 'is there a new version', or before \- offering to apply an update with `update_apply`. Does NOT download \- or install anything."- }-- fn parameters_schema(&self) -> Value {- json!({- "type": "object",- "properties": {},- "additionalProperties": false- })- }-- fn permission_level(&self) -> PermissionLevel {- PermissionLevel::ReadOnly- }-- async fn execute(&self, _args: Value) -> anyhow::Result<ToolResult> {- tracing::debug!("[update_check] execute start");- let outcome = update::rpc::update_check().await;- let body = serde_json::to_string_pretty(&outcome.value)?;- for log in &outcome.logs {- tracing::debug!(target: "update_check", "{log}");- }- // `update_check` is read-only — both "newer release available"- // and "you're already on the latest version" are normal success- // outcomes here, so we only error out when the underlying RPC- // explicitly surfaces an `error` key (e.g. release feed- // unreachable, asset metadata malformed). The applied=false- // tightening that `update_apply` performs is intentionally NOT- // mirrored — read-only callers must keep treating "no update"- // as a happy answer.- let is_error = outcome.value.get("error").is_some();- tracing::debug!(- is_error,- body_len = body.len(),- "[update_check] execute done"- );- Ok(if is_error {- ToolResult::error(body)- } else {- ToolResult::success(body)- })- }-}--#[cfg(test)]-#[path = "update_check_tests.rs"]-mod tests;diff --git a/crates/openhuman-core/src/tools/impl/system/update_check_tests.rs b/crates/openhuman-core/src/tools/impl/system/update_check_tests.rsdeleted file mode 100644index c62d080cb0..0000000000--- a/crates/openhuman-core/src/tools/impl/system/update_check_tests.rs+++ /dev/null@@ -1,36 +0,0 @@-use super::*;--#[test]-fn name_and_permission() {- let tool = UpdateCheckTool::new();- assert_eq!(tool.name(), "update_check");- assert_eq!(tool.permission_level(), PermissionLevel::ReadOnly);-}--#[test]-fn schema_is_closed_object_with_no_properties() {- let schema = UpdateCheckTool::new().parameters_schema();- assert_eq!(schema["type"], "object");- assert_eq!(schema["additionalProperties"], false);- let props = schema["properties"].as_object().expect("properties object");- assert!(- props.is_empty(),- "update_check takes no arguments — schema must not advertise any"- );-}--#[test]-fn description_mentions_safety_and_companion_tool() {- let tool = UpdateCheckTool::new();- let desc = tool.description();- assert!(desc.contains("Read-only"));- assert!(desc.contains("update_apply"));- assert!(desc.contains("Does NOT download"));-}--#[test]-fn default_constructs_same_as_new() {- let a = UpdateCheckTool;- let b = UpdateCheckTool::new();- assert_eq!(a.name(), b.name());-}