Skip to content

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

feat(integrations): add contract module for Composio catalog

Steven Enamakel5a7f1a385ec3
diff --git a/crates/openhuman-core/src/integrations/composio/catalog/contract.rs b/crates/openhuman-core/src/integrations/composio/catalog/contract.rs
index eb96bd62d0..1506595c4e 100644
--- a/crates/openhuman-core/src/integrations/composio/catalog/contract.rs
+++ b/crates/openhuman-core/src/integrations/composio/catalog/contract.rs
@@ -6,9 +6,9 @@
use serde_json::Value;
use crate::config::Config;
-use crate::integrations::composio::client::{
- create_composio_client, direct_list_tools, ComposioClientKind,
-};
+use crate::integrations::composio::client::{direct_list_tools, resolve_composio_route, ComposioRoute};
+use crate::integrations::composio::module_client::{self as connectors, methods};
+use crate::integrations::composio::types::{ComposioListToolsRequest, ComposioToolsResponse};
use crate::json_schema::{compute_primary_array_path, response_fields_from_schema};
/// One Composio action's LIVE, ground-truth contract — the source of truth
@@ -193,7 +193,8 @@ pub(crate) fn seed_live_catalog_cache_expired(toolkit: &str, contracts: Vec<Tool
);
}
-/// Fetches a toolkit's tool schemas STRAIGHT from the Composio client,
+/// Fetches a toolkit's tool schemas STRAIGHT from the connector module (or, in
+/// direct mode, the host-side v3 reader),
/// deliberately bypassing `composio::ops::composio_list_tools`'s curated-
/// whitelist filter (Direct mode's `filter_list_tools_response_for_direct` —
/// Backend mode's branch of `composio_list_tools` never filters at all, so
@@ -202,7 +203,7 @@ pub(crate) fn seed_live_catalog_cache_expired(toolkit: &str, contracts: Vec<Tool
/// not, curated or not), not the narrower curated subset the pre-fix
/// `search_tool_catalog` searched.
///
-/// - **Backend mode** calls [`crate::integrations::composio::client::ComposioClient::list_tools`]
+/// - **Backend mode** calls the module's `ListTools` member
/// directly — already unfiltered (`composio_list_tools`'s backend branch
/// applies no filter either), so this is not a behavior change there.
/// - **Direct mode** calls [`direct_list_tools`] directly instead of going
@@ -216,23 +217,30 @@ pub(crate) fn seed_live_catalog_cache_expired(toolkit: &str, contracts: Vec<Tool
async fn fetch_raw_toolkit_tools(
config: &Config,
toolkit: &str,
-) -> Option<crate::integrations::composio::types::ComposioToolsResponse> {
- let kind = create_composio_client(config)
+) -> Option<ComposioToolsResponse> {
+ let kind = resolve_composio_route(config)
.map_err(|e| {
tracing::debug!(target: "flows", %toolkit, error = %e, "[flows] live catalog: composio client unavailable — skipping");
e
})
.ok()?;
match kind {
- ComposioClientKind::Backend(client) => client
- .list_tools(Some(&[toolkit.to_string()]), None)
- .await
+ ComposioRoute::Backend => connectors::call::<_, ComposioToolsResponse>(
+ config,
+ methods::LIST_TOOLS,
+ ComposioListToolsRequest {
+ toolkits: vec![toolkit.to_string()],
+ tags: Vec::new(),
+ apply_user_scopes: false,
+ },
+ )
+ .await
.map_err(|e| {
tracing::debug!(target: "flows", %toolkit, error = %e, "[flows] live catalog: backend fetch failed — skipping");
e
})
.ok(),
- ComposioClientKind::Direct(tool) => direct_list_tools(&tool, &[toolkit.to_string()], None)
+ ComposioRoute::Direct(tool) => direct_list_tools(&tool, &[toolkit.to_string()], None)
.await
.map_err(|e| {
tracing::debug!(target: "flows", %toolkit, error = %e, "[flows] live catalog: direct fetch failed — skipping");