Skip to content

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

feat(config): migrate legacy module registry entries

Steven Enamakelf008f3b6a7ae
diff --git a/crates/openhuman-core/src/config/schema/load/migrate.rs b/crates/openhuman-core/src/config/schema/load/migrate.rs
index f265714ff1..b8cc3afd0a 100644
--- a/crates/openhuman-core/src/config/schema/load/migrate.rs
+++ b/crates/openhuman-core/src/config/schema/load/migrate.rs
@@ -285,7 +285,10 @@ pub(crate) fn migrate_legacy_memory_backend(config: &mut Config, raw: &str) {
/// name, which makes the migration idempotent: once saved, the explicit
/// `components.*` key wins and the legacy key is never consulted again.
pub(crate) fn migrate_components(config: &mut Config, raw: &str) {
+ #[cfg(feature = "tinymemes")]
let tinymemes = std::env::var(crate::tinymemes::FLAG_ENV).ok();
+ #[cfg(not(feature = "tinymemes"))]
+ let tinymemes: Option<String> = None;
migrate_components_with(config, raw, tinymemes.as_deref());
}
@@ -323,9 +326,13 @@ pub(crate) fn migrate_components_with(config: &mut Config, raw: &str, tinymemes:
.and_then(toml::Value::as_str)
.is_some_and(|e| e.trim().eq_ignore_ascii_case("none"));
disable(config, "memory", engine_none.then_some(false));
+ #[cfg(feature = "tinymemes")]
let memes_on = tinymemes
.filter(|v| !v.trim().is_empty())
.map(crate::tinymemes::flag_enabled);
+ // Without the `tinymemes` gate there is no legacy flag to migrate.
+ #[cfg(not(feature = "tinymemes"))]
+ let memes_on = tinymemes.and(None::<bool>);
disable(config, "memes", memes_on);
if !moved.is_empty() {
tracing::info!(
diff --git a/crates/openhuman-core/src/modules/registry.rs b/crates/openhuman-core/src/modules/registry.rs
index 3d40922fda..404fe6247f 100644
--- a/crates/openhuman-core/src/modules/registry.rs
+++ b/crates/openhuman-core/src/modules/registry.rs
@@ -44,25 +44,37 @@ mod records_voice;
use crate::modules::types::ModuleRecord;
use records_computer::TINYCOMPUTER;
-use records_docs_wallet::{TINYDOCS, TINYWALLET};
-use records_extra::{TINYBOX, TINYCHANNELS, TINYHOSTS};
+#[cfg(feature = "documents")]
+use records_docs_wallet::TINYDOCS;
+#[cfg(feature = "web3")]
+use records_docs_wallet::TINYWALLET;
+use records_extra::{TINYBOX, TINYCHANNELS};
+#[cfg(feature = "hosting")]
+use records_extra::TINYHOSTS;
use records_mcp_connectors::{TINYCONNECTORS, TINYMCP};
use records_memory_juice::TINYJUICE;
use records_search::TINYSEARCH;
+#[cfg(feature = "voice")]
use records_voice::TINYVOICE;
-/// Every module this build can load.
+/// Every module this build can load. The records whose contract crate is an
+/// optional dependency (`documents`, `web3`, `voice`, `hosting`) exist only when
+/// that gate is on; a product-feature build carries all eleven.
pub const ALL: &[ModuleRecord] = &[
TINYCOMPUTER,
TINYSEARCH,
+ #[cfg(feature = "documents")]
TINYDOCS,
+ #[cfg(feature = "web3")]
TINYWALLET,
TINYJUICE,
+ #[cfg(feature = "voice")]
TINYVOICE,
TINYMCP,
TINYCONNECTORS,
TINYBOX,
TINYCHANNELS,
+ #[cfg(feature = "hosting")]
TINYHOSTS,
];