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(accessibility): correct helper function to handle missing channel controller
Steven Enamakeldea642f46ae0
diff --git a/crates/openhuman-core/src/channels/controllers/ops/connect/shared.rs b/crates/openhuman-core/src/channels/controllers/ops/connect/shared.rsnew file mode 100644index 0000000000..f0f833a1ad--- /dev/null+++ b/crates/openhuman-core/src/channels/controllers/ops/connect/shared.rs@@ -0,0 +1,52 @@+//! Small helpers shared across the connect/disconnect/status operations.++use serde_json::Value;++pub(crate) use tinychannels::controllers::{+ channel_config_connected, channel_credential_provider as credential_provider,+ parse_allowed_users,+};++/// Merge a channel's live supervised-listener health into its credential/config+/// derived `connected` flag (issue #3712).+///+/// Only listener-backed modes (those that materialise a TOML config block —+/// `has_config`) have a `channel:<id>` health component, kept current by the+/// supervisor's `ChannelConnected`/`ChannelDisconnected` events. For those, a+/// live `error` overrides the optimistic presence-based `connected` and carries+/// the failure reason to the UI; an `ok` confirms it. While the listener is+/// still `starting` (or has no component yet) we keep the presence-based value+/// so a freshly-configured channel isn't reported as broken before its first+/// connect attempt. Modes without a runtime listener (e.g. managed-DM) are left+/// untouched. Returns `(connected, error)`.+pub(crate) fn merge_listener_health(+ presence_connected: bool,+ has_config: bool,+ health_status: Option<&str>,+ health_last_error: Option<&str>,+) -> (bool, Option<String>) {+ if !has_config {+ return (presence_connected, None);+ }+ match health_status {+ Some("error") => (false, health_last_error.map(str::to_string)),+ Some("ok") => (true, None),+ _ => (presence_connected, None),+ }+}++pub(super) fn parse_optional_bool(value: Option<&Value>) -> Option<bool> {+ match value {+ Some(Value::Bool(b)) => Some(*b),+ Some(Value::Number(n)) => n.as_i64().map(|v| v != 0),+ Some(Value::String(s)) => {+ let normalized = s.trim().to_ascii_lowercase();+ match normalized.as_str() {+ "1" | "true" | "yes" | "on" => Some(true),+ "0" | "false" | "no" | "off" => Some(false),+ _ => None,+ }+ }+ _ => None,+ }+}diff --git a/crates/openhuman-core/src/desktop/accessibility/helper.rs b/crates/openhuman-core/src/desktop/accessibility/helper.rsindex 648be8f0a2..76696db404 100644--- a/crates/openhuman-core/src/desktop/accessibility/helper.rs+++ b/crates/openhuman-core/src/desktop/accessibility/helper.rs@@ -17,6 +17,21 @@//!//! Fire-and-forget callers never touch `RESPONSE_RX` or `RECV_SERIALISER`,//! so `show`/`hide` can proceed while a `focus` query is in-flight.+//!+//! Split by responsibility: [`process`] owns the process lifecycle and the+//! send/receive paths, and the `swift_*` modules hold the embedded Swift+//! source (assembled by [`swift_source`]) that the helper binary compiles+//! from.++mod process;+mod swift_ax_actions;+mod swift_focus;+mod swift_overlay;+mod swift_paste;+mod swift_source;-include!("helper_part_01.rs");-include!("helper_part_02.rs");+#[allow(unused_imports)]+pub(crate) use process::helper_send_receive;+#[allow(unused_imports)]+pub(in crate::desktop::accessibility) use process::{helper_quit, helper_send_fire_and_forget};+pub use process::precompile_helper_background;diff --git a/crates/openhuman-core/src/integrations/composio/tools/direct/types.rs b/crates/openhuman-core/src/integrations/composio/tools/direct/types.rsnew file mode 100644index 0000000000..d4bb4d99f9--- /dev/null+++ b/crates/openhuman-core/src/integrations/composio/tools/direct/types.rs@@ -0,0 +1,62 @@+//! Core `ComposioTool` struct and the loopback/HTTPS URL-safety helpers+//! shared by every direct-mode Composio request path.++use crate::security::SecurityPolicy;+use std::sync::Arc;++pub(super) const COMPOSIO_API_BASE_V2: &str = "https://backend.composio.dev/api/v2";+pub(super) const COMPOSIO_API_BASE_V3: &str = "https://backend.composio.dev/api/v3";++pub(super) fn ensure_https(url: &str) -> anyhow::Result<()> {+ if !url.starts_with("https://") {+ anyhow::bail!(+ "Refusing to transmit sensitive data over non-HTTPS URL: URL scheme must be https"+ );+ }+ Ok(())+}++pub(super) fn is_loopback_http_url(url: &str) -> bool {+ // Parse rather than prefix-match: a raw `starts_with("http://127.0.0.1:")`+ // is fooled by userinfo smuggling like+ // `http://127.0.0.1:[email protected]/api/v3/tools`, which reqwest routes to the+ // *parsed* host (`evil.com`). Verify the actual scheme + host and reject any+ // embedded credentials so the insecure-loopback path can never leak the+ // `x-api-key` header to a non-loopback host.+ let Ok(parsed) = url::Url::parse(url) else {+ return false;+ };+ if parsed.scheme() != "http" {+ return false;+ }+ if !parsed.username().is_empty() || parsed.password().is_some() {+ return false;+ }+ match parsed.host() {+ Some(url::Host::Domain(host)) => host.eq_ignore_ascii_case("localhost"),+ Some(url::Host::Ipv4(ip)) => ip.is_loopback(),+ Some(url::Host::Ipv6(ip)) => ip.is_loopback(),+ None => false,+ }+}++#[cfg(debug_assertions)]+pub(super) fn is_loopback_http_base(url: &str) -> bool {+ is_loopback_http_url(&format!("{}/", url.trim_end_matches('/')))+}++/// A tool that proxies actions to the Composio managed tool platform.+pub struct ComposioTool {+ pub(super) api_key: String,+ pub(super) default_entity_id: String,+ pub(super) security: Arc<SecurityPolicy>,+ pub(super) base_v2: String,+ /// Base URL for Composio v3 endpoints (`{base}/tools`). Production+ /// always uses [`COMPOSIO_API_BASE_V3`] via [`ComposioTool::new`]; the+ /// `#[cfg(test)]` `new_with_v3_base` constructor lets unit tests point+ /// the direct-mode `/tools` listing at a local axum mock — the same+ /// base-URL injection the backend `ComposioClient` gets through+ /// `IntegrationClient::new` in `client_tests.rs`.+ pub(super) base_v3: String,+ pub(super) allow_insecure_loopback: bool,+}