Skip to content

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

feat(saas): add require_user_signature config flag

Steven Enamakel1af2315be013
diff --git a/crates/openhuman-core/src/core/runtime/saas.rs b/crates/openhuman-core/src/core/runtime/saas.rs
index 9ffb121832..4eec2f38dd 100644
--- a/crates/openhuman-core/src/core/runtime/saas.rs
+++ b/crates/openhuman-core/src/core/runtime/saas.rs
@@ -56,6 +56,14 @@ pub struct SaasConfig {
/// Let users store their own agent definitions.
#[serde(default)]
pub custom_definitions: bool,
+ /// Require `X-OpenHuman-User-Sig` on every request made for a user
+ /// (see `user_agents::gateway`).
+ #[serde(default = "default_true")]
+ pub require_user_signature: bool,
+}
+
+fn default_true() -> bool {
+ true
}
fn default_max_agents_open() -> usize {
@@ -78,6 +86,7 @@ impl SaasConfig {
idle_evict_secs: default_idle_evict_secs(),
shared_backend_api_key: false,
custom_definitions: false,
+ require_user_signature: true,
}
}
diff --git a/crates/openhuman-core/src/core/runtime/saas_tests.rs b/crates/openhuman-core/src/core/runtime/saas_tests.rs
index c0b926a021..27b2818c63 100644
--- a/crates/openhuman-core/src/core/runtime/saas_tests.rs
+++ b/crates/openhuman-core/src/core/runtime/saas_tests.rs
@@ -28,6 +28,7 @@ max_agents_open = 8
idle_evict_secs = 60
shared_backend_api_key = true
custom_definitions = true
+require_user_signature = false
"#,
)
.unwrap();
@@ -41,6 +42,7 @@ custom_definitions = true
assert_eq!(config.max_agents_open, 8);
assert_eq!(config.idle_evict_secs, 60);
assert!(config.shared_backend_api_key && config.custom_definitions);
+ assert!(!config.require_user_signature);
}
#[test]
diff --git a/crates/openhuman-core/src/user_agents/host.rs b/crates/openhuman-core/src/user_agents/host.rs
index 611e03b26c..70b531e3f5 100644
--- a/crates/openhuman-core/src/user_agents/host.rs
+++ b/crates/openhuman-core/src/user_agents/host.rs
@@ -79,6 +79,11 @@ impl AgentHost {
}
}
+ /// The operator's settings this host runs with.
+ pub fn saas(&self) -> &SaasConfig {
+ &self.saas
+ }
+
fn layout(&self, id: &UserAgentId) -> UserAgentLayout {
UserAgentLayout::new(&self.saas.root, id)
}
diff --git a/crates/openhuman-core/src/user_agents/mod.rs b/crates/openhuman-core/src/user_agents/mod.rs
index 80b45ad4f6..791cd215cb 100644
--- a/crates/openhuman-core/src/user_agents/mod.rs
+++ b/crates/openhuman-core/src/user_agents/mod.rs
@@ -14,6 +14,7 @@
//!
//! [`CoreContext`]: crate::core::runtime::CoreContext
+pub mod gateway;
pub mod host;
pub mod layout;
pub mod ops;