Skip to content

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

style: format composio scope gate and connector code

Steven Enamakel820a6230a37f
diff --git a/crates/openhuman-core/src/integrations/composio/ops_route_parity_tests.rs b/crates/openhuman-core/src/integrations/composio/ops_route_parity_tests.rs
index a09f46abd4..4f26b81ebf 100644
--- a/crates/openhuman-core/src/integrations/composio/ops_route_parity_tests.rs
+++ b/crates/openhuman-core/src/integrations/composio/ops_route_parity_tests.rs
@@ -17,9 +17,7 @@ fn parity_router() -> Router {
// Hosted backend route.
.route(
"/agent-integrations/composio/toolkits",
- get(|| async {
- Json(json!({"success": true, "data": {"toolkits": ["gmail"]}}))
- }),
+ get(|| async { Json(json!({"success": true, "data": {"toolkits": ["gmail"]}})) }),
)
.route(
"/agent-integrations/composio/connections",
@@ -42,10 +40,17 @@ fn parity_router() -> Router {
]}))
}),
)
- .route("/tools", get(|| async { Json(json!({"items": direct_tools()})) }))
+ .route(
+ "/tools",
+ get(|| async { Json(json!({"items": direct_tools()})) }),
+ )
}
-const SLUGS: [&str; 3] = ["GMAIL_FETCH_EMAILS", "GMAIL_SEND_EMAIL", "GMAIL_DELETE_MESSAGE"];
+const SLUGS: [&str; 3] = [
+ "GMAIL_FETCH_EMAILS",
+ "GMAIL_SEND_EMAIL",
+ "GMAIL_DELETE_MESSAGE",
+];
fn backend_tools() -> Vec<Value> {
SLUGS
diff --git a/crates/openhuman-core/src/integrations/composio/tools/scope_gate.rs b/crates/openhuman-core/src/integrations/composio/tools/scope_gate.rs
index 8f417bbc13..3a0a7622fe 100644
--- a/crates/openhuman-core/src/integrations/composio/tools/scope_gate.rs
+++ b/crates/openhuman-core/src/integrations/composio/tools/scope_gate.rs
@@ -86,12 +86,8 @@ pub(super) async fn evaluate_tool_visibility(config: &Config, slug: &str) -> Too
toolkit: toolkit.clone(),
preference: None,
};
- match connectors::call::<_, VisibleToolsResponse>(
- config,
- methods::LIST_VISIBLE_TOOLS,
- request,
- )
- .await
+ match connectors::call::<_, VisibleToolsResponse>(config, methods::LIST_VISIBLE_TOOLS, request)
+ .await
{
Ok(visible) => decide_from_visible(slug, &visible),
Err(error) => {
diff --git a/crates/openhuman-core/src/integrations/composio/tools/scope_gate_tests.rs b/crates/openhuman-core/src/integrations/composio/tools/scope_gate_tests.rs
index 3beff90641..f8160c8e78 100644
--- a/crates/openhuman-core/src/integrations/composio/tools/scope_gate_tests.rs
+++ b/crates/openhuman-core/src/integrations/composio/tools/scope_gate_tests.rs
@@ -61,7 +61,12 @@ fn the_scope_error_names_the_toolkit_and_the_unlock_path() {
assert!(message.contains("write=false"), "{message}");
}
-fn visible(toolkit: &str, has_catalog: bool, slugs: &[&str], pref: UserScopePref) -> VisibleToolsResponse {
+fn visible(
+ toolkit: &str,
+ has_catalog: bool,
+ slugs: &[&str],
+ pref: UserScopePref,
+) -> VisibleToolsResponse {
VisibleToolsResponse {
toolkit: toolkit.to_owned(),
preference: pref,
@@ -79,7 +84,12 @@ fn visible(toolkit: &str, has_catalog: bool, slugs: &[&str], pref: UserScopePref
#[test]
fn a_slug_in_the_modules_visible_list_is_allowed_regardless_of_case() {
- let listing = visible("gmail", true, &["GMAIL_SEND_EMAIL"], UserScopePref::default());
+ let listing = visible(
+ "gmail",
+ true,
+ &["GMAIL_SEND_EMAIL"],
+ UserScopePref::default(),
+ );
assert!(matches!(
decide_from_visible("gmail_send_email", &listing),
ToolDecision::Allow
diff --git a/crates/openhuman-core/src/modules/connectors.rs b/crates/openhuman-core/src/modules/connectors.rs
index eb07944e23..7d0b3e38b9 100644
--- a/crates/openhuman-core/src/modules/connectors.rs
+++ b/crates/openhuman-core/src/modules/connectors.rs
@@ -202,9 +202,7 @@ fn route_config(config: &Config) -> Result<serde_json::Value, String> {
/// boot when it was already serving from the search path. A failure only
/// delays the snapshot: the next connector call primes it again.
pub async fn prime_catalogs(config: &Config) {
- if let Err(error) =
- crate::integrations::composio::contract::curated::prime(config).await
- {
+ if let Err(error) = crate::integrations::composio::contract::curated::prime(config).await {
tracing::debug!("[connectors] catalog prime failed: {error}");
}
}
diff --git a/crates/openhuman-core/src/modules/connectors_tests.rs b/crates/openhuman-core/src/modules/connectors_tests.rs
index 2936d4a339..25e8926096 100644
--- a/crates/openhuman-core/src/modules/connectors_tests.rs
+++ b/crates/openhuman-core/src/modules/connectors_tests.rs
@@ -290,7 +290,10 @@ fn an_unconfigured_route_still_carries_the_offered_toolkit_policy() {
// module falls back to must not drop the operator's policy.
assert!(module_config(&config).is_err());
let fallback = super::ops::module_config_for_test(&config, MODULE_ID);
- assert_eq!(fallback["offered_toolkits"]["deny"], serde_json::json!(["twitter"]));
+ assert_eq!(
+ fallback["offered_toolkits"]["deny"],
+ serde_json::json!(["twitter"])
+ );
}
#[test]