The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
feat(config): add environment variable overlay for config loading
Steven Enamakel403b304bc287
diff --git a/crates/openhuman-core/src/config/schema/load/env_overlay.rs b/crates/openhuman-core/src/config/schema/load/env_overlay.rsindex 7a515a2e32..97f93ebc1f 100644--- a/crates/openhuman-core/src/config/schema/load/env_overlay.rs+++ b/crates/openhuman-core/src/config/schema/load/env_overlay.rs@@ -3,6 +3,7 @@//! The entry points and the process-wide side effects live here; each//! config section's overrides live in a submodule below.+mod components;mod dictation_context;mod embeddings;mod modules;@@ -250,6 +251,7 @@ impl Config {self.apply_embedding_env(env);self.apply_update_env(env);self.apply_modules_env(env);+ self.apply_components_env(env);self.apply_dictation_env(env);self.apply_context_env(env);diff --git a/crates/openhuman-core/src/config/schema/mod.rs b/crates/openhuman-core/src/config/schema/mod.rsindex b778f28bd2..9faa705999 100644--- a/crates/openhuman-core/src/config/schema/mod.rs+++ b/crates/openhuman-core/src/config/schema/mod.rs@@ -24,6 +24,8 @@ mod defaults;mod dictation;mod hooks;pub use hooks::HooksConfig;+pub mod components;+pub use components::ComponentsConfig;pub mod hosting;pub use hosting::HostingConfig;pub mod storage;diff --git a/crates/openhuman-core/src/config/schema/types/config.rs b/crates/openhuman-core/src/config/schema/types/config.rsindex c8ff0bd9ec..4318f7ae70 100644--- a/crates/openhuman-core/src/config/schema/types/config.rs+++ b/crates/openhuman-core/src/config/schema/types/config.rs@@ -421,6 +421,11 @@ pub struct Config {#[serde(default)]pub tokenjuice: TokenjuiceConfig,+ /// Per-dependency switches (`[components]`). Narrow-only; applied at the+ /// next core start.+ #[serde(default)]+ pub components: ComponentsConfig,+/// Hosting provider credentials and switch (`hosting` feature).#[serde(default)]pub hosting: HostingConfig,diff --git a/crates/openhuman-core/src/config/schema/types/config_clone.rs b/crates/openhuman-core/src/config/schema/types/config_clone.rsindex c9602e58e8..ef9e556faa 100644--- a/crates/openhuman-core/src/config/schema/types/config_clone.rs+++ b/crates/openhuman-core/src/config/schema/types/config_clone.rs@@ -90,6 +90,7 @@ impl Clone for Config {embeddings_provider: self.embeddings_provider.clone(),custom_embeddings: self.custom_embeddings.clone(),tokenjuice: self.tokenjuice.clone(),+ components: self.components.clone(),hosting: self.hosting.clone(),storage: self.storage.clone(),voice_server: self.voice_server.clone(),diff --git a/crates/openhuman-core/src/config/schema/types/defaults.rs b/crates/openhuman-core/src/config/schema/types/defaults.rsindex c2d7c83e94..c79f7be655 100644--- a/crates/openhuman-core/src/config/schema/types/defaults.rs+++ b/crates/openhuman-core/src/config/schema/types/defaults.rs@@ -103,6 +103,7 @@ impl Default for Config {embeddings_provider: None,custom_embeddings: None,tokenjuice: TokenjuiceConfig::default(),+ components: ComponentsConfig::default(),hosting: HostingConfig::default(),storage: StorageConfig::default(),voice_server: VoiceServerConfig::default(),diff --git a/crates/openhuman-core/src/core/runtime/builder.rs b/crates/openhuman-core/src/core/runtime/builder.rsindex 124c9971fc..e5fc37521f 100644--- a/crates/openhuman-core/src/core/runtime/builder.rs+++ b/crates/openhuman-core/src/core/runtime/builder.rs@@ -27,6 +27,7 @@ use crate::config::Config;use crate::core::runtime::context::CoreContext;use crate::core::types::HostKind;+pub use super::components::ComponentSet;pub use super::domain_set::DomainSet;/// Selects which background services and transports a [`CoreRuntime`] runs.@@ -352,6 +353,11 @@ impl CoreBuilder {).await?;+ let components = config+ .as_ref()+ .map(|c| ComponentSet::from_config(&c.components))+ .unwrap_or_else(ComponentSet::all);+// Retired scheduled jobs must be pruned before `build()` exposes// in-process RPC or agent turns. Running this from `serve()` is too// late for embedders that only build and invoke.@@ -375,7 +381,7 @@ impl CoreBuilder {Ok(CoreRuntime {ctx,config,- services: self.services,+ services: components.narrow_services(self.services),has_operator_token,host: self.host,port: self.port,diff --git a/crates/openhuman-core/src/core/runtime/context.rs b/crates/openhuman-core/src/core/runtime/context.rsindex d2ef0f9fd6..c1b8e4c12c 100644--- a/crates/openhuman-core/src/core/runtime/context.rs+++ b/crates/openhuman-core/src/core/runtime/context.rs@@ -161,8 +161,8 @@ impl CoreContext {pub async fn init_with_config(host_kind: HostKind,token: &TokenSource,- domains: crate::core::runtime::DomainSet,- tool_groups: crate::tools::toolpacks::ToolGroups,+ mut domains: crate::core::runtime::DomainSet,+ mut tool_groups: crate::tools::toolpacks::ToolGroups,preloaded_config: Option<crate::config::Config>,backend_transport: Option<Arc<dyn crate::backend::transport::BackendTransport>>,) -> anyhow::Result<(Arc<CoreContext>, bool, Option<crate::config::Config>)> {@@ -244,6 +244,14 @@ impl CoreContext {}None => crate::config::Config::load_or_init().await,};+ // `[components]` can only narrow what the host chose.+ let components = match &loaded {+ Ok(cfg) => crate::core::runtime::ComponentSet::from_config(&cfg.components),+ Err(_) => crate::core::runtime::ComponentSet::all(),+ };+ domains = components.narrow_domains(domains);+ tool_groups = components.narrow_tool_groups(tool_groups);+ log::debug!("[core-context] init: components={components:?} effective domains={domains:?}");let config = match loaded {Ok(cfg) => {init_stores(&cfg, domains).await;@@ -304,6 +312,11 @@ impl CoreContext {/// Which domain families are live for this context (#4796). The controller/// registry consults this (via [`CoreContext::current`]) to filter its/// schema/dispatch/tool surface. `full()` for desktop/CLI.+ /// The `[components]` switches this context booted with.+ pub fn components(&self) -> crate::core::runtime::ComponentSet {+ self.components+ }+/// Per-group tool disclosure for this context.pub fn tool_groups(&self) -> crate::tools::toolpacks::ToolGroups {self.tool_groups.clone()diff --git a/crates/openhuman-core/src/core/runtime/mod.rs b/crates/openhuman-core/src/core/runtime/mod.rsindex 35d84aaee2..77201aa748 100644--- a/crates/openhuman-core/src/core/runtime/mod.rs+++ b/crates/openhuman-core/src/core/runtime/mod.rs@@ -47,6 +47,8 @@ pub mod agent_scope;pub mod boot_guard;mod bootstrap;pub mod builder;+mod components;+pub use components::{ComponentSet, COMPONENT_NAMES};pub mod context;pub mod domain_set;mod features;