Skip to content

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

feat(profiles): add gateway and ops profile modules

Steven Enamakelaf7741bda2d0
diff --git a/crates/openhuman-core/src/core/runtime/saas.rs b/crates/openhuman-core/src/core/runtime/saas.rs
index 84b408a68f..5a6a3a4c37 100644
--- a/crates/openhuman-core/src/core/runtime/saas.rs
+++ b/crates/openhuman-core/src/core/runtime/saas.rs
@@ -49,12 +49,12 @@ pub struct SaasConfig {
#[serde(default)]
pub rpc_allowlist_extra: Vec<String>,
/// Most profiles kept open at once.
- #[serde(default = "default_max_profiles_open")]
+ #[serde(default = "default_max_profiles_open", alias = "max_agents_open")]
pub max_profiles_open: usize,
/// How a gateway user id becomes a profile id: `"raw"` (the default) keeps
/// an id that already fits `^[a-z0-9][a-z0-9_-]{0,63}$` and is not
/// reserved, hashing anything else; `"hashed"` hashes every id
- /// (`profiles::ProfileIdMode`). Changing it re-maps users to new profiles.
+ /// (`profiles::ProfileIdMode`). Changing it may re-map users onto different profiles.
#[serde(default)]
pub profile_ids: crate::profiles::ProfileIdMode,
/// Seconds an idle profile stays open.
diff --git a/crates/openhuman-core/src/profiles/README.md b/crates/openhuman-core/src/profiles/README.md
index aab57f5287..b309a41571 100644
--- a/crates/openhuman-core/src/profiles/README.md
+++ b/crates/openhuman-core/src/profiles/README.md
@@ -26,7 +26,7 @@ not migrated.
## Profile ids
-`[saas] profile_ids` picks how a gateway user id becomes a `ProfileId`:
+The top-level `profile_ids` setting (`profile_ids = "hashed"`, not under a table) picks how a gateway user id becomes a `ProfileId`:
- `"raw"` (the default): a user id matching `^[a-z0-9][a-z0-9_-]{0,63}$` is
used unchanged, so the desktop's 24-hex backend ids pass through. `local`,
@@ -35,7 +35,7 @@ not migrated.
characters of `sha256(user_id)`.
Both forms fit the agent-id charset and can never contain a path separator.
-Changing the mode re-maps users onto different profiles.
+Changing the mode may re-map users onto different profiles.
## Files
diff --git a/crates/openhuman-core/src/profiles/gateway.rs b/crates/openhuman-core/src/profiles/gateway.rs
index 2c5bcf61b5..2fb5af74fb 100644
--- a/crates/openhuman-core/src/profiles/gateway.rs
+++ b/crates/openhuman-core/src/profiles/gateway.rs
@@ -114,13 +114,13 @@ pub fn resolve_scope(
let signature = signature
.ok_or_else(|| GatewayRefusal::new(401, format!("missing {USER_SIG_HEADER}")))?;
verify(secret, user_id, signature, now).map_err(|e| {
- log::warn!("[profiles][gateway] refused profile={profile}: {e}");
+ log::warn!("[profiles][gateway] refused a scoped request: {e}");
GatewayRefusal::new(401, e)
})?;
}
match host.open(&profile) {
Ok(state) => {
- log::debug!("[profiles][gateway] scoped request to profile={profile}");
+ log::debug!("[profiles][gateway] scoped request to an open profile");
Ok(GatewayScope::User(state))
}
Err(e) if e.contains("not provisioned") => Err(GatewayRefusal::new(403, e)),
diff --git a/crates/openhuman-core/src/profiles/ops.rs b/crates/openhuman-core/src/profiles/ops.rs
index 79676afcac..7d51aa73c5 100644
--- a/crates/openhuman-core/src/profiles/ops.rs
+++ b/crates/openhuman-core/src/profiles/ops.rs
@@ -112,7 +112,7 @@ pub(crate) fn set_credential_on(
// work even when every profile slot is busy.
let config = host.provisioned_config(&profile_id)?;
credentials::store(&config, kind, token, expires_at)?;
- log::info!("[profiles] credential installed for profile={profile_id} kind={kind:?}");
+ log::info!("[profiles] credential installed kind={kind:?}");
Ok(Outcome::single_log(
CredentialResult {
profile_id: profile_id.clone(),
@@ -134,7 +134,7 @@ pub(crate) fn clear_credential_on(
let profile_id = ProfileId::parse(profile_id)?;
let config = host.provisioned_config(&profile_id)?;
let removed = credentials::clear(&config)?;
- log::info!("[profiles] credential cleared for profile={profile_id} removed={removed}");
+ log::info!("[profiles] credential cleared removed={removed}");
let log = if removed {
format!("credential cleared for {profile_id}")
} else {