Skip to content

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

feat(core): add Medulla domain group and feature-gated integration

Steven Enamakel8373fe84131e
diff --git a/crates/openhuman-core/src/core/all.rs b/crates/openhuman-core/src/core/all.rs
index 5e41089273..72a296518e 100644
--- a/crates/openhuman-core/src/core/all.rs
+++ b/crates/openhuman-core/src/core/all.rs
@@ -104,6 +104,15 @@ pub enum DomainGroup {
Web3,
Voice,
Media,
+ /// Medulla integration: the cloud client (`medulla`), the folded session
+ /// runtime (`medulla_session`), the chat store (`medulla::chat`), and
+ /// authored harness workflows (`medulla_workflows`).
+ ///
+ /// One coarse family rather than four, because these are never
+ /// independently useful — a host that wants `medulla_session` always wants
+ /// `medulla` (it folds that domain's envelopes). Splitting them would add
+ /// drift surface for no reachable configuration.
+ Medulla,
// Families carved out of the `Platform` catch-all once the domain reorg
// (#5328) gave each one a directory to be named after. Before that, half the
// controller surface was tagged `Platform` purely because there was no
@@ -137,7 +146,7 @@ pub enum DomainGroup {
impl DomainGroup {
/// Number of variants. Kept in sync by `domain_group_all_lists_every_variant`.
- pub const COUNT: usize = 20;
+ pub const COUNT: usize = 21;
/// Every variant, for exhaustive iteration in drift guards.
///
@@ -161,6 +170,7 @@ impl DomainGroup {
DomainGroup::Web3,
DomainGroup::Voice,
DomainGroup::Media,
+ DomainGroup::Medulla,
DomainGroup::Inference,
DomainGroup::Integrations,
DomainGroup::Automation,
@@ -188,14 +198,15 @@ impl DomainGroup {
DomainGroup::Web3 => 9,
DomainGroup::Voice => 10,
DomainGroup::Media => 11,
- DomainGroup::Inference => 12,
- DomainGroup::Integrations => 13,
- DomainGroup::Automation => 14,
- DomainGroup::Runtimes => 15,
- DomainGroup::Desktop => 16,
- DomainGroup::Hosted => 17,
- DomainGroup::Modules => 18,
- DomainGroup::Platform => 19,
+ DomainGroup::Medulla => 12,
+ DomainGroup::Inference => 13,
+ DomainGroup::Integrations => 14,
+ DomainGroup::Automation => 15,
+ DomainGroup::Runtimes => 16,
+ DomainGroup::Desktop => 17,
+ DomainGroup::Hosted => 18,
+ DomainGroup::Modules => 19,
+ DomainGroup::Platform => 20,
}
}
}
@@ -651,6 +662,17 @@ fn build_registered_controllers() -> Vec<GroupedController> {
DomainGroup::Runtimes,
crate::runtime::javascript::all_javascript_registered_controllers(),
);
+ // Medulla integration: readiness, durable sessions, and the connected worker
+ // roster against the Medulla orchestration backend. Registration-site gate
+ // like `flows` — with the `medulla` feature off these methods are absent
+ // (unknown-method), which is what lets a host hide the surface instead of
+ // rendering a failure.
+ #[cfg(feature = "medulla")]
+ push(
+ &mut controllers,
+ DomainGroup::Medulla,
+ crate::medulla::all_medulla_registered_controllers(),
+ );
// Discovered SKILL.md skills and their bundled resources
push(
&mut controllers,
@@ -1085,6 +1107,7 @@ pub fn namespace_description(namespace: &str) -> Option<&'static str> {
"inference" => Some("Connect to configured text, vision, and embedding inference runtimes."),
"migrate" => Some("Data migration utilities."),
"javascript" => Some("First-class JavaScript runtime bridge for listing and dispatching tools."),
+ "medulla" => Some("Medulla orchestration backend: integration readiness, durable sessions, and the connected worker roster."),
"security" => Some("Security policy and autonomy guardrail metadata."),
"service" => Some("Desktop service lifecycle management."),
"session_import" => {
diff --git a/crates/openhuman-core/src/core/all_tests.rs b/crates/openhuman-core/src/core/all_tests.rs
index 36c5f3f92c..cbc8fdb4a5 100644
--- a/crates/openhuman-core/src/core/all_tests.rs
+++ b/crates/openhuman-core/src/core/all_tests.rs
@@ -1214,6 +1214,36 @@ fn http_host_controllers_absent_when_http_server_off() {
);
}
+/// The `medulla` namespace registers under `DomainGroup::Medulla` when the
+/// `medulla` feature is on.
+///
+/// Paired with the negative below. On its own this proves nothing about the
+/// gate — a gate that removed nothing would still pass it.
+#[cfg(feature = "medulla")]
+#[test]
+fn medulla_controllers_registered_when_feature_on() {
+ assert_eq!(
+ group_for_namespace("medulla"),
+ Some(DomainGroup::Medulla),
+ "`medulla` must register under DomainGroup::Medulla when the feature is on"
+ );
+}
+
+/// The `medulla` namespace leaves no trace when the feature is off.
+///
+/// This is the half that proves the gate removes something. It also pins the
+/// intended off-state: **absence**, so a host sees unknown-method and hides the
+/// surface, rather than a registered controller that fails at call time.
+#[cfg(not(feature = "medulla"))]
+#[test]
+fn medulla_controllers_absent_when_feature_off() {
+ assert_eq!(
+ group_for_namespace("medulla"),
+ None,
+ "`medulla` must not register when the feature is off"
+ );
+}
+
// ---- DomainGroup ↔ family-directory realignment ----------------------------
// The reorg (#5328) made `crates/openhuman-core/src/` one directory per family, so the
// runtime axis can finally name each one instead of sweeping half the surface
@@ -1433,6 +1463,7 @@ fn every_domain_group_is_accounted_for_in_store_init_plan() {
DomainGroup::Web3,
DomainGroup::Voice,
DomainGroup::Media,
+ DomainGroup::Medulla,
DomainGroup::Inference,
DomainGroup::Integrations,
DomainGroup::Automation,
@@ -1490,6 +1521,7 @@ fn every_domain_group_is_accounted_for_in_subscriber_plan() {
DomainGroup::Web3,
DomainGroup::Voice,
DomainGroup::Media,
+ DomainGroup::Medulla,
DomainGroup::Inference,
DomainGroup::Automation,
DomainGroup::Runtimes,
diff --git a/crates/openhuman-core/src/core/runtime/builder.rs b/crates/openhuman-core/src/core/runtime/builder.rs
index f5f18051ad..d96d97bdfc 100644
--- a/crates/openhuman-core/src/core/runtime/builder.rs
+++ b/crates/openhuman-core/src/core/runtime/builder.rs
@@ -198,6 +198,9 @@ pub struct DomainSet {
/// future backing controller would stay live. Fold the media-generation
/// controller into this group when it lands.
pub media: bool,
+ /// Medulla integration: cloud client, session runtime, chat store, and
+ /// authored harness workflows.
+ pub medulla: bool,
/// Model inference: providers, routing, local engines, embeddings.
pub inference: bool,
/// External connectors (Composio, calendar, file storage, task sources).
@@ -233,6 +236,7 @@ impl DomainSet {
web3: true,
voice: true,
media: true,
+ medulla: true,
inference: true,
integrations: true,
automation: true,
@@ -261,6 +265,7 @@ impl DomainSet {
web3: false,
voice: false,
media: false,
+ medulla: false,
inference: false,
integrations: false,
automation: false,
@@ -286,8 +291,8 @@ impl DomainSet {
/// and todos, and leaves `channels` off — but `channel.web_chat` is tagged
/// `DomainGroup::Channels` and an embedded host drives chat turns through it.
///
- /// `flows: true` is load-bearing, not incidental: workflow boot
- /// reconciliation keys off
+ /// `flows: true` is load-bearing, not incidental: `medulla_workflows` runs
+ /// on the tinyflows engine and boot reconciliation keys off
/// `ctx.domains().flows` rather than a `ServiceSet` flag.
///
/// An embedded host supplies its own harness wrappers, networking and
@@ -306,6 +311,7 @@ impl DomainSet {
web3: false,
voice: false,
media: false,
+ medulla: true,
inference: true,
integrations: true,
automation: true,
@@ -340,6 +346,7 @@ impl DomainSet {
web3: false,
voice: false,
media: false,
+ medulla: false,
inference: false,
integrations: false,
automation: false,
@@ -366,6 +373,7 @@ impl DomainSet {
web3: false,
voice: false,
media: false,
+ medulla: false,
inference: false,
integrations: false,
automation: false,
@@ -392,6 +400,7 @@ impl DomainSet {
DomainGroup::Web3 => self.web3,
DomainGroup::Voice => self.voice,
DomainGroup::Media => self.media,
+ DomainGroup::Medulla => self.medulla,
DomainGroup::Inference => self.inference,
DomainGroup::Integrations => self.integrations,
DomainGroup::Automation => self.automation,
@@ -426,6 +435,7 @@ impl DomainSet {
web3: self.web3 && other.web3,
voice: self.voice && other.voice,
media: self.media && other.media,
+ medulla: self.medulla && other.medulla,
inference: self.inference && other.inference,
integrations: self.integrations && other.integrations,
automation: self.automation && other.automation,
diff --git a/crates/openhuman-core/src/core/runtime/builder_tests.rs b/crates/openhuman-core/src/core/runtime/builder_tests.rs
index 8655ae8a91..8af49c17b9 100644
--- a/crates/openhuman-core/src/core/runtime/builder_tests.rs
+++ b/crates/openhuman-core/src/core/runtime/builder_tests.rs
@@ -18,6 +18,7 @@ fn domain_set_presets_have_expected_flags() {
DomainGroup::Web3,
DomainGroup::Voice,
DomainGroup::Media,
+ DomainGroup::Medulla,
DomainGroup::Integrations,
DomainGroup::Platform,
] {
@@ -44,6 +45,7 @@ fn domain_set_presets_have_expected_flags() {
DomainGroup::Web3,
DomainGroup::Voice,
DomainGroup::Media,
+ DomainGroup::Medulla,
DomainGroup::Platform,
] {
assert!(!harness.allows(off), "harness() must NOT allow {off:?}");
@@ -64,6 +66,7 @@ fn domain_set_presets_have_expected_flags() {
DomainGroup::Web3,
DomainGroup::Voice,
DomainGroup::Media,
+ DomainGroup::Medulla,
DomainGroup::Platform,
] {
assert!(!none.allows(group), "none() must NOT allow {group:?}");
@@ -84,6 +87,7 @@ fn embedded_domain_set_enables_the_host_families() {
DomainGroup::Threads,
DomainGroup::Config,
DomainGroup::Security,
+ DomainGroup::Medulla,
DomainGroup::Platform,
] {
assert!(set.allows(on), "embedded() must allow {on:?}");
@@ -101,7 +105,8 @@ fn embedded_domain_set_enables_the_host_families() {
#[test]
fn embedded_keeps_flows_on_for_workflow_boot_reconcile() {
- // Not incidental: boot reconciliation keys off `ctx.domains().flows`, not a ServiceSet
+ // Not incidental: `medulla_workflows` runs on the tinyflows engine and
+ // boot reconciliation keys off `ctx.domains().flows`, not a ServiceSet
// flag. Turning this off silently strands orphaned runs.
assert!(DomainSet::embedded().allows(DomainGroup::Flows));
}
@@ -115,7 +120,7 @@ fn embedded_keeps_channels_on_for_web_chat() {
}
#[test]
-fn embedded_is_not_harness() {
+fn embedded_is_not_harness_plus_medulla() {
// Guards the most tempting future "simplification": deriving this
// preset from harness(), which leaves the supporting Platform,
// Channels, and Integrations families off.
diff --git a/crates/openhuman-core/src/core/runtime/services.rs b/crates/openhuman-core/src/core/runtime/services.rs
index b5593d9f4c..f4d7bb72b4 100644
--- a/crates/openhuman-core/src/core/runtime/services.rs
+++ b/crates/openhuman-core/src/core/runtime/services.rs
@@ -534,6 +534,10 @@ pub fn spawn_socket_auto_connect(
// `Config` resolved above, which a workspace switch invalidates.
// `set_workflow_bridge` re-advertises over a live socket by
// design, so reinstall and skip only the handshake.
+ #[cfg(feature = "flows")]
+ if _flows_enabled {
+ crate::flows::medulla_bridge::install(std::sync::Arc::clone(&config));
+ }
log::info!(
"[socket] Auto-connect: {api_url} already connected with this session — refreshed the workflow bridge, kept the socket"
);
@@ -543,6 +547,10 @@ pub fn spawn_socket_auto_connect(
log::error!("[socket] Auto-connect could not stop the prior connection: {e}");
return;
}
+ #[cfg(feature = "flows")]
+ if _flows_enabled {
+ crate::flows::medulla_bridge::install(std::sync::Arc::clone(&config));
+ }
let provider =
crate::platform::socket::token_provider::token_provider_from_config(config);
if let Err(e) = socket_mgr.connect_with_provider(&api_url, provider).await {
diff --git a/crates/openhuman-core/src/tools/ops_tests.rs b/crates/openhuman-core/src/tools/ops_tests.rs
index feb77a62be..cf491b3c71 100644
--- a/crates/openhuman-core/src/tools/ops_tests.rs
+++ b/crates/openhuman-core/src/tools/ops_tests.rs
@@ -377,7 +377,14 @@ const TOOL_LESS: &[crate::core::all::DomainGroup] = {
// `Channels` joined this list when the three `whatsapp_data_*` tools went —
// the channel runtime,
// its controllers and its inbound dispatch are all still there.
- &[G::Config, G::Security, G::Modules, G::Channels, G::Hosted]
+ &[
+ G::Config,
+ G::Security,
+ G::Medulla,
+ G::Modules,
+ G::Channels,
+ G::Hosted,
+ ]
};
// ---- tool_capability() drift guard (M5.3) ----------------------------------