Skip to content

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

chore(flows): apply rustfmt formatting and drop unused mock re-export

Steven Enamakelb890fb5427e4
diff --git a/crates/openhuman-core/src/flows/copilot_bus.rs b/crates/openhuman-core/src/flows/copilot_bus.rs
index dc1e7fd09f..38ea499d44 100644
--- a/crates/openhuman-core/src/flows/copilot_bus.rs
+++ b/crates/openhuman-core/src/flows/copilot_bus.rs
@@ -60,7 +60,10 @@ impl CopilotToolCatalog {
descriptor.name, descriptor.permission
)
})?;
- if by_name.insert(descriptor.name.clone(), descriptor).is_some() {
+ if by_name
+ .insert(descriptor.name.clone(), descriptor)
+ .is_some()
+ {
return Err("TinyFlows Copilot returned duplicate tool names".into());
}
}
diff --git a/crates/openhuman-core/src/flows/copilot_bus_tests.rs b/crates/openhuman-core/src/flows/copilot_bus_tests.rs
index 1369097a3a..c8aef79001 100644
--- a/crates/openhuman-core/src/flows/copilot_bus_tests.rs
+++ b/crates/openhuman-core/src/flows/copilot_bus_tests.rs
@@ -10,10 +10,7 @@ async fn module_tool_descriptors_preserve_run_and_sandbox_safety_metadata() {
let run = catalog.tool("run_flow").expect("run_flow is catalogued");
assert_eq!(run.permission_level(), PermissionLevel::Write);
assert!(run.external_effect());
- assert_eq!(
- run.parameters_schema()["required"],
- json!(["flow_id"])
- );
+ assert_eq!(run.parameters_schema()["required"], json!(["flow_id"]));
let dry_run = catalog
.tool("dry_run_workflow")
diff --git a/crates/openhuman-core/src/flows/mod.rs b/crates/openhuman-core/src/flows/mod.rs
index 6e69dbba76..e0b8c4e622 100644
--- a/crates/openhuman-core/src/flows/mod.rs
+++ b/crates/openhuman-core/src/flows/mod.rs
@@ -26,11 +26,11 @@
mod agent_route;
pub mod agents;
pub mod builder_host;
-mod copilot_bus;
pub(crate) mod builder_tools;
mod builder_tools_connection_reads;
pub mod bus;
pub mod catalogue;
+mod copilot_bus;
mod draft_store;
pub mod memory_tools;
pub mod node_contracts;
@@ -67,6 +67,6 @@ pub use {node_contracts::all_node_kind_contracts, node_contracts::node_kind_cont
// subscriber, `flows_delete` and the tinyflows `memory` node adapter reach the
// same helpers through these re-exports so every caller tags identically.
pub use memory_tools::{
- cross_flow_filter, flow_filter, flow_key_of, flow_key_tag, flow_meta, flow_tag,
- forget_matching, remember_keyed, FLOWS_TAG,
+ FLOWS_TAG, cross_flow_filter, flow_filter, flow_key_of, flow_key_tag, flow_meta, flow_tag,
+ forget_matching, remember_keyed,
};
diff --git a/crates/openhuman-core/src/flows/ops/approval_manifest.rs b/crates/openhuman-core/src/flows/ops/approval_manifest.rs
index 50d9ab3d01..238ec30ec3 100644
--- a/crates/openhuman-core/src/flows/ops/approval_manifest.rs
+++ b/crates/openhuman-core/src/flows/ops/approval_manifest.rs
@@ -38,7 +38,7 @@ pub async fn compute_approval_manifest(config: &Config, graph: &WorkflowGraph) -
use crate::security::{GateDecision, SecurityPolicy};
use tinybox_bus::CommandClass;
use tinyflows_catalog::approval_manifest::{
- assemble_manifest, manifest_candidates, ManifestCandidate, ManifestClass,
+ ManifestCandidate, ManifestClass, assemble_manifest, manifest_candidates,
};
let security =
diff --git a/crates/openhuman-core/src/flows/ops/builder.rs b/crates/openhuman-core/src/flows/ops/builder.rs
index 7896f18ce8..3f3adc022f 100644
--- a/crates/openhuman-core/src/flows/ops/builder.rs
+++ b/crates/openhuman-core/src/flows/ops/builder.rs
@@ -370,9 +370,7 @@ pub(crate) async fn flows_build_with_extra_hidden_tools(
// that makes it a hard invariant regardless of model behavior — the user
// is NEVER left with silence or an unanswerable status note.
let trail_off = !capped && proposal.is_none() && run_error.is_none();
- let assistant_text = if trail_off
- && !text_looks_like_question(config, &assistant_text).await?
- {
+ let assistant_text = if trail_off && !text_looks_like_question(config, &assistant_text).await? {
let runtime_history = agent.history();
let fallback = build_trail_off_fallback(config, &runtime_history).await?;
let combined = combine_trail_off_fallback(config, &fallback, &assistant_text).await?;
@@ -499,4 +497,3 @@ pub(crate) fn start_builder_turn_clean(agent: &mut crate::agent::OpenHumanSessio
..Default::default()
});
}
-
diff --git a/crates/openhuman-core/src/flows/ops/builder_gates.rs b/crates/openhuman-core/src/flows/ops/builder_gates.rs
index 46b90f1ff9..3f2784ad84 100644
--- a/crates/openhuman-core/src/flows/ops/builder_gates.rs
+++ b/crates/openhuman-core/src/flows/ops/builder_gates.rs
@@ -403,7 +403,7 @@ pub(crate) async fn validate_agent_refs(
) -> Vec<String> {
use crate::agent::harness::host_definition::AgentDefinitionRegistry;
use crate::agent::registry::AgentRegistryEntry;
- use crate::flows::agent_route::{route_for_agent_ref, AgentRoute};
+ use crate::flows::agent_route::{AgentRoute, route_for_agent_ref};
let mut errors = Vec::new();
let mut harness_registry_init_attempted = false;
diff --git a/crates/openhuman-core/src/flows/ops/trail_off.rs b/crates/openhuman-core/src/flows/ops/trail_off.rs
index 09ecd23596..3677b29d7a 100644
--- a/crates/openhuman-core/src/flows/ops/trail_off.rs
+++ b/crates/openhuman-core/src/flows/ops/trail_off.rs
@@ -44,12 +44,9 @@ pub(super) async fn combine_trail_off_fallback(
fallback: &str,
original: &str,
) -> Result<String, String> {
- let response: TextResponse = crate::flows::copilot_bus::call(
- config,
- "CombineTrailOffFallback",
- (fallback, original),
- )
- .await?;
+ let response: TextResponse =
+ crate::flows::copilot_bus::call(config, "CombineTrailOffFallback", (fallback, original))
+ .await?;
Ok(response.text)
}
diff --git a/crates/openhuman-core/src/flows/ops/validation.rs b/crates/openhuman-core/src/flows/ops/validation.rs
index c57fdbbb11..8e1fb236c8 100644
--- a/crates/openhuman-core/src/flows/ops/validation.rs
+++ b/crates/openhuman-core/src/flows/ops/validation.rs
@@ -201,7 +201,7 @@ pub fn flows_import(
graph_json: Value,
format: Option<String>,
) -> Result<Outcome<tinyflows_catalog::FlowImport>, String> {
- use tinyflows_catalog::{import::n8n as n8n_import, FlowImport};
+ use tinyflows_catalog::{FlowImport, import::n8n as n8n_import};
let requested = format
.as_deref()
@@ -215,7 +215,7 @@ pub fn flows_import(
other => {
return Err(format!(
"unknown import format '{other}' (expected 'native' or 'n8n')"
- ))
+ ));
}
};
tracing::debug!(
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 af1242364e..36136df267 100644
--- a/crates/openhuman-core/src/flows/ops_builder_repair_tests.rs
+++ b/crates/openhuman-core/src/flows/ops_builder_repair_tests.rs
@@ -2,41 +2,64 @@ use super::*;
use crate::core::runtime::DispatchCtx;
use crate::{
config::Config,
- flows::{
- ops::{
- builder::{backend_repair_message, is_backend_or_infrastructure_failure},
- flows_build_with_extra_hidden_tools, FlowStreamTarget,
- },
+ flows::ops::{
+ FlowStreamTarget,
+ builder::{backend_repair_message, is_backend_or_infrastructure_failure},
+ flows_build_with_extra_hidden_tools,
},
};
#[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]
@@ -91,10 +114,12 @@ 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 {
@@ -122,10 +147,11 @@ 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/flows/ops_builder_trail_off_tests.rs b/crates/openhuman-core/src/flows/ops_builder_trail_off_tests.rs
index 8cc179faf2..7f858bc333 100644
--- a/crates/openhuman-core/src/flows/ops_builder_trail_off_tests.rs
+++ b/crates/openhuman-core/src/flows/ops_builder_trail_off_tests.rs
@@ -390,7 +390,9 @@ async fn combine_trail_off_fallback_returns_fallback_alone_for_genuine_silence()
let config = Config::default();
let fallback = build_trail_off_fallback(&config, &[]).await.unwrap();
assert_eq!(
- combine_trail_off_fallback(&config, &fallback, "").await.unwrap(),
+ combine_trail_off_fallback(&config, &fallback, "")
+ .await
+ .unwrap(),
fallback
);
assert_eq!(
diff --git a/crates/openhuman-core/src/flows/ops_connection_ref_gate_tests.rs b/crates/openhuman-core/src/flows/ops_connection_ref_gate_tests.rs
index 859dbb0eb5..d25893c531 100644
--- a/crates/openhuman-core/src/flows/ops_connection_ref_gate_tests.rs
+++ b/crates/openhuman-core/src/flows/ops_connection_ref_gate_tests.rs
@@ -454,8 +454,8 @@ async fn validate_required_arg_resolvability_rejects_an_explicit_nodes_reference
}
/// A required tool arg wired to a PLAIN agent node's (`no agent_ref`)
-/// `output_parser.schema` field must pass this sandbox gate: the schema-aware
-/// mock LLM (wired above via `caps.llm = SchemaAwareMockLlm`) synthesizes a
+/// `output_parser.schema` field must pass this sandbox gate: the module's
+/// schema-aware mock LLM synthesizes a
/// schema-valid completion, so the agent's output-parser sub-port succeeds and
/// the downstream `=nodes.<agent>.item.json.<field>` binding resolves to a typed
/// placeholder (non-null) instead of the run aborting on a schema-validation
diff --git a/crates/openhuman-core/src/flows/registration.rs b/crates/openhuman-core/src/flows/registration.rs
index db99797eda..52986b8dca 100644
--- a/crates/openhuman-core/src/flows/registration.rs
+++ b/crates/openhuman-core/src/flows/registration.rs
@@ -1,7 +1,7 @@
//! Registration of flow authoring, execution, discovery, and memory tools.
-use super::copilot_bus::CopilotToolCatalog;
use super::builder_tools_connection_reads::FlowsConnectionProvider;
+use super::copilot_bus::CopilotToolCatalog;
use super::memory_tools::{FlowMemoryRecallTool, FlowMemoryRememberTool};
use crate::config::Config;
use crate::security::SecurityPolicy;
@@ -18,7 +18,9 @@ fn push_copilot_tool(
};
match catalog.tool(name) {
Ok(tool) => tools.push(Box::new(tool)),
- Err(error) => tracing::error!(tool = name, %error, "[flows] Copilot tool missing from module catalogue"),
+ Err(error) => {
+ tracing::error!(tool = name, %error, "[flows] Copilot tool missing from module catalogue")
+ }
}
}
@@ -52,10 +54,12 @@ pub(crate) fn tools(config: Arc<Config>, security: &Arc<SecurityPolicy>) -> Vec<
push_copilot_tool(&mut tools, copilot.as_ref(), name);
}
- tools.push(Box::new(crate::integrations::composio::builder_tools::ListFlowConnectionsTool::new(
- config.clone(),
- Arc::new(FlowsConnectionProvider),
- )));
+ tools.push(Box::new(
+ crate::integrations::composio::builder_tools::ListFlowConnectionsTool::new(
+ config.clone(),
+ Arc::new(FlowsConnectionProvider),
+ ),
+ ));
tools.push(Box::new(
crate::integrations::composio::builder_tools::SearchToolCatalogTool::new(config.clone()),
));
@@ -66,9 +70,7 @@ pub(crate) fn tools(config: Arc<Config>, security: &Arc<SecurityPolicy>) -> Vec<
crate::integrations::composio::builder_tools::GetToolOutputSampleTool::new(config.clone()),
));
- for name in [
- "list_agent_definitions",
- ] {
+ for name in ["list_agent_definitions"] {
push_copilot_tool(&mut tools, copilot.as_ref(), name);
}
tools.push(Box::new(
diff --git a/crates/openhuman-core/src/flows/tinyflows/caps/mod.rs b/crates/openhuman-core/src/flows/tinyflows/caps/mod.rs
index 49a8b236f3..1ccab28ba6 100644
--- a/crates/openhuman-core/src/flows/tinyflows/caps/mod.rs
+++ b/crates/openhuman-core/src/flows/tinyflows/caps/mod.rs
@@ -19,16 +19,11 @@ pub(crate) use agent::*;
pub(crate) use code::*;
pub(crate) use http::*;
pub(crate) use llm::*;
-// The schema-aware dry-run doubles are `tinyflows::caps::mock_schema_aware`'s:
-// "answer the shape this node declared" is a fact about the engine's own
-// output-parser sub-port, not about OpenHuman. Re-exported under the historical
-// `caps::` path so existing call sites resolve unchanged.
pub use ops::*;
pub(crate) use prompt::*;
// The pure prompt/reply helpers live upstream, beside the agent request builder.
pub(crate) use resolver::*;
pub(crate) use tier::*;
-pub(crate) use tinyflows::caps::mock_schema_aware::*;
pub(crate) use tinyflows::nodes::integration::agent_prompt::{
build_agent_result, build_harness_run_prompt, clamp_run_timeout_secs, extract_structured_json,
prepend_system_message, resolve_node_model, resolve_run_timeout_secs,
diff --git a/crates/openhuman-core/src/modules/tinyflows.rs b/crates/openhuman-core/src/modules/tinyflows.rs
index 62279a7d46..4f6ee6b3ca 100644
--- a/crates/openhuman-core/src/modules/tinyflows.rs
+++ b/crates/openhuman-core/src/modules/tinyflows.rs
@@ -42,7 +42,7 @@ pub(crate) fn disabled_message() -> String {
#[cfg(feature = "modules")]
mod imp {
- use super::{disabled_message, HOST_BUS_NAME, MODULE_ID};
+ use super::{HOST_BUS_NAME, MODULE_ID, disabled_message};
use crate::config::Config;
#[cfg(not(test))]
use crate::modules::ops;
@@ -188,7 +188,7 @@ mod imp {
mod fixture;
#[cfg(feature = "modules")]
- pub(crate) use imp::{copilot_proxy, proxy, run_proxy, serve, unserve};
+pub(crate) use imp::{copilot_proxy, proxy, run_proxy, serve, unserve};
#[cfg(not(feature = "modules"))]
mod imp {