Skip to content

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

style: apply rustfmt import ordering and line wrapping

Steven Enamakelc95d52e1f674
diff --git a/crates/openhuman-core/src/agent/orchestration/tools.rs b/crates/openhuman-core/src/agent/orchestration/tools.rs
index cf6dc032c3..a1842782c7 100644
--- a/crates/openhuman-core/src/agent/orchestration/tools.rs
+++ b/crates/openhuman-core/src/agent/orchestration/tools.rs
@@ -43,10 +43,10 @@ mod spawn_parallel_agents;
mod spawn_subagent;
#[path = "tools/spawn_worker_thread.rs"]
pub mod spawn_worker_thread;
-#[path = "tools/structured_payload.rs"]
-pub(crate) mod structured_payload;
#[path = "tools/steer_subagent.rs"]
mod steer_subagent;
+#[path = "tools/structured_payload.rs"]
+pub(crate) mod structured_payload;
#[path = "tools/subagent_abort_report.rs"]
mod subagent_abort_report;
#[cfg(test)]
diff --git a/crates/openhuman-core/src/flows/builder_host.rs b/crates/openhuman-core/src/flows/builder_host.rs
index 23bfab905c..4ea4109439 100644
--- a/crates/openhuman-core/src/flows/builder_host.rs
+++ b/crates/openhuman-core/src/flows/builder_host.rs
@@ -4,7 +4,7 @@ use std::future::Future;
use std::sync::Arc;
use serde::de::DeserializeOwned;
-use serde_json::{Value, json};
+use serde_json::{json, Value};
use tinybus::Result as BusResult;
use tinyflows_bus::copilot::{self, CopilotHost, PortOperation};
@@ -303,7 +303,12 @@ impl FlowsHost {
#[tinybus::interface(name = "ai.tinyhumans.tinyflows.CapsHost")]
impl CopilotCapsHost {
/// Validate mock tool arguments only; sandbox results stay module-owned.
- async fn tool_invoke(&self, slug: String, args: Value, _connection: Option<String>) -> BusResult<Value> {
+ async fn tool_invoke(
+ &self,
+ slug: String,
+ args: Value,
+ _connection: Option<String>,
+ ) -> BusResult<Value> {
self.0
.preflight_tool(slug, args)
.await
diff --git a/crates/openhuman-core/src/flows/copilot_bus.rs b/crates/openhuman-core/src/flows/copilot_bus.rs
index 4b3c9c119e..53a704009c 100644
--- a/crates/openhuman-core/src/flows/copilot_bus.rs
+++ b/crates/openhuman-core/src/flows/copilot_bus.rs
@@ -3,7 +3,7 @@
use std::collections::HashMap;
use std::sync::Arc;
-use serde::{Serialize, de::DeserializeOwned};
+use serde::{de::DeserializeOwned, Serialize};
use serde_json::Value;
use tinyflows_bus::copilot::{ToolCatalogRequest, ToolDescriptor};
use tinytools::{PermissionLevel, Tool, ToolResult};
diff --git a/crates/openhuman-core/src/flows/copilot_bus_tests.rs b/crates/openhuman-core/src/flows/copilot_bus_tests.rs
index 942e8cdd26..31830c209b 100644
--- a/crates/openhuman-core/src/flows/copilot_bus_tests.rs
+++ b/crates/openhuman-core/src/flows/copilot_bus_tests.rs
@@ -138,8 +138,8 @@ async fn module_run_flow_uses_the_host_detached_runner_and_requires_a_saved_flow
config.action_dir = config.workspace_dir.clone();
config.config_path = workspace.path().join("config.toml");
std::fs::create_dir_all(&config.workspace_dir).expect("workspace directory");
- let catalog = CopilotToolCatalog::load(Arc::new(config.clone()))
- .expect("module tool catalog loads");
+ let catalog =
+ CopilotToolCatalog::load(Arc::new(config.clone())).expect("module tool catalog loads");
let tool = catalog.tool("run_flow").expect("run_flow is catalogued");
let missing = tool
@@ -147,7 +147,11 @@ async fn module_run_flow_uses_the_host_detached_runner_and_requires_a_saved_flow
.await
.expect("missing flow is a reported tool failure");
assert!(missing.is_error, "{}", missing.output());
- assert!(missing.output().contains("not-saved"), "{}", missing.output());
+ assert!(
+ missing.output().contains("not-saved"),
+ "{}",
+ missing.output()
+ );
let flow = crate::flows::ops::flows_create(
&crate::core::runtime::DispatchCtx::ambient(),
@@ -182,8 +186,8 @@ async fn module_proposal_tool_uses_host_gates_without_persisting() {
config.action_dir = config.workspace_dir.clone();
config.config_path = workspace.path().join("config.toml");
std::fs::create_dir_all(&config.workspace_dir).expect("workspace directory");
- let catalog = CopilotToolCatalog::load(Arc::new(config.clone()))
- .expect("module tool catalog loads");
+ let catalog =
+ CopilotToolCatalog::load(Arc::new(config.clone())).expect("module tool catalog loads");
let tool = catalog
.tool("propose_workflow")
.expect("propose_workflow is catalogued");
diff --git a/crates/openhuman-core/src/flows/ops/discovery.rs b/crates/openhuman-core/src/flows/ops/discovery.rs
index 45a7e08d88..adae05f5bc 100644
--- a/crates/openhuman-core/src/flows/ops/discovery.rs
+++ b/crates/openhuman-core/src/flows/ops/discovery.rs
@@ -51,8 +51,8 @@ pub async fn flows_discover(
config: &Config,
stream: Option<FlowStreamTarget>,
) -> Result<Outcome<Vec<FlowSuggestion>>, String> {
+ use crate::agent::turn_origin::{with_origin, AgentTurnOrigin};
use crate::agent::OpenHumanSessionHost;
- use crate::agent::turn_origin::{AgentTurnOrigin, with_origin};
tracing::info!(
target: "flows",
diff --git a/crates/openhuman-core/src/flows/ops_builder_repair_tests.rs b/crates/openhuman-core/src/flows/ops_builder_repair_tests.rs
index 8ad1591bdd..0319800102 100644
--- a/crates/openhuman-core/src/flows/ops_builder_repair_tests.rs
+++ b/crates/openhuman-core/src/flows/ops_builder_repair_tests.rs
@@ -3,60 +3,48 @@ use super::*;
use crate::core::runtime::DispatchCtx;
use crate::{
config::Config,
- flows::ops::{FlowStreamTarget, flows_build_with_extra_hidden_tools},
+ flows::ops::{flows_build_with_extra_hidden_tools, FlowStreamTarget},
};
#[tokio::test]
async fn classifies_backend_failures_without_classifying_graph_timeouts() {
let config = Config::default();
- assert!(
- is_backend_or_infrastructure_failure(
- &config,
- "File upload failed: Backend returned 500 Internal Server Error"
- )
- .await
- .unwrap()
- );
- assert!(
- !is_backend_or_infrastructure_failure(
- &config,
- "File upload failed: Backend returned 400 Bad Request"
- )
- .await
- .unwrap()
- );
- assert!(
- is_backend_or_infrastructure_failure(
- &config,
- "connection timed out while calling file storage"
- )
- .await
- .unwrap()
- );
- assert!(
- is_backend_or_infrastructure_failure(
- &config,
- "POST https://api.example.test/files failed: connection timed out"
- )
- .await
- .unwrap()
- );
- assert!(
- !is_backend_or_infrastructure_failure(
- &config,
- "agent node fetch_profile timed out after 30 seconds"
- )
- .await
- .unwrap()
- );
- assert!(
- !is_backend_or_infrastructure_failure(
- &config,
- "required argument resolved null: nodes.get_link.item.json.url"
- )
- .await
- .unwrap()
- );
+ assert!(is_backend_or_infrastructure_failure(
+ &config,
+ "File upload failed: Backend returned 500 Internal Server Error"
+ )
+ .await
+ .unwrap());
+ assert!(!is_backend_or_infrastructure_failure(
+ &config,
+ "File upload failed: Backend returned 400 Bad Request"
+ )
+ .await
+ .unwrap());
+ assert!(is_backend_or_infrastructure_failure(
+ &config,
+ "connection timed out while calling file storage"
+ )
+ .await
+ .unwrap());
+ assert!(is_backend_or_infrastructure_failure(
+ &config,
+ "POST https://api.example.test/files failed: connection timed out"
+ )
+ .await
+ .unwrap());
+ assert!(!is_backend_or_infrastructure_failure(
+ &config,
+ "agent node fetch_profile timed out after 30 seconds"
+ )
+ .await
+ .unwrap());
+ assert!(!is_backend_or_infrastructure_failure(
+ &config,
+ "required argument resolved null: nodes.get_link.item.json.url"
+ )
+ .await
+ .unwrap());
}
#[tokio::test]
@@ -68,15 +56,13 @@ async fn backend_repair_message_explains_why_the_graph_was_preserved() {
assert!(message.contains("workflow was not changed"));
assert!(message.contains("HTTP 503 from file storage"));
- assert!(
- backend_repair_message(
- &Config::default(),
- "agent node fetch_profile timed out after 30 seconds",
- )
- .await
- .unwrap()
- .is_none()
- );
+ assert!(backend_repair_message(
+ &Config::default(),
+ "agent node fetch_profile timed out after 30 seconds",
+ )
+ .await
+ .unwrap()
+ .is_none());
}
#[test]
@@ -111,12 +97,10 @@ fn repair_backend_failure_returns_no_proposal_before_starting_the_builder() {
assert_eq!(outcome.value["proposal"], Value::Null);
assert_eq!(outcome.value["error"], Value::Null);
- assert!(
- outcome.value["assistant_text"]
- .as_str()
- .expect("assistant text")
- .contains("workflow was not changed")
- );
+ assert!(outcome.value["assistant_text"]
+ .as_str()
+ .expect("assistant text")
+ .contains("workflow was not changed"));
let request_id = format!("backend-repair-{}", uuid::Uuid::new_v4());
let stream = FlowStreamTarget {
@@ -144,11 +128,10 @@ fn repair_backend_failure_returns_no_proposal_before_starting_the_builder() {
};
assert_eq!(done.event, "chat_done");
assert_eq!(done.thread_id, "backend-repair-thread");
- assert!(
- done.full_response
- .as_deref()
- .expect("terminal response text")
- .contains("workflow was not changed")
- );
+ assert!(done
+ .full_response
+ .as_deref()
+ .expect("terminal response text")
+ .contains("workflow was not changed"));
});
}
diff --git a/crates/openhuman-core/src/modules/tinyflows.rs b/crates/openhuman-core/src/modules/tinyflows.rs
index f3658bbb61..63ade4aa96 100644
--- a/crates/openhuman-core/src/modules/tinyflows.rs
+++ b/crates/openhuman-core/src/modules/tinyflows.rs
@@ -44,7 +44,7 @@ pub(crate) fn disabled_message() -> String {
mod imp {
#[cfg(not(test))]
use super::MODULE_ID;
- use super::{HOST_BUS_NAME, disabled_message};
+ use super::{disabled_message, HOST_BUS_NAME};
use crate::config::Config;
#[cfg(not(test))]
use crate::modules::ops;
diff --git a/tests/json_rpc_e2e.rs b/tests/json_rpc_e2e.rs
index 7067993be8..9ade01e7bd 100644
--- a/tests/json_rpc_e2e.rs
+++ b/tests/json_rpc_e2e.rs
@@ -11541,7 +11541,7 @@ async fn json_rpc_flows_full_arc_discover_build_create_run_inner() {
"scripted suggestion should be persisted: {listed:?}"
);
- // ── 2. flows_build: the builder scripts a propose_workflow tool call ──
+ // ── 2. flows_build: the builder exercises the Copilot bus and sandbox ──
clear_forced_chat_completions();
with_chat_completion_requests(|requests| requests.clear());
let demo_graph = opus_sonnet_demo_graph();