Skip to content

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

refactor(integrations): expose integrations module publicly

Steven Enamakel4807695d5d2b
diff --git a/crates/openhuman-tinyhumans/src/integrations/mod_tests.rs b/crates/openhuman-tinyhumans/src/integrations/mod_tests.rs
new file mode 100644
index 0000000000..6c69dc7008
--- /dev/null
+++ b/crates/openhuman-tinyhumans/src/integrations/mod_tests.rs
@@ -0,0 +1,52 @@
+//! Tests for the integrations module root (types + client construction).
+
+use super::*;
+#[test]
+fn backend_response_deserializes() {
+ let json = r#"{"success": true, "data": {"foo": 42}}"#;
+ let resp: BackendResponse<serde_json::Value> = serde_json::from_str(json).unwrap();
+ assert!(resp.success);
+ assert_eq!(resp.data.unwrap()["foo"], 42);
+}
+
+#[test]
+fn backend_response_without_data() {
+ let json = r#"{"success": true}"#;
+ let resp: BackendResponse<serde_json::Value> = serde_json::from_str(json).unwrap();
+ assert!(resp.success);
+ assert!(resp.data.is_none());
+}
+
+#[test]
+fn integration_pricing_defaults_on_missing_fields() {
+ let json = r#"{"integrations": {}}"#;
+ let pricing: IntegrationPricing = serde_json::from_str(json).unwrap();
+ assert!(pricing.integrations.google_places.is_none());
+ assert!(pricing.integrations.parallel.is_none());
+ assert!(pricing.integrations.tinyfish.is_none());
+}
+
+#[test]
+fn integration_pricing_ignores_retired_apify_and_twilio_entries() {
+ // An older backend still reporting the retired integrations must not
+ // break pricing deserialization.
+ let json = r#"{"integrations": {
+ "apify": {"available": true, "pricing": {}},
+ "twilio": {"available": true, "pricing": {}},
+ "parallel": {"available": true, "pricing": {}}
+ }}"#;
+ let pricing: IntegrationPricing = serde_json::from_str(json).unwrap();
+ assert!(pricing.integrations.parallel.unwrap().available);
+}
+
+#[test]
+fn build_client_returns_none_when_no_auth_token() {
+ let tmp = tempfile::tempdir().expect("tempdir");
+ let config = openhuman_embed::__host::config::Config {
+ workspace_dir: tmp.path().join("workspace"),
+ action_dir: tmp.path().join("workspace"),
+ config_path: tmp.path().join("config.toml"),
+ ..openhuman_embed::__host::config::Config::default()
+ };
+ assert!(build_client(&config).is_none());
+}
diff --git a/crates/openhuman-tinyhumans/src/lib.rs b/crates/openhuman-tinyhumans/src/lib.rs
index e3746cb5b4..51a5e8473c 100644
--- a/crates/openhuman-tinyhumans/src/lib.rs
+++ b/crates/openhuman-tinyhumans/src/lib.rs
@@ -80,7 +80,7 @@ pub mod client;
pub mod hosted;
pub(crate) mod inference;
mod install;
-pub(crate) mod integrations;
+pub mod integrations;
#[cfg(feature = "jev")]
pub mod jev;
pub mod jwt;