The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
fix(composio): handle missing transport field in tool response
Steven Enamakel15f4ab11830b
diff --git a/crates/openhuman-core/src/integrations/composio/client/direct.rs b/crates/openhuman-core/src/integrations/composio/client/direct.rsindex c9f7352dbe..89528f55b7 100644--- a/crates/openhuman-core/src/integrations/composio/client/direct.rs+++ b/crates/openhuman-core/src/integrations/composio/client/direct.rs@@ -6,7 +6,7 @@use std::sync::Arc;use super::super::direct_auth;-use super::super::types::{ComposioConnection, ComposioConnectionsResponse, ComposioToolsResponse};+use super::super::types::{ComposioConnectionsResponse, ComposioToolsResponse};/// Direct-mode connection listing.///@@ -35,10 +35,10 @@ pub async fn direct_list_connections(anyhow::bail!("{error}");}- let items = match direct.list_connected_accounts().await {- Ok(items) => {+ let response = match direct.list_connections().await {+ Ok(response) => {direct_auth::record_direct_auth_success(key_id);- items+ response}Err(error) => {let rendered = format!("{error:#}");@@ -64,34 +64,11 @@ pub async fn direct_list_connections(return Err(error);}};- let connections: Vec<ComposioConnection> = items- .into_iter()- .filter_map(|item| {- let id = item.id.trim().to_string();- if id.is_empty() {- return None;- }- let toolkit = item.toolkit_slug().unwrap_or_default();- let status = item.status.clone().unwrap_or_default();- Some(ComposioConnection {- id,- toolkit,- status,- created_at: item.created_at.clone(),- // Identity fields are populated by- // `enrich_connections_with_identity` in ops.rs after- // the full list is fetched, using cached profile data.- account_email: None,- workspace: None,- username: None,- })- })- .collect();tracing::debug!(- count = connections.len(),+ count = response.connections.len(),"[composio-direct] list_connections: mapped v3 connected accounts");- Ok(ComposioConnectionsResponse { connections })+ Ok(response)}/// Direct-mode tool listing. Calls@@ -129,32 +106,15 @@ pub(crate) async fn direct_list_tools(toolkits: &[String],tags: Option<&[String]>,) -> anyhow::Result<ComposioToolsResponse> {- let toolkit_refs: Vec<&str> = toolkits.iter().map(|s| s.as_str()).collect();- let tag_refs: Option<Vec<&str>> = tags.map(|t| t.iter().map(|s| s.as_str()).collect());tracing::debug!(- toolkits = toolkit_refs.len(),- tags = tag_refs.as_ref().map(Vec::len).unwrap_or(0),+ toolkits = toolkits.len(),+ tags = tags.map(<[String]>::len).unwrap_or(0),"[composio-direct] list_tools: GET v3 /tools");- let items = direct- .list_tool_schemas_v3(&toolkit_refs, tag_refs.as_deref())- .await?;- let tools: Vec<super::super::types::ComposioToolSchema> = items- .into_iter()- .filter(|item| !item.slug.is_empty())- .map(|item| super::super::types::ComposioToolSchema {- kind: "function".to_string(),- function: super::super::types::ComposioToolFunction {- name: item.slug,- description: item.description,- parameters: item.input_parameters,- output_parameters: item.output_parameters,- },- })- .collect();+ let response = direct.list_tools(toolkits, tags.unwrap_or(&[])).await?;tracing::debug!(- count = tools.len(),+ count = response.tools.len(),"[composio-direct] list_tools: mapped v3 tool schemas");- Ok(ComposioToolsResponse { tools })+ Ok(response)}diff --git a/crates/openhuman-core/src/integrations/composio/tools.rs b/crates/openhuman-core/src/integrations/composio/tools.rsindex d41b4758e3..dbd0331ca0 100644--- a/crates/openhuman-core/src/integrations/composio/tools.rs+++ b/crates/openhuman-core/src/integrations/composio/tools.rs@@ -43,7 +43,7 @@ mod visibility;#[path = "tools_tests.rs"]mod tests;-pub use direct::{ComposioConnectedAccount, DirectComposioClient};+pub use direct::DirectComposioClient;pub use execute::ComposioExecuteTool;pub(crate) use live_config::live_composio_config;pub(crate) use redact::redact_composio_outcome;diff --git a/crates/openhuman-core/src/integrations/composio/tools/direct/transport.rs b/crates/openhuman-core/src/integrations/composio/tools/direct/transport.rsindex 6a424d9207..b3bdaaea3a 100644--- a/crates/openhuman-core/src/integrations/composio/tools/direct/transport.rs+++ b/crates/openhuman-core/src/integrations/composio/tools/direct/transport.rs@@ -10,10 +10,11 @@use std::sync::Arc;use async_trait::async_trait;-use tinyconnectors::client::{DirectRoute, Transport};+use tinyconnectors::client::{DirectRoute, Route, Transport};use tinyconnectors::Error as ConnectorError;use super::http_errors::response_error;+use crate::integrations::composio::types::{ComposioConnectionsResponse, ComposioToolsResponse};use super::types::DirectComposioClient;/// Failure label per request path, matching the messages the host has always@@ -56,13 +57,43 @@ impl DirectComposioClient {////// The route wraps transport failures as `request to <path> failed: <msg>`;/// users have only ever seen `<msg>`.-pub(crate) fn route_error(error: ConnectorError) -> anyhow::Error {+fn route_error(error: ConnectorError) -> anyhow::Error {match error {ConnectorError::Transport { message, .. } => anyhow::anyhow!(message),other => anyhow::anyhow!(other.to_string()),}}+impl DirectComposioClient {+ /// `GET /connected_accounts` through the module's direct route, reshaped+ /// into canonical connections.+ pub(crate) async fn list_connections(+ self: &Arc<Self>,+ ) -> anyhow::Result<ComposioConnectionsResponse> {+ let mut response = self.route().list_connections().await.map_err(route_error)?;+ // Identity fields are the host's to fill (`enrich_connections_with_identity`+ // from cached profile data); the route also lifts them from the v3 row.+ for connection in &mut response.connections {+ connection.account_email = None;+ connection.workspace = None;+ connection.username = None;+ }+ Ok(response)+ }++ /// `GET /tools` through the module's direct route.+ pub(crate) async fn list_tools(+ self: &Arc<Self>,+ toolkits: &[String],+ tags: &[String],+ ) -> anyhow::Result<ComposioToolsResponse> {+ self.route()+ .list_tools(toolkits, tags)+ .await+ .map_err(route_error)+ }+}+#[async_trait]impl Transport for DirectComposioClient {async fn get(&self, path: &str) -> tinyconnectors::Result<serde_json::Value> {@@ -88,7 +119,10 @@ impl Transport for DirectComposioClient {}resp.json::<serde_json::Value>().await.map_err(|e| {- transport_error(path, format!("{}: {e}", decode_label(path)))+ transport_error(+ path,+ format!("{}: {:#}", decode_label(path), anyhow::Error::from(e)),+ )})}