Skip to content

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

feat(hosting): add hosting configuration schema

Steven Enamakel788070bffa7e
diff --git a/crates/openhuman-core/src/config/schema/hosting.rs b/crates/openhuman-core/src/config/schema/hosting.rs
index 4c6607c810..e7b04b094f 100644
--- a/crates/openhuman-core/src/config/schema/hosting.rs
+++ b/crates/openhuman-core/src/config/schema/hosting.rs
@@ -1,7 +1,7 @@
//! Hosting provider configuration (`[hosting]`).
//!
-//! Where the credential for a hosting provider comes from, and whether the
-//! `hosting_*` agent tools are offered at all. Read by
+//! Where the credential for a hosting provider comes from. Whether the
+//! `hosting_*` agent tools are offered at all is `[components] hosting`. Read by
//! [`crate::hosting::Account`] when it resolves an account, and
//! by the tool registry when it decides whether to register the tools.
//!
@@ -16,11 +16,6 @@ use serde::{Deserialize, Serialize};
#[derive(Clone, Serialize, Deserialize, JsonSchema)]
#[serde(default)]
pub struct HostingConfig {
- /// Master switch. When `false`, no hosting tool is registered, whatever
- /// credentials exist.
- #[serde(default)]
- pub enabled: bool,
-
/// The provider slug to act on — today, `vercel`.
#[serde(default = "default_provider")]
pub provider: String,
@@ -41,7 +36,6 @@ impl std::fmt::Debug for HostingConfig {
/// so a nested `{:?}` must never render the raw credential.
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_struct("HostingConfig")
- .field("enabled", &self.enabled)
.field("provider", &self.provider)
.field(
"api_key",
@@ -59,7 +53,6 @@ fn default_provider() -> String {
impl Default for HostingConfig {
fn default() -> Self {
Self {
- enabled: false,
provider: default_provider(),
api_key: String::new(),
team: String::new(),
diff --git a/crates/openhuman-core/src/config/schema/hosting_tests.rs b/crates/openhuman-core/src/config/schema/hosting_tests.rs
index f654f8d094..8109901634 100644
--- a/crates/openhuman-core/src/config/schema/hosting_tests.rs
+++ b/crates/openhuman-core/src/config/schema/hosting_tests.rs
@@ -1,10 +1,9 @@
use super::*;
#[test]
-fn hosting_is_off_and_points_at_vercel_by_default() {
+fn hosting_points_at_vercel_by_default() {
let config = HostingConfig::default();
- assert!(!config.enabled);
assert_eq!(config.provider, "vercel");
assert!(!config.has_api_key());
assert_eq!(config.team(), None);
@@ -25,7 +24,6 @@ fn a_blank_key_or_team_is_the_same_as_none() {
#[test]
fn a_configured_key_and_team_are_reported() {
let config = HostingConfig {
- enabled: true,
api_key: "token".to_string(),
team: " team_abc ".to_string(),
..HostingConfig::default()
diff --git a/crates/openhuman-core/src/hosting/hosting_tests.rs b/crates/openhuman-core/src/hosting/hosting_tests.rs
index fb625227b6..aa20f10d6b 100644
--- a/crates/openhuman-core/src/hosting/hosting_tests.rs
+++ b/crates/openhuman-core/src/hosting/hosting_tests.rs
@@ -7,7 +7,7 @@ use std::sync::{Arc, Mutex};
fn config_with(workspace: &std::path::Path, enabled: bool, api_key: &str) -> Config {
let mut config = Config::default();
config.workspace_dir = workspace.to_path_buf();
- config.hosting.enabled = enabled;
+ config.components.hosting = enabled;
config.hosting.api_key = api_key.to_string();
config
}
@@ -21,7 +21,6 @@ fn account_fixture(
) -> Account {
let mut config = Config::default();
config.workspace_dir = workspace_dir;
- config.hosting.enabled = true;
config.hosting.api_key = "fixture-secret".to_owned();
let account = Account::from_config(&config)
.expect("configuration")
diff --git a/crates/openhuman-core/src/hosting/mod.rs b/crates/openhuman-core/src/hosting/mod.rs
index 1695e1d7a4..9ec028f053 100644
--- a/crates/openhuman-core/src/hosting/mod.rs
+++ b/crates/openhuman-core/src/hosting/mod.rs
@@ -48,7 +48,8 @@ impl std::fmt::Debug for Account {
impl Account {
/// Resolve the enabled provider and credential without loading its module.
pub fn from_config(config: &Config) -> anyhow::Result<Option<Self>> {
- if !config.hosting.enabled {
+ if !crate::core::runtime::ComponentSet::from_config(&config.components).hosting {
+ tracing::debug!("[hosting] component disabled; tools not registered");
return Ok(None);
}
let provider = config.hosting.provider.trim().to_ascii_lowercase();