Skip to content

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

feat(runtime): add saas host kind and mode

Steven Enamakela4d11f73fb32
diff --git a/crates/openhuman-core/src/core/runtime/bootstrap.rs b/crates/openhuman-core/src/core/runtime/bootstrap.rs
index 1a8fdc2cc8..38c064b123 100644
--- a/crates/openhuman-core/src/core/runtime/bootstrap.rs
+++ b/crates/openhuman-core/src/core/runtime/bootstrap.rs
@@ -272,6 +272,7 @@ pub(crate) async fn bootstrap_core_runtime(
crate::core::types::HostKind::Cli => "cli",
crate::core::types::HostKind::Docker => "docker",
crate::core::types::HostKind::Library => "library",
+ crate::core::types::HostKind::Saas => "saas",
},
},
);
diff --git a/crates/openhuman-core/src/core/runtime/mod.rs b/crates/openhuman-core/src/core/runtime/mod.rs
index 4a8eacb11e..e71d61385a 100644
--- a/crates/openhuman-core/src/core/runtime/mod.rs
+++ b/crates/openhuman-core/src/core/runtime/mod.rs
@@ -44,10 +44,15 @@ pub const AGENT_WORKER_STACK_BYTES: usize = 20 * 1024 * 1024;
pub const MAX_BLOCKING_THREADS: usize = 64;
mod bootstrap;
+pub mod boot_guard;
pub mod builder;
pub mod context;
+pub mod mode;
+pub mod saas;
pub mod services;
pub(crate) mod subscribers;
pub use builder::{CoreBuilder, CoreRuntime, DomainSet, ServiceSet, TokenSource};
pub use context::{ContextOverlay, CoreContext};
+pub use mode::{current_mode, is_saas, Mode};
+pub use saas::SaasConfig;
diff --git a/crates/openhuman-core/src/core/types.rs b/crates/openhuman-core/src/core/types.rs
index 1a867a84c9..774cd9a516 100644
--- a/crates/openhuman-core/src/core/types.rs
+++ b/crates/openhuman-core/src/core/types.rs
@@ -87,6 +87,11 @@ pub enum HostKind {
Cli,
Docker,
Library,
+ /// A many-user server behind a trusted gateway ([`Mode::Saas`]). Treated
+ /// as the most restrictive host wherever behaviour differs by host.
+ ///
+ /// [`Mode::Saas`]: crate::core::runtime::Mode::Saas
+ Saas,
}
impl HostKind {
@@ -125,6 +130,7 @@ impl HostKind {
HostKind::Cli => "cli",
HostKind::Docker => "docker",
HostKind::Library => "library",
+ HostKind::Saas => "saas",
}
}
}
@@ -152,7 +158,9 @@ pub fn approval_gate_boot_decision(
env_override_requested: bool,
) -> ApprovalGateBootDecision {
match host {
- HostKind::TauriShell => ApprovalGateBootDecision {
+ // A SaaS core, like the desktop shell, never lets the environment
+ // switch the gate off.
+ HostKind::TauriShell | HostKind::Saas => ApprovalGateBootDecision {
install_gate: true,
override_ignored: env_override_requested,
gate_disabled_by_override: false,