Skip to content

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

chore(tools): reorder imports and apply rustfmt formatting

Steven Enamakel57e9db6c812b
diff --git a/crates/openhuman-core/src/agent/registration.rs b/crates/openhuman-core/src/agent/registration.rs
index cab416459b..f96158362d 100644
--- a/crates/openhuman-core/src/agent/registration.rs
+++ b/crates/openhuman-core/src/agent/registration.rs
@@ -7,8 +7,8 @@ use crate::config::Config;
use crate::skills::run_workflow::{AwaitWorkflowTool, RunWorkflowTool};
use std::path::Path;
use tinyagents_harness_tools as harness_tools;
-use tinytools::Tool;
use tinyagents_harness_tools::fs::filesystem::WorkspaceStateTool;
+use tinytools::Tool;
/// Build the dialogue tool family in its persisted catalogue order.
pub(crate) fn dialogue_tools(action_dir: &Path, root_config: &Config) -> Vec<Box<dyn Tool>> {
diff --git a/crates/openhuman-core/src/agent/subagent_host/ops/runner.rs b/crates/openhuman-core/src/agent/subagent_host/ops/runner.rs
index ff8865bb5d..443016481a 100644
--- a/crates/openhuman-core/src/agent/subagent_host/ops/runner.rs
+++ b/crates/openhuman-core/src/agent/subagent_host/ops/runner.rs
@@ -24,8 +24,8 @@ use crate::agent_registry::host_definition::{AgentDefinition, AgentDefinitionReg
use crate::inference::provider::AGENT_TURN_MAX_OUTPUT_TOKENS;
use tinyagents_definition::{validate_tier_transition, AgentTier, IterationPolicy, PromptSource};
use tinyagents_harness::context::{current_run_depth, with_run_depth, RunConfig, RunDepth};
-use tinytools::{Tool, ToolSpec};
use tinyagents_harness_tools::fs::file_state::with_file_state_agent_id;
+use tinytools::{Tool, ToolSpec};
use super::prompt::compose_subagent_system_prompt;
use super::provider::resolve_subagent_source;
diff --git a/crates/openhuman-core/src/agent/tinyagents/middleware/tool_output.rs b/crates/openhuman-core/src/agent/tinyagents/middleware/tool_output.rs
index c17a13fc75..66a2118ccc 100644
--- a/crates/openhuman-core/src/agent/tinyagents/middleware/tool_output.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/middleware/tool_output.rs
@@ -462,7 +462,8 @@ impl Middleware<(), crate::agent::tinyagents::host::OpenHumanRunContext> for Too
reads.insert(call.id.clone(), read);
}
}
- if tinyagents_harness_tools::fs::filesystem::is_read_only_call(&call.name, &call.arguments) {
+ if tinyagents_harness_tools::fs::filesystem::is_read_only_call(&call.name, &call.arguments)
+ {
tracing::debug!(
tool = %call.name,
call_id = %call.id,
diff --git a/crates/openhuman-core/src/agent/tinyagents/middleware/tool_output_tests.rs b/crates/openhuman-core/src/agent/tinyagents/middleware/tool_output_tests.rs
index 84ab0dcc29..63f5147b53 100644
--- a/crates/openhuman-core/src/agent/tinyagents/middleware/tool_output_tests.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/middleware/tool_output_tests.rs
@@ -177,6 +177,7 @@ fn the_untouched_output_is_kept_only_when_it_could_spill_and_be_read_back() {
assert!(plan_output_stages(&mw, "shell", 101, true).keep_full_output);
assert!(!plan_output_stages(&mw, "shell", 101, false).keep_full_output);
assert!(!plan_output_stages(&mw, "shell", 100, true).keep_full_output);
- let too_big = tinyagents_harness_tools::fs::filesystem::FileReadTool::MAX_FILE_SIZE_BYTES as usize + 1;
+ let too_big =
+ tinyagents_harness_tools::fs::filesystem::FileReadTool::MAX_FILE_SIZE_BYTES as usize + 1;
assert!(!plan_output_stages(&mw, "shell", too_big, true).keep_full_output);
}
diff --git a/crates/openhuman-core/src/agent/tinyagents/middleware_tool_output_artifact_tests.rs b/crates/openhuman-core/src/agent/tinyagents/middleware_tool_output_artifact_tests.rs
index d4640f88f4..a77335521a 100644
--- a/crates/openhuman-core/src/agent/tinyagents/middleware_tool_output_artifact_tests.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/middleware_tool_output_artifact_tests.rs
@@ -159,7 +159,8 @@ async fn an_oversized_result_is_stored_as_the_tool_returned_it_not_as_rewritten(
async fn a_raw_result_file_read_cannot_open_is_stored_as_the_processed_copy() {
let tmp = tempfile::tempdir().unwrap();
let summary = "s".repeat(3_000);
- let raw_len = tinyagents_harness_tools::fs::filesystem::FileReadTool::MAX_FILE_SIZE_BYTES as usize + 1;
+ let raw_len =
+ tinyagents_harness_tools::fs::filesystem::FileReadTool::MAX_FILE_SIZE_BYTES as usize + 1;
let mw = artifact_mw(Some(summarized(&summary)), tmp.path());
let mut result = tool_result("echo", &"r".repeat(raw_len));
diff --git a/crates/openhuman-core/src/agent/tinyagents/turn_middleware.rs b/crates/openhuman-core/src/agent/tinyagents/turn_middleware.rs
index 2eef3c535b..b8adde9fdb 100644
--- a/crates/openhuman-core/src/agent/tinyagents/turn_middleware.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/turn_middleware.rs
@@ -288,8 +288,10 @@ pub(super) fn install_turn_middleware(
.max_wall_clock_ms
.map(std::time::Duration::from_millis);
harness.push_middleware(Arc::new(TurnClockMiddleware::new(turn_budget)));
- let shell_turn_budget =
- ShellTurnBudget::with_max_timeout(turn_budget, tinyagents_harness_tools::exec::timeout::MAX_TIMEOUT_SECS);
+ let shell_turn_budget = ShellTurnBudget::with_max_timeout(
+ turn_budget,
+ tinyagents_harness_tools::exec::timeout::MAX_TIMEOUT_SECS,
+ );
harness.push_middleware(Arc::new(shell_turn_budget.notes()));
if let Some(mw) = &repeat_progress {
harness.push_middleware(mw.clone());
diff --git a/crates/openhuman-core/src/artifacts/tiny_store.rs b/crates/openhuman-core/src/artifacts/tiny_store.rs
index 6934d64be9..60c95e8d32 100644
--- a/crates/openhuman-core/src/artifacts/tiny_store.rs
+++ b/crates/openhuman-core/src/artifacts/tiny_store.rs
@@ -603,7 +603,10 @@ pub fn registered_tools(
tools.push(Box::new(PerCallTool::new(
per_call_context,
move |context| {
- tiny_artifacts::CreateArtifactTool::new(service(context.chat.as_ref()), author.clone())
+ tiny_artifacts::CreateArtifactTool::new(
+ service(context.chat.as_ref()),
+ author.clone(),
+ )
},
)));
}
@@ -615,7 +618,10 @@ pub fn registered_tools(
tools.push(Box::new(PerCallTool::new(
per_call_context,
move |context| {
- tiny_artifacts::UpdateArtifactTool::new(service(context.chat.as_ref()), author.clone())
+ tiny_artifacts::UpdateArtifactTool::new(
+ service(context.chat.as_ref()),
+ author.clone(),
+ )
},
)));
}
diff --git a/crates/openhuman-core/src/cron/tools/add.rs b/crates/openhuman-core/src/cron/tools/add.rs
index f198dd548e..11084c88fe 100644
--- a/crates/openhuman-core/src/cron/tools/add.rs
+++ b/crates/openhuman-core/src/cron/tools/add.rs
@@ -2,10 +2,10 @@ use crate::config::Config;
use crate::cron::job_builder::{create_agent_job, AgentJobInput};
use crate::cron::origin::{current_job_origin, current_turn_may_skip_approval};
use crate::security::SecurityPolicy;
-use tinyagents_harness_tools::static_schema;
use async_trait::async_trait;
use serde_json::json;
use std::sync::Arc;
+use tinyagents_harness_tools::static_schema;
use tinytools::{PermissionLevel, Tool, ToolCallOptions, ToolExposure, ToolResult};
use {
crate::cron, tinyflows_bus::schedule::types::DeliveryConfig,
diff --git a/crates/openhuman-core/src/flows/memory_tools.rs b/crates/openhuman-core/src/flows/memory_tools.rs
index e75d4fe575..67751af94f 100644
--- a/crates/openhuman-core/src/flows/memory_tools.rs
+++ b/crates/openhuman-core/src/flows/memory_tools.rs
@@ -22,8 +22,8 @@
//! [`FlowMemoryRecallTool`] only ever reads with a flow tag filter
//! (`flow:<id>` or `flows`), so it never reaches the user's own memory.
-use tinyagents_harness_tools::static_schema;
use std::sync::Arc;
+use tinyagents_harness_tools::static_schema;
use async_trait::async_trait;
use serde_json::json;
diff --git a/crates/openhuman-core/src/inference/tokenjuice/repl_tools.rs b/crates/openhuman-core/src/inference/tokenjuice/repl_tools.rs
index 056c4b9590..ab16662569 100644
--- a/crates/openhuman-core/src/inference/tokenjuice/repl_tools.rs
+++ b/crates/openhuman-core/src/inference/tokenjuice/repl_tools.rs
@@ -22,7 +22,8 @@ pub fn is_repl_tool(name: &str) -> bool {
/// Largest persisted tool-result artifact read through the handle slot: the
/// same limit `file_read` applies, which is also the most the artifact store
/// ever writes.
-const MAX_ARTIFACT_BYTES: u64 = tinyagents_harness_tools::fs::filesystem::FileReadTool::MAX_FILE_SIZE_BYTES;
+const MAX_ARTIFACT_BYTES: u64 =
+ tinyagents_harness_tools::fs::filesystem::FileReadTool::MAX_FILE_SIZE_BYTES;
/// The relative pointer form older stores handed out (`artifacts/tool-results/…`).
const RELATIVE_ARTIFACT_PREFIX: &str = "artifacts/tool-results/";
diff --git a/crates/openhuman-core/src/integrations/composio/tools/list_tools.rs b/crates/openhuman-core/src/integrations/composio/tools/list_tools.rs
index 14b745e611..8c6268dbfc 100644
--- a/crates/openhuman-core/src/integrations/composio/tools/list_tools.rs
+++ b/crates/openhuman-core/src/integrations/composio/tools/list_tools.rs
@@ -1,8 +1,8 @@
//! The `composio_list_tools` agent tool.
-use tinyagents_harness_tools::static_schema;
use std::collections::HashSet;
use std::sync::Arc;
+use tinyagents_harness_tools::static_schema;
use async_trait::async_trait;
use serde_json::Value;
diff --git a/crates/openhuman-core/src/mcp/server/tools/specs.rs b/crates/openhuman-core/src/mcp/server/tools/specs.rs
index 45650cdcc4..716c9dada1 100644
--- a/crates/openhuman-core/src/mcp/server/tools/specs.rs
+++ b/crates/openhuman-core/src/mcp/server/tools/specs.rs
@@ -1,5 +1,5 @@
-use tinyagents_harness_tools::static_schema;
use serde_json::{json, Value};
+use tinyagents_harness_tools::static_schema;
use tinymcp_bus::ServerToolSpec;
use super::types::{
diff --git a/crates/openhuman-core/src/modules/search/proxy_tests.rs b/crates/openhuman-core/src/modules/search/proxy_tests.rs
index 3bf5b4dede..6d351736eb 100644
--- a/crates/openhuman-core/src/modules/search/proxy_tests.rs
+++ b/crates/openhuman-core/src/modules/search/proxy_tests.rs
@@ -125,7 +125,8 @@ async fn execute_tool_outlives_the_bus_default_timeout() {
fn the_execute_tool_deadline_stays_under_the_harness_tool_deadline() {
assert!(EXECUTE_TOOL_TIMEOUT > tinybus::connection::DEFAULT_TIMEOUT);
assert!(
- EXECUTE_TOOL_TIMEOUT.as_secs() < tinyagents_harness_tools::exec::timeout::DEFAULT_TIMEOUT_SECS,
+ EXECUTE_TOOL_TIMEOUT.as_secs()
+ < tinyagents_harness_tools::exec::timeout::DEFAULT_TIMEOUT_SECS,
"the harness would kill the call before the module could answer"
);
}
diff --git a/crates/openhuman-core/src/tools/impl/filesystem/gate_tests.rs b/crates/openhuman-core/src/tools/impl/filesystem/gate_tests.rs
index f7228fe25c..aa66a29596 100644
--- a/crates/openhuman-core/src/tools/impl/filesystem/gate_tests.rs
+++ b/crates/openhuman-core/src/tools/impl/filesystem/gate_tests.rs
@@ -10,11 +10,11 @@ use std::path::{Path, PathBuf};
use std::sync::Arc;
use serde_json::json;
-use tinytools::{Tool, ToolCallOptions, ToolRunContext, WorkspaceDescriptor};
use tinyagents_harness_tools::fs::filesystem::{
ApplyPatchTool, CsvExportTool, EditFileTool, FileReadTool, FileWriteTool, FsGate,
GitOperationsTool, GlobTool, GrepTool, ListFilesTool,
};
+use tinytools::{Tool, ToolCallOptions, ToolRunContext, WorkspaceDescriptor};
use crate::security::{AutonomyLevel, SecurityPolicy};
use tinytools::status::POLICY_BLOCKED_MARKER;
diff --git a/crates/openhuman-core/src/tools/impl/network/gate_tests.rs b/crates/openhuman-core/src/tools/impl/network/gate_tests.rs
index 4fd63b62d2..9004978734 100644
--- a/crates/openhuman-core/src/tools/impl/network/gate_tests.rs
+++ b/crates/openhuman-core/src/tools/impl/network/gate_tests.rs
@@ -2,8 +2,10 @@ use super::*;
use crate::security::{AutonomyLevel, SecurityPolicy};
use serde_json::json;
use std::sync::Arc;
+use tinyagents_harness_tools::net::network::{
+ CurlTool, HttpRequestTool, PushoverTool, WebFetchTool,
+};
use tinytools::{PermissionLevel, Tool};
-use tinyagents_harness_tools::net::network::{CurlTool, HttpRequestTool, PushoverTool, WebFetchTool};
fn policy(autonomy: AutonomyLevel, max_actions_per_hour: u32) -> Arc<SecurityPolicy> {
Arc::new(SecurityPolicy {
diff --git a/crates/openhuman-core/src/tools/impl/network/host.rs b/crates/openhuman-core/src/tools/impl/network/host.rs
index 8bdee7e118..d8b1a98e6a 100644
--- a/crates/openhuman-core/src/tools/impl/network/host.rs
+++ b/crates/openhuman-core/src/tools/impl/network/host.rs
@@ -8,12 +8,12 @@
use crate::core::runtime::DispatchCtx;
use std::sync::Arc;
-use tinytools::Tool;
-#[cfg(feature = "web3")]
-use tinytools::{PermissionLevel, ToolResult};
use tinyagents_harness_tools::net::network::{
AsyncHtmlExtractor, CurlTool, HttpLimits, HttpRequestTool, NetGate, WebFetchTool,
};
+use tinytools::Tool;
+#[cfg(feature = "web3")]
+use tinytools::{PermissionLevel, ToolResult};
use super::gate::RoutedGate;
use crate::config::HttpRequestConfig;
@@ -110,20 +110,17 @@ pub fn routed_http_request_tool(
max_response_size: usize,
timeout_secs: u64,
) -> impl Tool {
- PerCallTool::new(
- per_call_context,
- move |context| {
- let chat = context.chat.as_ref();
- http_request_tool_for(
- &context.dispatch,
- Arc::new(RoutedGate::new(Arc::clone(&policy), chat)),
- chat,
- allowed_domains.clone(),
- max_response_size,
- timeout_secs,
- )
- },
- )
+ PerCallTool::new(per_call_context, move |context| {
+ let chat = context.chat.as_ref();
+ http_request_tool_for(
+ &context.dispatch,
+ Arc::new(RoutedGate::new(Arc::clone(&policy), chat)),
+ chat,
+ allowed_domains.clone(),
+ max_response_size,
+ timeout_secs,
+ )
+ })
}
/// Dedicated x402 agent entry point backed by the same host HTTP policy and
@@ -136,24 +133,21 @@ pub(crate) fn x402_request_tool(
max_response_size: usize,
timeout_secs: u64,
) -> PerCallTool<impl Tool> {
- PerCallTool::new(
- per_call_context,
- move |context| {
- let chat = context.chat.as_ref();
- let gate: Arc<dyn NetGate> = Arc::new(RoutedGate::new(Arc::clone(&policy), chat));
- X402RequestTool {
- gate: Arc::clone(&gate),
- inner: http_request_tool_for(
- &context.dispatch,
- gate,
- chat,
- allowed_domains.clone(),
- max_response_size,
- timeout_secs,
- ),
- }
- },
- )
+ PerCallTool::new(per_call_context, move |context| {
+ let chat = context.chat.as_ref();
+ let gate: Arc<dyn NetGate> = Arc::new(RoutedGate::new(Arc::clone(&policy), chat));
+ X402RequestTool {
+ gate: Arc::clone(&gate),
+ inner: http_request_tool_for(
+ &context.dispatch,
+ gate,
+ chat,
+ allowed_domains.clone(),
+ max_response_size,
+ timeout_secs,
+ ),
+ }
+ })
}
#[cfg(feature = "web3")]
@@ -203,19 +197,16 @@ pub fn routed_curl_tool(
max_download_bytes: u64,
timeout_secs: u64,
) -> impl Tool {
- PerCallTool::new(
- per_call_context,
- move |context| {
- CurlTool::new(
- Arc::new(RoutedGate::new(Arc::clone(&policy), context.chat.as_ref())),
- allowed_domains.clone(),
- action_dir.clone(),
- dest_subdir.clone(),
- max_download_bytes,
- timeout_secs,
- )
- },
- )
+ PerCallTool::new(per_call_context, move |context| {
+ CurlTool::new(
+ Arc::new(RoutedGate::new(Arc::clone(&policy), context.chat.as_ref())),
+ allowed_domains.clone(),
+ action_dir.clone(),
+ dest_subdir.clone(),
+ max_download_bytes,
+ timeout_secs,
+ )
+ })
}
/// `web_fetch` for chat turns: built for each call around that call's chat, so
@@ -226,18 +217,15 @@ pub fn routed_web_fetch_tool(
max_bytes: Option<usize>,
timeout_secs: Option<u64>,
) -> impl Tool {
- PerCallTool::new(
- per_call_context,
- move |context| {
- web_fetch_tool(
- &context.dispatch,
- Arc::new(RoutedGate::new(Arc::clone(&policy), context.chat.as_ref())),
- allowed_domains.clone(),
- max_bytes,
- timeout_secs,
- )
- },
- )
+ PerCallTool::new(per_call_context, move |context| {
+ web_fetch_tool(
+ &context.dispatch,
+ Arc::new(RoutedGate::new(Arc::clone(&policy), context.chat.as_ref())),
+ allowed_domains.clone(),
+ max_bytes,
+ timeout_secs,
+ )
+ })
}
/// `web_fetch`, converting HTML through TinyJuice and opting into TinyJuice's
diff --git a/crates/openhuman-core/src/tools/impl/system/exec_adapters.rs b/crates/openhuman-core/src/tools/impl/system/exec_adapters.rs
index bb516933d4..2282234ea3 100644
--- a/crates/openhuman-core/src/tools/impl/system/exec_adapters.rs
+++ b/crates/openhuman-core/src/tools/impl/system/exec_adapters.rs
@@ -5,8 +5,8 @@ use std::{path::PathBuf, sync::Arc};
use async_trait::async_trait;
use serde_json::Value;
use tinyagents_harness_tools::exec::{
- ExecAuditEvent, ExecAuditOutcome, ExecAuthorizationRequest, ExecBackendCapability,
- ExecDenied, ExecGate, ExecOperation, ExecPermit, ExecRefusalKind, NativeExecCapability,
+ ExecAuditEvent, ExecAuditOutcome, ExecAuthorizationRequest, ExecBackendCapability, ExecDenied,
+ ExecGate, ExecOperation, ExecPermit, ExecRefusalKind, NativeExecCapability,
};
use tinytools::ToolRunContext;
@@ -39,7 +39,9 @@ impl ExecGate for InstallGate {
context: Option<&dyn ToolRunContext>,
) -> Result<ExecPermit, ExecDenied> {
let ExecOperation::Install { .. } = &request.operation else {
- return Err(ExecDenied("install gate received a non-install operation".into()));
+ return Err(ExecDenied(
+ "install gate received a non-install operation".into(),
+ ));
};
if crate::core::runtime::is_saas() {
return Err(ExecDenied(
diff --git a/crates/openhuman-core/src/tools/impl/system/install_tool.rs b/crates/openhuman-core/src/tools/impl/system/install_tool.rs
index d09d65fb64..a7544f1a57 100644
--- a/crates/openhuman-core/src/tools/impl/system/install_tool.rs
+++ b/crates/openhuman-core/src/tools/impl/system/install_tool.rs
@@ -20,15 +20,11 @@ impl InstallToolTool {
}
pub fn with_audit(security: Arc<SecurityPolicy>, audit: Arc<AuditLogger>) -> Self {
- let gate = Arc::new(InstallGate {
- security,
- audit,
- });
- let backend: Arc<dyn ExecBackend> = Arc::new(
- tinyagents_harness_tools::exec::NativeExecBackend::new(
+ let gate = Arc::new(InstallGate { security, audit });
+ let backend: Arc<dyn ExecBackend> =
+ Arc::new(tinyagents_harness_tools::exec::NativeExecBackend::new(
tinyagents_harness_tools::exec::ShellFlavor::Posix,
- ),
- );
+ ));
Self {
inner: InstallTool::new(gate, backend),
}
@@ -79,7 +75,9 @@ impl Tool for InstallToolTool {
options: ToolCallOptions,
context: Option<&dyn ToolRunContext>,
) -> anyhow::Result<ToolResult> {
- self.inner.execute_with_context(args, options, context).await
+ self.inner
+ .execute_with_context(args, options, context)
+ .await
}
}
diff --git a/crates/openhuman-core/src/tools/impl/system/install_tool_tests.rs b/crates/openhuman-core/src/tools/impl/system/install_tool_tests.rs
index da8866b54d..52de65bbd7 100644
--- a/crates/openhuman-core/src/tools/impl/system/install_tool_tests.rs
+++ b/crates/openhuman-core/src/tools/impl/system/install_tool_tests.rs
@@ -104,4 +104,3 @@ async fn rejects_unknown_manager() {
.unwrap();
assert!(result.is_error);
}
-
diff --git a/crates/openhuman-core/src/tools/impl/system/mod.rs b/crates/openhuman-core/src/tools/impl/system/mod.rs
index 02a47174ea..b2fd6ac8e0 100644
--- a/crates/openhuman-core/src/tools/impl/system/mod.rs
+++ b/crates/openhuman-core/src/tools/impl/system/mod.rs
@@ -3,8 +3,8 @@
//! Each family, its tool structs, and its registration gates are catalogued in
//! `tools/impl/README.md`.
-mod install_tool;
mod exec_adapters;
+mod install_tool;
mod proxy_config;
mod retrieve_tool_output;
mod schedule;
diff --git a/crates/openhuman-core/src/tools/impl/system/proxy_config.rs b/crates/openhuman-core/src/tools/impl/system/proxy_config.rs
index 9555474a6e..ef150c1d48 100644
--- a/crates/openhuman-core/src/tools/impl/system/proxy_config.rs
+++ b/crates/openhuman-core/src/tools/impl/system/proxy_config.rs
@@ -2,12 +2,12 @@ use crate::config::{
runtime_proxy_config, set_runtime_proxy_config, Config, ProxyConfig, ProxyScope,
};
use crate::security::SecurityPolicy;
-use tinyagents_harness_tools::static_schema;
use crate::util::MaybeSet;
use async_trait::async_trait;
use serde_json::{json, Value};
use std::fs;
use std::sync::Arc;
+use tinyagents_harness_tools::static_schema;
use tinytools::{Tool, ToolResult};
pub struct ProxyConfigTool {
diff --git a/crates/openhuman-core/src/tools/impl/system/schedule.rs b/crates/openhuman-core/src/tools/impl/system/schedule.rs
index a769062031..28515237f1 100644
--- a/crates/openhuman-core/src/tools/impl/system/schedule.rs
+++ b/crates/openhuman-core/src/tools/impl/system/schedule.rs
@@ -2,12 +2,12 @@ use crate::config::Config;
use crate::cron::job_builder::{create_agent_job, AgentJobInput};
use crate::cron::origin::{current_job_origin, current_turn_may_skip_approval};
use crate::security::SecurityPolicy;
-use tinyagents_harness_tools::static_schema;
use anyhow::Result;
use async_trait::async_trait;
use chrono::{DateTime, Utc};
use serde_json::json;
use std::sync::Arc;
+use tinyagents_harness_tools::static_schema;
use tinytools::{PermissionLevel, Tool, ToolResult};
use {crate::cron, tinyflows_bus::schedule::types::Schedule};
diff --git a/crates/openhuman-core/src/tools/impl/system/shell.rs b/crates/openhuman-core/src/tools/impl/system/shell.rs
index dae548534b..1753fabd18 100644
--- a/crates/openhuman-core/src/tools/impl/system/shell.rs
+++ b/crates/openhuman-core/src/tools/impl/system/shell.rs
@@ -10,17 +10,17 @@ use crate::core::runtime::DispatchCtx;
use crate::modules::tinybox::host_runtime::RuntimeAdapter;
use crate::security::{AuditLogger, CommandExecutionLog, SecurityPolicy};
use async_trait::async_trait;
-use serde_json::{Value, json};
+use serde_json::{json, Value};
use std::path::{Path, PathBuf};
use std::sync::Arc;
use std::time::Duration;
-use tinytools::ToolRunContext;
-use tinytools::{PermissionLevel, Tool, ToolCallOptions, ToolResult, ToolTimeout};
use tinyagents_harness_tools::exec::{
ExecAuditEvent, ExecAuditOutcome, ExecAuthorizationRequest, ExecBackend, ExecBackendCapability,
ExecBackendOutcome, ExecDenied, ExecGate, ExecOperation, ExecOutput, ExecPermit,
ExecRefusalKind, ExecRequest, ExecTool, ShellFlavor,
};
+use tinytools::ToolRunContext;
+use tinytools::{PermissionLevel, Tool, ToolCallOptions, ToolResult, ToolTimeout};
/// Maximum output size in bytes (1MB).
const MAX_OUTPUT_BYTES: usize = 1_048_576;
@@ -140,7 +140,9 @@ impl ShellHost {
impl ShellHost {
fn external_effect_with_args(&self, args: &Value) -> bool {
- args.get("command").and_then(Value::as_str).is_some_and(|command| !command.is_empty())
+ args.get("command")
+ .and_then(Value::as_str)
+ .is_some_and(|command| !command.is_empty())
}
async fn prepare_authorization(&self, args: &Value) -> anyhow::Result<Option<Value>> {
@@ -411,7 +413,9 @@ impl ShellHost {
// the functional variables are passed as approved overrides.
if tinyagents_harness_tools::exec::timeout::CommandEnvironment::is_active() {
for name in crate::sandbox::ops::SANDBOX_ENV_PASSTHROUGH {
- if let Some(value) = tinyagents_harness_tools::exec::timeout::CommandEnvironment::var_os(name) {
+ if let Some(value) =
+ tinyagents_harness_tools::exec::timeout::CommandEnvironment::var_os(name)
+ {
let Ok(value) = value.into_string() else {
return (
false,
@@ -616,12 +620,10 @@ impl ExecGate for ShellPorts {
request: &ExecAuthorizationRequest,
context: Option<&dyn ToolRunContext>,
) -> Result<ExecPermit, ExecDenied> {
- let ExecOperation::Shell {
- command,
- category,
- } = &request.operation
- else {
- return Err(ExecDenied("shell gate received a non-shell operation".into()));
+ let ExecOperation::Shell { command, category } = &request.operation else {
+ return Err(ExecDenied(
+ "shell gate received a non-shell operation".into(),
+ ));
};
// Check policy here before issuing a permit. The execution path repeats
@@ -665,10 +667,9 @@ impl ExecGate for ShellPorts {
fn record(&self, event: ExecAuditEvent) {
let (command, risk_level) = match &event.operation {
- ExecOperation::Shell { command, category } => (
- command.as_str(),
- category.as_deref().unwrap_or("unknown"),
- ),
+ ExecOperation::Shell { command, category } => {
+ (command.as_str(), category.as_deref().unwrap_or("unknown"))
+ }
ExecOperation::Install { .. } => ("<invalid shell operation>", "unknown"),
};
let success = matches!(
@@ -829,12 +830,26 @@ impl ShellTool {
#[async_trait]
impl Tool for ShellTool {
- fn name(&self) -> &str { self.inner.name() }
- fn description(&self) -> &str { self.inner.description() }
- fn parameters_schema(&self) -> Value { self.inner.parameters_schema() }
- fn max_result_size_chars(&self) -> Option<usize> { self.inner.max_result_size_chars() }
- fn timeout_policy(&self, args: &Value) -> ToolTimeout { self.inner.timeout_policy(args) }
- fn permission_level(&self) -> PermissionLevel { self.inner.permission_level() }
+ fn name(&self) -> &str {
+ // Preserve OpenHuman's established model-facing tool contract while
+ // delegating its schema and call behavior to TinyAgents ExecTool.
+ "shell"
+ }
+ fn description(&self) -> &str {
+ self.inner.description()
+ }
+ fn parameters_schema(&self) -> Value {
+ self.inner.parameters_schema()
+ }
+ fn max_result_size_chars(&self) -> Option<usize> {
+ self.inner.max_result_size_chars()
+ }
+ fn timeout_policy(&self, args: &Value) -> ToolTimeout {
+ self.inner.timeout_policy(args)
+ }
+ fn permission_level(&self) -> PermissionLevel {
+ self.inner.permission_level()
+ }
fn external_effect_with_args(&self, args: &Value) -> bool {
self.inner.external_effect_with_args(args)
}
@@ -851,7 +866,9 @@ impl Tool for ShellTool {
context: Option<&dyn ToolRunContext>,
) -> anyhow::Result<ToolResult> {
let _ = &self.host;
- self.inner.execute_with_context(args, options, context).await
+ self.inner
+ .execute_with_context(args, options, context)
+ .await
}
}
diff --git a/crates/openhuman-core/src/tools/impl/system/shell_support.rs b/crates/openhuman-core/src/tools/impl/system/shell_support.rs
index ee53ea43c5..8447400d8d 100644
--- a/crates/openhuman-core/src/tools/impl/system/shell_support.rs
+++ b/crates/openhuman-core/src/tools/impl/system/shell_support.rs
@@ -95,7 +95,8 @@ pub(super) fn container_environment(
crate::sandbox::ops::SANDBOX_ENV_PASSTHROUGH
.iter()
.filter_map(|name| {
- tinyagents_harness_tools::exec::timeout::CommandEnvironment::var_os(name).map(|value| (*name, value))
+ tinyagents_harness_tools::exec::timeout::CommandEnvironment::var_os(name)
+ .map(|value| (*name, value))
})
.collect::<Vec<_>>()
} else {
@@ -108,7 +109,9 @@ pub(super) fn container_environment(
.or_else(|| {
explicit
.is_none()
- .then(|| tinyagents_harness_tools::exec::timeout::CommandEnvironment::var_os(name))
+ .then(|| {
+ tinyagents_harness_tools::exec::timeout::CommandEnvironment::var_os(name)
+ })
.flatten()
})
}));
diff --git a/crates/openhuman-core/src/tools/ops.rs b/crates/openhuman-core/src/tools/ops.rs
index 116f27eeab..eb0eb092ef 100644
--- a/crates/openhuman-core/src/tools/ops.rs
+++ b/crates/openhuman-core/src/tools/ops.rs
@@ -5,14 +5,14 @@ use crate::config::Config;
use crate::modules::tinybox::host_runtime::{NativeRuntime, RuntimeAdapter};
use crate::security::{AuditLogger, SecurityPolicy};
use std::sync::Arc;
-use tinyagents_harness_tools::{CurrentTimeTool, ResolveTimeTool};
-use tinytools::Tool;
use tinyagents_harness_tools::exec::detect_tools::DetectToolsTool;
use tinyagents_harness_tools::fs::filesystem::{
ApplyPatchTool, CsvExportTool, EditFileTool, FileReadTool, FileWriteTool, GitOperationsTool,
GlobTool, GrepTool, ImageInfoTool, ListFilesTool, ReadDiffTool, RunLinterTool, RunTestsTool,
};
use tinyagents_harness_tools::net::network::PushoverTool;
+use tinyagents_harness_tools::{CurrentTimeTool, ResolveTimeTool};
+use tinytools::Tool;
/// Create the default tool registry
pub fn default_tools(security: Arc<SecurityPolicy>) -> Vec<Box<dyn Tool>> {
diff --git a/crates/openhuman-core/src/tools/per_call_tests.rs b/crates/openhuman-core/src/tools/per_call_tests.rs
index 06cc9afdf4..8612988d74 100644
--- a/crates/openhuman-core/src/tools/per_call_tests.rs
+++ b/crates/openhuman-core/src/tools/per_call_tests.rs
@@ -1,10 +1,10 @@
use super::*;
-use async_trait::async_trait;
use crate::agent::tinyagents::host::run_context::tool_context_with_approval;
use crate::security::approval::ApprovalTurnContext;
+use async_trait::async_trait;
use serde_json::json;
-use tinytools::{PermissionLevel, Tool, ToolCallOptions, ToolResult};
use serde_json::Value;
+use tinytools::{PermissionLevel, Tool, ToolCallOptions, ToolResult};
/// Reports the chat it was built for, so a test can see which call built it.
struct Probe {
diff --git a/crates/openhuman-embed/src/turn_control.rs b/crates/openhuman-embed/src/turn_control.rs
index 3b5aacb900..9715eb0a5c 100644
--- a/crates/openhuman-embed/src/turn_control.rs
+++ b/crates/openhuman-embed/src/turn_control.rs
@@ -28,11 +28,12 @@ impl Turn {
let dispatch = Box::pin(self.send_scoped());
match environment {
Some(environment) => {
- let command_environment = tinyagents_harness_tools::exec::timeout::CommandEnvironment::new(
- environment
- .iter()
- .map(|(name, value)| (name.clone(), value.clone())),
- );
+ let command_environment =
+ tinyagents_harness_tools::exec::timeout::CommandEnvironment::new(
+ environment
+ .iter()
+ .map(|(name, value)| (name.clone(), value.clone())),
+ );
command_environment.scope(dispatch).await
}
None => dispatch.await,