Skip to content

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

feat(runtime): add builder pattern for runtime configuration

Steven Enamakele92bb7d2131e
diff --git a/crates/openhuman-core/src/core/all.rs b/crates/openhuman-core/src/core/all.rs
index e481f36557..26f3325e12 100644
--- a/crates/openhuman-core/src/core/all.rs
+++ b/crates/openhuman-core/src/core/all.rs
@@ -116,8 +116,8 @@ pub enum DomainGroup {
/// External connectors reached on the user's behalf — Composio, calendar,
/// file storage, task sources (`integrations/`).
Integrations,
- /// Background initiative: scheduled jobs and the subconscious tick loop
- /// (`cron/`, `subconscious/`). Pairs with `ServiceSet::{cron, heartbeat}`.
+ /// Background initiative: scheduled cron jobs (`cron/`). Pairs with
+ /// `ServiceSet::cron`.
Automation,
/// Code-execution substrate: the managed Node/Python runtimes, the worker
/// pool, and the sandbox/CWD-jail confinement (`runtime/`, `sandbox/`).
diff --git a/crates/openhuman-core/src/core/runtime/README.md b/crates/openhuman-core/src/core/runtime/README.md
index bb089aa3c8..03caed22dc 100644
--- a/crates/openhuman-core/src/core/runtime/README.md
+++ b/crates/openhuman-core/src/core/runtime/README.md
@@ -36,15 +36,15 @@ Each flag is independent. Presets:
| Preset | Shape |
| --- | --- |
| `ServiceSet::desktop()` | Everything on: the Tauri shell and standalone `openhuman-core run`. |
-| `ServiceSet::headless_api()` | HTTP JSON-RPC only (`rpc_http`): no Socket.IO, cron, channels, or heartbeat; a single-core cloud/server deployment. |
+| `ServiceSet::headless_api()` | HTTP JSON-RPC only (`rpc_http`): no Socket.IO, cron, channels, or login-gated services; a single-core cloud/server deployment. |
| `ServiceSet::none()` | No transport, no background services: a library/harness embedder driving only `CoreRuntime::invoke`. |
-| `ServiceSet::embedded()` | No transport (`rpc_http: false`), but the background work a long-lived embedded session expects: cron, heartbeat, memory queue, harness init, skill catalog refresh, memory sync. `socketio`/`channels` stay off because such a host reads state through the facade and owns its own networking. |
+| `ServiceSet::embedded()` | No transport (`rpc_http: false`), but the background work a long-lived embedded session expects: cron, login-gated services, memory queue, harness init, skill catalog refresh, memory sync. `socketio`/`channels` stay off because such a host reads state through the facade and owns its own networking. |
Individual services still honor their own runtime gates inside
`runtime/services.rs` regardless of `ServiceSet` selection: `cron` checks
`config.cron.enabled`; `channels` returns early on
`OPENHUMAN_DISABLE_CHANNEL_LISTENERS=1` or when
-`config.channels_config.has_listening_integrations()` is false; `heartbeat`
+`config.channels_config.has_listening_integrations()` is false; `login_gated`
(`spawn_login_gated_services`) defers the login-gated services until a user
session exists on disk. `ServiceSet` picks *whether a service is spawned at
all*; the gate picks *whether it runs for this user*.
diff --git a/crates/openhuman-core/src/core/runtime/builder.rs b/crates/openhuman-core/src/core/runtime/builder.rs
index 383cf13069..a8ee9b4511 100644
--- a/crates/openhuman-core/src/core/runtime/builder.rs
+++ b/crates/openhuman-core/src/core/runtime/builder.rs
@@ -46,8 +46,8 @@ pub struct ServiceSet {
pub cron: bool,
/// Spawn realtime channel listeners (Telegram, Discord, …).
pub channels: bool,
- /// Spawn login-gated services (local AI, voice, autocomplete) + subconscious/heartbeat.
- pub heartbeat: bool,
+ /// Spawn login-gated services (local AI, voice, autocomplete).
+ pub login_gated: bool,
/// Spawn the periodic self-update checker.
pub update_scheduler: bool,
/// Start memory queue workers during runtime bootstrap.
@@ -72,7 +72,7 @@ impl ServiceSet {
socketio: true,
cron: true,
channels: true,
- heartbeat: true,
+ login_gated: true,
update_scheduler: true,
memory_queue: true,
harness_init: true,
@@ -84,14 +84,14 @@ impl ServiceSet {
}
/// HTTP JSON-RPC only — a single-core cloud/server deployment. No Socket.IO,
- /// no cron/channels/heartbeat; the supervisor decides those per plan.
+ /// no cron/channels/login-gated services; the supervisor decides those per plan.
pub fn headless_api() -> Self {
Self {
rpc_http: true,
socketio: false,
cron: false,
channels: false,
- heartbeat: false,
+ login_gated: false,
update_scheduler: false,
memory_queue: false,
harness_init: false,
@@ -110,7 +110,7 @@ impl ServiceSet {
socketio: false,
cron: false,
channels: false,
- heartbeat: false,
+ login_gated: false,
update_scheduler: false,
memory_queue: false,
harness_init: false,
@@ -139,7 +139,7 @@ impl ServiceSet {
socketio: false,
cron: true,
channels: false,
- heartbeat: true,
+ login_gated: true,
update_scheduler: false,
memory_queue: true,
harness_init: true,
@@ -202,7 +202,7 @@ pub struct DomainSet {
pub inference: bool,
/// External connectors (Composio, calendar, file storage, task sources).
pub integrations: bool,
- /// Background initiative: cron + the subconscious tick loop.
+ /// Background initiative: scheduled cron jobs.
pub automation: bool,
/// Code-execution substrate: Node/Python runtimes, pool, sandbox.
pub runtimes: bool,
@@ -1011,7 +1011,7 @@ impl CoreRuntime {
use crate::core::runtime::services;
jsonrpc::start_core_runtime_services(self.services, self.config.as_ref()).await;
- if self.services.heartbeat {
+ if self.services.login_gated {
services::spawn_login_gated_services(self.ctx.host_kind().is_desktop_shell());
}
if self.services.update_scheduler {
diff --git a/crates/openhuman-core/src/core/runtime/builder_tests.rs b/crates/openhuman-core/src/core/runtime/builder_tests.rs
index f6af45591b..3871d0eff6 100644
--- a/crates/openhuman-core/src/core/runtime/builder_tests.rs
+++ b/crates/openhuman-core/src/core/runtime/builder_tests.rs
@@ -140,7 +140,7 @@ fn embedded_service_set_binds_no_transport() {
// But a long-lived operator session still wants background work.
assert!(services.cron);
- assert!(services.heartbeat);
+ assert!(services.login_gated);
assert!(services.memory_queue);
assert!(services.harness_init);
assert!(services.memory_sync);
@@ -150,7 +150,7 @@ fn embedded_service_set_binds_no_transport() {
fn boot_jobs_are_independent_from_runtime_service_flags() {
let mut custom = ServiceSet::none();
custom.rpc_http = true;
- custom.heartbeat = true;
+ custom.login_gated = true;
custom.update_scheduler = true;
assert!(!custom.memory_queue);
assert!(!custom.harness_init);
diff --git a/crates/openhuman-core/src/core/runtime/context.rs b/crates/openhuman-core/src/core/runtime/context.rs
index d732b794d3..8dfb3e3f89 100644
--- a/crates/openhuman-core/src/core/runtime/context.rs
+++ b/crates/openhuman-core/src/core/runtime/context.rs
@@ -924,7 +924,7 @@ pub async fn init_stores(cfg: &crate::config::Config, domains: crate::core::runt
// Boot-time Sentry user binding — issue #3135. If the user is
// already signed in (typical desktop restart), the auth-profile
// store has their `user_id` *now*, before any background loop
- // (Composio sync tick, heartbeat, etc.) fires its first event.
+ // (Composio sync tick, cron, etc.) fires its first event.
// Reading from the store here means subsequent events carry
// `user.id` even when no `app_state_snapshot` RPC has run yet.
match crate::security::credentials::session_support::build_session_state(cfg) {
diff --git a/crates/openhuman-core/src/core/runtime/mod.rs b/crates/openhuman-core/src/core/runtime/mod.rs
index 0057663788..3ee1329b27 100644
--- a/crates/openhuman-core/src/core/runtime/mod.rs
+++ b/crates/openhuman-core/src/core/runtime/mod.rs
@@ -3,7 +3,7 @@
//!
//! This module is the seam that separates *initialization* (workspace-bound
//! store setup — [`context`]) from *background services* (cron, channels,
-//! heartbeat, update scheduler — [`services`]) so alternate hosts can compose
+//! login-gated services, update scheduler — [`services`]) so alternate hosts can compose
//! them without going through the monolithic `run_server_inner`. See the
//! pluggable-core work (`core::runtime::builder`, `core::runtime::context`) for
//! the builder/context split this module composes.
diff --git a/crates/openhuman-core/src/core/runtime/services.rs b/crates/openhuman-core/src/core/runtime/services.rs
index 09a77bddcd..74d926af96 100644
--- a/crates/openhuman-core/src/core/runtime/services.rs
+++ b/crates/openhuman-core/src/core/runtime/services.rs
@@ -6,7 +6,7 @@
//! preserving the exact gating and behavior of the original inline block.
//!
//! Today these are launched unconditionally from `run_server_inner`; the
-//! per-service *config* gates (`config.cron.enabled`, `config.heartbeat.enabled`,
+//! per-service *config* gates (`config.cron.enabled`,
//! `OPENHUMAN_DISABLE_CHANNEL_LISTENERS`, `has_listening_integrations()`) stay
//! inside each function. Phase 1 lifts the *selection* (should this service be
//! spawned at all) up to a `ServiceSet` chosen by the embedder, while these
@@ -20,7 +20,7 @@ use crate::config::Config;
use crate::core::runtime::ServiceSet;
/// Background bootstrap for login-gated services (local AI, voice, screen
-/// intelligence, autocomplete) plus the subconscious engine + heartbeat.
+/// intelligence, autocomplete).
///
/// Heavy services are only started when a user is logged in. If no user session
/// exists on disk, startup is deferred until the login handler in
diff --git a/crates/openhuman-embed/src/runtime/builder_tests.rs b/crates/openhuman-embed/src/runtime/builder_tests.rs
index 28e460fdd1..adcf352ce0 100644
--- a/crates/openhuman-embed/src/runtime/builder_tests.rs
+++ b/crates/openhuman-embed/src/runtime/builder_tests.rs
@@ -31,13 +31,13 @@ fn inherited_workspace_without_a_host_credential_keeps_installed_session_policy(
#[test]
fn default_services_start_no_background_writers() {
- // cron, heartbeat and the memory queue each write to the workspace on their
+ // cron, the login-gated services and the memory queue each write to the workspace on their
// own schedule. A library call that started them would become a background
// process the caller never asked for.
let services = default_services();
assert!(services.harness_init, "the agent harness must be prepared");
assert!(!services.cron);
- assert!(!services.heartbeat);
+ assert!(!services.login_gated);
assert!(!services.memory_queue);
assert!(!services.rpc_http, "a library call binds no port");
assert!(!services.socketio);