Skip to content

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

feat(profiles): add profile management module

Steven Enamakel184367ba6aaf
diff --git a/crates/openhuman-core/src/profiles/background.rs b/crates/openhuman-core/src/profiles/background.rs
index 2fb60ef8ef..2420e4eb5f 100644
--- a/crates/openhuman-core/src/profiles/background.rs
+++ b/crates/openhuman-core/src/profiles/background.rs
@@ -1,4 +1,4 @@
-//! Background work for user agents.
+//! Background work for profiles.
//!
//! A single-user core drains its memory job queue from a cron system job,
//! gated by the process-wide scheduler gate. Neither fits SaaS: the cron
diff --git a/crates/openhuman-core/src/profiles/credentials.rs b/crates/openhuman-core/src/profiles/credentials.rs
index ab2cefc859..8fb0f61770 100644
--- a/crates/openhuman-core/src/profiles/credentials.rs
+++ b/crates/openhuman-core/src/profiles/credentials.rs
@@ -1,9 +1,9 @@
-//! A user agent's backend credential.
+//! A profile's backend credential.
//!
//! The gateway hands the core each user's TinyHumans credential — a session
//! JWT or an API key — through the operator plane. It is stored where every
//! backend caller already looks: the auth-profile store beside the agent's
-//! `config_path` (`<root>/agents/<id>/`). Work running under that agent's
+//! `config_path` (`<root>/users/<id>/`). Work running under that agent's
//! context loads the agent's config, so `resolve_backend_credential` finds
//! that user's credential and no other.
//!
diff --git a/crates/openhuman-core/src/profiles/host.rs b/crates/openhuman-core/src/profiles/host.rs
index 5c8401b740..38dc91b554 100644
--- a/crates/openhuman-core/src/profiles/host.rs
+++ b/crates/openhuman-core/src/profiles/host.rs
@@ -1,6 +1,6 @@
-//! [`ProfileHost`]: the user agents a SaaS process has open.
+//! [`ProfileHost`]: the profiles a SaaS process has open.
//!
-//! A user agent is opened lazily on first use and kept until it has been idle
+//! A profile is opened lazily on first use and kept until it has been idle
//! for [`SaasConfig::idle_evict_secs`] or the host needs its slot
//! ([`SaasConfig::max_profiles_open`]). An agent still in use — anyone holding
//! its [`Profile`] — is never evicted.
@@ -20,7 +20,7 @@ use crate::config::Config;
use crate::core::runtime::{ContextOverlay, CoreContext, DomainSet, SaasConfig};
use crate::tools::toolpacks::ToolGroups;
-/// One open user agent.
+/// One open profile.
pub struct Profile {
pub id: ProfileId,
pub layout: ProfileLayout,
@@ -48,7 +48,7 @@ struct Slot {
last_used: Instant,
}
-/// The open user agents of one SaaS process.
+/// The open profiles of one SaaS process.
pub struct ProfileHost {
saas: SaasConfig,
operator: Arc<CoreContext>,
@@ -69,7 +69,7 @@ impl std::fmt::Debug for ProfileHost {
}
}
-/// The domain families a user agent's context serves. Within them, only the
+/// The domain families a profile's context serves. Within them, only the
/// methods on [`USER_METHODS`](super::surface::USER_METHODS) are reachable.
pub fn user_domains() -> DomainSet {
DomainSet {
@@ -373,7 +373,7 @@ pub fn host() -> Option<Arc<ProfileHost>> {
HOST.get().cloned()
}
-/// The user agent the current work runs for, if any.
+/// The profile the current work runs for, if any.
pub fn current() -> Option<Arc<Profile>> {
let agent = CoreContext::current()?.session_agent()?.to_owned();
let id = ProfileId::parse(&agent).ok()?;
diff --git a/crates/openhuman-core/src/profiles/mod.rs b/crates/openhuman-core/src/profiles/mod.rs
index e0908d742f..7bbe9610ed 100644
--- a/crates/openhuman-core/src/profiles/mod.rs
+++ b/crates/openhuman-core/src/profiles/mod.rs
@@ -1,4 +1,4 @@
-//! User agents: in SaaS mode, each user is served as one agent.
+//! Profiles: in SaaS mode, each user is served as one agent.
//!
//! The gateway authenticates users; this domain turns a gateway user id into
//! the agent that serves that user ([`ProfileId`]), lays out the agent's
diff --git a/crates/openhuman-core/src/profiles/ops.rs b/crates/openhuman-core/src/profiles/ops.rs
index 3636c127f4..5e5b57ca78 100644
--- a/crates/openhuman-core/src/profiles/ops.rs
+++ b/crates/openhuman-core/src/profiles/ops.rs
@@ -1,4 +1,4 @@
-//! Operator-plane operations on user agents.
+//! Operator-plane operations on profiles.
//!
//! Gateway user ids are taken here and turned into agent ids at once; they
//! are never logged, stored or returned.
@@ -11,7 +11,7 @@ use super::types::{
use crate::core::Outcome;
fn require_host() -> Result<std::sync::Arc<ProfileHost>, String> {
- host::host().ok_or_else(|| "user agents exist only in SaaS mode".to_string())
+ host::host().ok_or_else(|| "profiles exist only in SaaS mode".to_string())
}
/// Create the agent for gateway user `user_id`, if it does not exist yet.
@@ -61,7 +61,7 @@ pub(crate) fn deprovision_on(
/// Every provisioned agent.
pub fn list() -> Result<Outcome<Vec<ProfileSummary>>, String> {
let agents = require_host()?.list()?;
- let log = format!("{} user agent(s)", agents.len());
+ let log = format!("{} profile(s)", agents.len());
Ok(Outcome::single_log(agents, log))
}
diff --git a/crates/openhuman-core/src/profiles/schemas.rs b/crates/openhuman-core/src/profiles/schemas.rs
index 739d550f99..1ea90ece55 100644
--- a/crates/openhuman-core/src/profiles/schemas.rs
+++ b/crates/openhuman-core/src/profiles/schemas.rs
@@ -88,7 +88,7 @@ pub fn profiles_schemas(function: &str) -> ControllerSchema {
"deprovision" => ControllerSchema {
namespace: "profiles",
function: "deprovision",
- description: "Close a user agent and archive its state. Nothing is deleted.",
+ description: "Close a profile and archive its state. Nothing is deleted.",
inputs: vec![string_field("profile_id", "The agent to deprovision.")],
outputs: vec![
string_field("profile_id", "The agent."),
@@ -98,10 +98,10 @@ pub fn profiles_schemas(function: &str) -> ControllerSchema {
"list" => ControllerSchema {
namespace: "profiles",
function: "list",
- description: "List every provisioned user agent.",
+ description: "List every provisioned profile.",
inputs: vec![],
outputs: vec![FieldSchema {
- name: "agents",
+ name: "profiles",
ty: TypeSchema::Array(Box::new(TypeSchema::Json)),
comment: "profile_id, created_at and whether it is open.",
required: true,
@@ -110,7 +110,7 @@ pub fn profiles_schemas(function: &str) -> ControllerSchema {
"status" => ControllerSchema {
namespace: "profiles",
function: "status",
- description: "Report one provisioned user agent.",
+ description: "Report one provisioned profile.",
inputs: vec![string_field("profile_id", "The agent to report.")],
outputs: vec![
string_field("profile_id", "The agent."),
@@ -127,7 +127,7 @@ pub fn profiles_schemas(function: &str) -> ControllerSchema {
"set_credential" => ControllerSchema {
namespace: "profiles",
function: "set_credential",
- description: "Install the TinyHumans credential the gateway holds for a user agent. \
+ description: "Install the TinyHumans credential the gateway holds for a profile. \
The core stores it beside the agent's state and never validates or echoes it.",
inputs: vec![
string_field("profile_id", "The agent the credential belongs to."),
@@ -155,7 +155,7 @@ pub fn profiles_schemas(function: &str) -> ControllerSchema {
"clear_credential" => ControllerSchema {
namespace: "profiles",
function: "clear_credential",
- description: "Remove every credential a user agent holds.",
+ description: "Remove every credential a profile holds.",
inputs: vec![string_field("profile_id", "The agent.")],
outputs: vec![
string_field("profile_id", "The agent."),
@@ -165,7 +165,7 @@ pub fn profiles_schemas(function: &str) -> ControllerSchema {
_ => ControllerSchema {
namespace: "profiles",
function: "unknown",
- description: "Unknown user_agents controller.",
+ description: "Unknown profiles controller.",
inputs: vec![],
outputs: vec![string_field("error", "Lookup error details.")],
},
diff --git a/crates/openhuman-core/src/profiles/schemas_tests.rs b/crates/openhuman-core/src/profiles/schemas_tests.rs
index 474ac3adb8..5ba943d769 100644
--- a/crates/openhuman-core/src/profiles/schemas_tests.rs
+++ b/crates/openhuman-core/src/profiles/schemas_tests.rs
@@ -7,7 +7,7 @@ fn every_controller_has_a_schema_and_a_handler() {
assert_eq!(schemas.len(), FUNCTIONS.len());
assert_eq!(controllers.len(), FUNCTIONS.len());
for (schema, controller) in schemas.iter().zip(&controllers) {
- assert_eq!(schema.namespace, "user_agents");
+ assert_eq!(schema.namespace, "profiles");
assert_eq!(schema.function, controller.schema.function);
assert_ne!(schema.function, "unknown");
}
diff --git a/crates/openhuman-core/src/profiles/surface.rs b/crates/openhuman-core/src/profiles/surface.rs
index 77ecbb7176..84f0bafcb3 100644
--- a/crates/openhuman-core/src/profiles/surface.rs
+++ b/crates/openhuman-core/src/profiles/surface.rs
@@ -1,6 +1,6 @@
//! What a user may call in SaaS mode.
//!
-//! A user agent's context enables a few domain families
+//! A profile's context enables a few domain families
//! ([`host::user_domains`](super::host::user_domains)), but a family is too
//! coarse to open whole: `threads` also holds operations that start model
//! turns or reach the host. So in a user's scope every RPC method must also
diff --git a/crates/openhuman-core/src/profiles/tools.rs b/crates/openhuman-core/src/profiles/tools.rs
index 37c8daa4e9..94e59e9f00 100644
--- a/crates/openhuman-core/src/profiles/tools.rs
+++ b/crates/openhuman-core/src/profiles/tools.rs
@@ -1,6 +1,6 @@
//! Which agent tools a user gets in SaaS mode, and where they run.
//!
-//! A user agent's tool list starts from its domain families
+//! A profile's tool list starts from its domain families
//! ([`host::user_domains`](super::host::user_domains)): memory and thread
//! tools, nothing that reaches the host. Shell and file tools sit in the
//! `Platform` family, which a user context never enables. The operator opts
@@ -166,7 +166,7 @@ pub fn admits(tool: &str, domain_ok: bool) -> bool {
}
let admitted = admits_with(tool, domain_ok, &allowlisted());
if !admitted && domain_ok {
- log::debug!("[profiles][tools] withholding `{tool}` from user agents");
+ log::debug!("[profiles][tools] withholding `{tool}` from profiles");
}
admitted
}