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
refactor(core): replace `anyhow` with `color_eyre` for error handling
Steven Enamakel5888313944c3
diff --git a/crates/openhuman-core/src/agent/bus.rs b/crates/openhuman-core/src/agent/bus.rsindex c70570d96d..5bc89c6664 100644--- a/crates/openhuman-core/src/agent/bus.rs+++ b/crates/openhuman-core/src/agent/bus.rs@@ -32,7 +32,7 @@ use tinytools::Tool;use super::harness::definition::{AgentDefinitionRegistry, SandboxMode};use super::harness::{run_channel_turn_via_graph, with_current_sandbox_mode};-use crate::agent::file_state::with_file_state_agent_id;+use tinytools_std::file_state::with_file_state_agent_id;/// Method name used to dispatch an agentic turn through the native bus.pub const AGENT_RUN_TURN_METHOD: &str = "agent.run_turn";diff --git a/crates/openhuman-core/src/agent/file_state/mod.rs b/crates/openhuman-core/src/agent/file_state/mod.rsdeleted file mode 100644index 6fa7bbe58a..0000000000--- a/crates/openhuman-core/src/agent/file_state/mod.rs+++ /dev/null@@ -1,27 +0,0 @@-//! Process-wide file state coordinator for cross-agent staleness detection.-//!-//! The mechanism lives in [`tinytools_std::file_state`]; this module keeps only-//! the host decision of whether the guard is on. Disable with-//! `OPENHUMAN_FILE_STATE_GUARD=0` (or `false`, `off`, `no`).--pub use tinytools_std::file_state::{- acquire_path_lock, check_partial_read, check_stale_read, current_file_state_agent_id,- parent_stale_files, record_read, record_write, try_global, with_file_state_agent_id,- FileStateCoordinator, ReadStamp,-};--/// Whether `OPENHUMAN_FILE_STATE_GUARD` disables the guard.-fn guard_enabled() -> bool {- !std::env::var("OPENHUMAN_FILE_STATE_GUARD")- .map(|v| matches!(v.as_str(), "0" | "false" | "off" | "no"))- .unwrap_or(false)-}--/// Initialise the process-global coordinator unless the environment disables it.-pub fn init_global() {- let enabled = guard_enabled();- if !enabled {- log::debug!("[file_state] guard disabled via OPENHUMAN_FILE_STATE_GUARD");- }- tinytools_std::file_state::init_global(enabled);-}diff --git a/crates/openhuman-core/src/agent/mod.rs b/crates/openhuman-core/src/agent/mod.rsindex 809ba253b1..2cd180193f 100644--- a/crates/openhuman-core/src/agent/mod.rs+++ b/crates/openhuman-core/src/agent/mod.rs@@ -26,7 +26,6 @@ pub(crate) mod cost;pub mod debug;pub mod error;pub mod experience;-pub mod file_state;pub mod goals;pub mod harness;pub mod harness_init;diff --git a/crates/openhuman-core/src/agent/orchestration/spawn_parallel_graph/collect.rs b/crates/openhuman-core/src/agent/orchestration/spawn_parallel_graph/collect.rsindex 249bbca9ac..1ed628d54d 100644--- a/crates/openhuman-core/src/agent/orchestration/spawn_parallel_graph/collect.rs+++ b/crates/openhuman-core/src/agent/orchestration/spawn_parallel_graph/collect.rs@@ -7,7 +7,7 @@ use std::path::PathBuf;use serde_json::json;use tokio::sync::mpsc::Sender;-use crate::agent::file_state;+use tinytools_std::file_state;use crate::agent::progress::AgentProgress;use super::types::{ParallelAgentResult, ParallelAgentStatus};diff --git a/crates/openhuman-core/src/agent/subagent_host/ops/runner.rs b/crates/openhuman-core/src/agent/subagent_host/ops/runner.rsindex 712e80b4ee..3714253817 100644--- a/crates/openhuman-core/src/agent/subagent_host/ops/runner.rs+++ b/crates/openhuman-core/src/agent/subagent_host/ops/runner.rs@@ -10,7 +10,7 @@ use std::collections::HashSet;use std::sync::Arc;use std::time::Instant;-use crate::agent::file_state::with_file_state_agent_id;+use tinytools_std::file_state::with_file_state_agent_id;use crate::agent::harness::agent_graph::{AgentTurnRequest, AgentTurnUsage};use crate::agent::harness::artifact_offload::{effective_offload_threshold, extract_artifact_paths, new_artifact_offload,diff --git a/crates/openhuman-core/src/core/runtime/bootstrap.rs b/crates/openhuman-core/src/core/runtime/bootstrap.rsindex 10b0049432..d1d938546e 100644--- a/crates/openhuman-core/src/core/runtime/bootstrap.rs+++ b/crates/openhuman-core/src/core/runtime/bootstrap.rs@@ -37,7 +37,15 @@ pub(crate) async fn bootstrap_core_runtime(crate::core::bus::init().await.expect("bus init");let agent_enabled = domains.allows(crate::core::all::DomainGroup::Agent);if agent_enabled {- crate::agent::file_state::init_global();+ // Host decision: `OPENHUMAN_FILE_STATE_GUARD=0|false|off|no` turns the+ // cross-agent file-staleness guard off.+ let guard_disabled = std::env::var("OPENHUMAN_FILE_STATE_GUARD")+ .map(|v| matches!(v.as_str(), "0" | "false" | "off" | "no"))+ .unwrap_or(false);+ if guard_disabled {+ log::debug!("[file_state] guard disabled via OPENHUMAN_FILE_STATE_GUARD");+ }+ tinytools_std::file_state::init_global(!guard_disabled);} else {log::debug!("[boot] agent file-state coordinator SKIPPED — Agent domain disabled");}diff --git a/crates/openhuman-core/src/modules/browser.rs b/crates/openhuman-core/src/modules/browser.rsindex 55e8bfd828..0786aa4189 100644--- a/crates/openhuman-core/src/modules/browser.rs+++ b/crates/openhuman-core/src/modules/browser.rs@@ -424,9 +424,9 @@ fn private_or_local(host: &str) -> bool {// `is_non_global_v4` already covers 0.0.0.0/8; the explicit octet check// keeps that local-host range visibly blocked at this call site too.Ok(std::net::IpAddr::V4(ip)) => {- crate::tools::implementations::is_non_global_v4(ip) || ip.octets()[0] == 0+ tinytools_std::url_guard::is_non_global_v4(ip) || ip.octets()[0] == 0}- Ok(std::net::IpAddr::V6(ip)) => crate::tools::implementations::is_non_global_v6(ip),+ Ok(std::net::IpAddr::V6(ip)) => tinytools_std::url_guard::is_non_global_v6(ip),Err(_) => false,}}diff --git a/crates/openhuman-core/src/tools/impl/filesystem/apply_patch.rs b/crates/openhuman-core/src/tools/impl/filesystem/apply_patch.rsindex 0a185aa265..31bb3a882c 100644--- a/crates/openhuman-core/src/tools/impl/filesystem/apply_patch.rs+++ b/crates/openhuman-core/src/tools/impl/filesystem/apply_patch.rs@@ -14,7 +14,7 @@//! containing `x`). An empty `old_string` against a file that *does* exist is//! still an error — "replace nothing" is ambiguous, not a create.-use crate::agent::file_state;+use tinytools_std::file_state;use crate::security::{CommandClass, GateDecision, SecurityPolicy};use async_trait::async_trait;use serde_json::json;diff --git a/crates/openhuman-core/src/tools/impl/filesystem/edit_file.rs b/crates/openhuman-core/src/tools/impl/filesystem/edit_file.rsindex 208da021d1..d596c97509 100644--- a/crates/openhuman-core/src/tools/impl/filesystem/edit_file.rs+++ b/crates/openhuman-core/src/tools/impl/filesystem/edit_file.rs@@ -6,7 +6,7 @@//! exactly once in the file (so the model can't accidentally edit//! every match). Set `replace_all` to override.-use crate::agent::file_state;+use tinytools_std::file_state;use crate::security::{CommandClass, GateDecision, SecurityPolicy};use async_trait::async_trait;use serde_json::json;diff --git a/crates/openhuman-core/src/tools/impl/filesystem/file_read.rs b/crates/openhuman-core/src/tools/impl/filesystem/file_read.rsindex d25ba1d5be..215ad28c00 100644--- a/crates/openhuman-core/src/tools/impl/filesystem/file_read.rs+++ b/crates/openhuman-core/src/tools/impl/filesystem/file_read.rs@@ -1,4 +1,4 @@-use crate::agent::file_state;+use tinytools_std::file_state;use crate::security::SecurityPolicy;use async_trait::async_trait;use serde_json::json;diff --git a/crates/openhuman-core/src/tools/impl/filesystem/file_write.rs b/crates/openhuman-core/src/tools/impl/filesystem/file_write.rsindex 5ceddbba63..c85627748a 100644--- a/crates/openhuman-core/src/tools/impl/filesystem/file_write.rs+++ b/crates/openhuman-core/src/tools/impl/filesystem/file_write.rs@@ -1,4 +1,4 @@-use crate::agent::file_state;+use tinytools_std::file_state;use crate::security::{CommandClass, GateDecision, SecurityPolicy};use async_trait::async_trait;use serde_json::json;diff --git a/crates/openhuman-core/src/tools/impl/network/curl.rs b/crates/openhuman-core/src/tools/impl/network/curl.rsindex d15ef7926b..f7e89ba7a6 100644--- a/crates/openhuman-core/src/tools/impl/network/curl.rs+++ b/crates/openhuman-core/src/tools/impl/network/curl.rs@@ -6,7 +6,7 @@//! `http_request.allowed_domains` so there is one allowlist to reason//! about.-use super::url_guard::{normalize_allowed_domains, validate_url_with_dns_check};+use tinytools_std::url_guard::{normalize_allowed_domains, validate_url_with_dns_check};use crate::security::{CommandClass, GateDecision, SecurityPolicy};use async_trait::async_trait;use futures_util::StreamExt;diff --git a/crates/openhuman-core/src/tools/impl/network/http_request.rs b/crates/openhuman-core/src/tools/impl/network/http_request.rsindex 0882a0ce8e..bf64df77dd 100644--- a/crates/openhuman-core/src/tools/impl/network/http_request.rs+++ b/crates/openhuman-core/src/tools/impl/network/http_request.rs@@ -1,4 +1,4 @@-use super::url_guard::{normalize_allowed_domains, validate_url_with_dns_check};+use tinytools_std::url_guard::{normalize_allowed_domains, validate_url_with_dns_check};use crate::config::HttpRequestConfig;use crate::security::{CommandClass, GateDecision, SecurityPolicy};use async_trait::async_trait;diff --git a/crates/openhuman-core/src/tools/impl/network/mod.rs b/crates/openhuman-core/src/tools/impl/network/mod.rsindex 83d4cd7efc..c04248f1a1 100644--- a/crates/openhuman-core/src/tools/impl/network/mod.rs+++ b/crates/openhuman-core/src/tools/impl/network/mod.rs@@ -16,7 +16,6 @@ mod http_request;mod mcp;#[cfg(feature = "mcp")]mod mcp_server_tools;-mod url_guard;mod web_fetch;pub use curl::CurlTool;@@ -27,12 +26,6 @@ pub use http_request::HttpRequestTool;pub use mcp::{McpCallTool, McpListServersTool, McpListToolsTool};#[cfg(feature = "mcp")]pub use mcp_server_tools::{configured_server_tools, ConfiguredMcpServerTool};-/// The SSRF guard the network tools apply, so a host outside this crate can-/// hold user-supplied URLs to the same rule rather than writing a second one.-pub use url_guard::{- extract_host, extract_port, host_matches_allowlist, is_non_global_v4, is_non_global_v6,- is_private_or_local_host, normalize_allowed_domains, normalize_domain, validate_url,-};pub use web_fetch::WebFetchTool;/// Shared test helper for the network tools' local-only enforcement testsdiff --git a/crates/openhuman-core/src/tools/impl/network/url_guard.rs b/crates/openhuman-core/src/tools/impl/network/url_guard.rsdeleted file mode 100644index ece3ad144d..0000000000--- a/crates/openhuman-core/src/tools/impl/network/url_guard.rs+++ /dev/null@@ -1,8 +0,0 @@-//! Shared URL validation + SSRF guards for outbound network tools; the-//! implementation lives in [`tinytools_std::url_guard`].--pub use tinytools_std::url_guard::{- extract_host, extract_port, host_matches_allowlist, is_non_global_v4, is_non_global_v6,- is_private_or_local_host, normalize_allowed_domains, normalize_domain, validate_url,- validate_url_with_dns_check,-};diff --git a/crates/openhuman-core/src/tools/impl/network/web_fetch.rs b/crates/openhuman-core/src/tools/impl/network/web_fetch.rsindex ae742c429d..528d83e532 100644--- a/crates/openhuman-core/src/tools/impl/network/web_fetch.rs+++ b/crates/openhuman-core/src/tools/impl/network/web_fetch.rs@@ -6,7 +6,7 @@//! the agent reaches for when researching: returns the response body//! as text, capped, with a tiny preamble (status + final URL).-use super::url_guard::{normalize_allowed_domains, validate_url_with_dns_check};+use tinytools_std::url_guard::{normalize_allowed_domains, validate_url_with_dns_check};use crate::config::HttpRequestConfig;use crate::security::SecurityPolicy;use async_trait::async_trait;diff --git a/crates/openhuman-core/src/tools/impl/system/command_output.rs b/crates/openhuman-core/src/tools/impl/system/command_output.rsdeleted file mode 100644index 7361b3bcc9..0000000000--- a/crates/openhuman-core/src/tools/impl/system/command_output.rs+++ /dev/null@@ -1,4 +0,0 @@-//! Shared failure rendering for the shell-family command tools; the-//! implementation lives in [`tinytools_std::command_output`].--pub(crate) use tinytools_std::command_output::{command_failure, sandbox_exit_code};diff --git a/crates/openhuman-core/src/tools/impl/system/detect_tools.rs b/crates/openhuman-core/src/tools/impl/system/detect_tools.rsdeleted file mode 100644index 05b4d4b13f..0000000000--- a/crates/openhuman-core/src/tools/impl/system/detect_tools.rs+++ /dev/null@@ -1,5 +0,0 @@-//! `detect_tools` and PATH probing; the implementation lives in-//! [`tinytools_std::detect_tools`].--pub(crate) use tinytools_std::detect_tools::find_on_path;-pub use tinytools_std::detect_tools::DetectToolsTool;diff --git a/crates/openhuman-core/src/tools/impl/system/install_tool.rs b/crates/openhuman-core/src/tools/impl/system/install_tool.rsindex c7235a9a1d..c8feaf2c91 100644--- a/crates/openhuman-core/src/tools/impl/system/install_tool.rs+++ b/crates/openhuman-core/src/tools/impl/system/install_tool.rs@@ -20,7 +20,7 @@ use tinytools::{PermissionLevel, Tool, ToolResult};use tokio::process::Command as TokioCommand;use tokio::time::timeout;-use super::detect_tools::find_on_path;+use tinytools_std::detect_tools::find_on_path;/// Hard cap on an install before it is killed.const INSTALL_TIMEOUT_SECS: u64 = 300;diff --git a/crates/openhuman-core/src/tools/impl/system/mod.rs b/crates/openhuman-core/src/tools/impl/system/mod.rsindex 2e06f72917..34aa0df145 100644--- a/crates/openhuman-core/src/tools/impl/system/mod.rs+++ b/crates/openhuman-core/src/tools/impl/system/mod.rs@@ -4,8 +4,6 @@//! `tools/impl/README.md`; `security_for_tool_context` below is the shared//! `SecurityPolicy` resolver that must stay in step with the `filesystem` copy.-mod command_output;-mod detect_tools;mod insert_sql_record;mod install_tool;mod lsp;@@ -26,7 +24,6 @@ use crate::security::policy::{TrustedAccess, TrustedRoot};use crate::security::SecurityPolicy;use tinytools::ToolRunContext;-pub use detect_tools::DetectToolsTool;pub use insert_sql_record::InsertSqlRecordTool;pub use install_tool::InstallToolTool;pub use lsp::{lsp_capability_enabled, LspTool, LSP_ENABLED_ENV};diff --git a/crates/openhuman-core/src/tools/impl/system/node_exec.rs b/crates/openhuman-core/src/tools/impl/system/node_exec.rsindex 648262099e..cf7c3b4219 100644--- a/crates/openhuman-core/src/tools/impl/system/node_exec.rs+++ b/crates/openhuman-core/src/tools/impl/system/node_exec.rs@@ -358,7 +358,7 @@ impl NodeExecTool {} else {// Surface exit code + both streams so the agent can diagnose// the failure instead of re-running it (#4095).- Ok(super::command_output::command_failure(+ Ok(tinytools_std::command_output::command_failure(output.status.code(),&stdout,&stderr,@@ -544,8 +544,8 @@ impl NodeExecTool {))}} else {- super::command_output::command_failure(- super::command_output::sandbox_exit_code(result.exit_code),+ tinytools_std::command_output::command_failure(+ tinytools_std::command_output::sandbox_exit_code(result.exit_code),&result.stdout,&result.stderr,)@@ -590,7 +590,7 @@ fn pool_outcome_to_result(ToolResult::success(format!("{stdout}\n[stderr]\n{stderr}"))}} else {- super::command_output::command_failure(outcome.exit_code, &stdout, &stderr)+ tinytools_std::command_output::command_failure(outcome.exit_code, &stdout, &stderr)}}diff --git a/crates/openhuman-core/src/tools/impl/system/npm_exec.rs b/crates/openhuman-core/src/tools/impl/system/npm_exec.rsindex 33a70f2484..8146e69653 100644--- a/crates/openhuman-core/src/tools/impl/system/npm_exec.rs+++ b/crates/openhuman-core/src/tools/impl/system/npm_exec.rs@@ -350,7 +350,7 @@ impl NpmExecTool {} else {// Surface exit code + both streams so the agent can diagnose// the failure instead of re-running it (#4095).- Ok(super::command_output::command_failure(+ Ok(tinytools_std::command_output::command_failure(output.status.code(),&stdout,&stderr,@@ -459,8 +459,8 @@ impl NpmExecTool {))}} else {- super::command_output::command_failure(- super::command_output::sandbox_exit_code(result.exit_code),+ tinytools_std::command_output::command_failure(+ tinytools_std::command_output::sandbox_exit_code(result.exit_code),&result.stdout,&result.stderr,)diff --git a/crates/openhuman-core/src/tools/impl/system/shell.rs b/crates/openhuman-core/src/tools/impl/system/shell.rsindex 88d132977a..db72f20380 100644--- a/crates/openhuman-core/src/tools/impl/system/shell.rs+++ b/crates/openhuman-core/src/tools/impl/system/shell.rs@@ -471,7 +471,7 @@ impl ShellTool {// Surface the exit code AND both streams so the agent can// diagnose the failure (e.g. 127 missing dependency, 126// sandbox/permission wall) instead of looping on it (#4095).- super::command_output::command_failure(output.status.code(), &stdout, &stderr)+ tinytools_std::command_output::command_failure(output.status.code(), &stdout, &stderr)}}Ok(Err(e)) => ToolResult::error(format!("Failed to execute command: {e}")),@@ -558,8 +558,8 @@ impl ShellTool {} else {// Same exit-code + both-streams surfacing as the native path// (#4095); the sandbox `-1` sentinel renders as a signal.- super::command_output::command_failure(- super::command_output::sandbox_exit_code(result.exit_code),+ tinytools_std::command_output::command_failure(+ tinytools_std::command_output::sandbox_exit_code(result.exit_code),&result.stdout,&result.stderr,)