Skip to content

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

refactor(user_agents): hand-write Debug for UserAgentState

Steven Enamakel51c560dff724
diff --git a/crates/openhuman-core/src/user_agents/host.rs b/crates/openhuman-core/src/user_agents/host.rs
index 5cbe3c921c..44c6cb409c 100644
--- a/crates/openhuman-core/src/user_agents/host.rs
+++ b/crates/openhuman-core/src/user_agents/host.rs
@@ -21,7 +21,6 @@ use crate::core::runtime::{ContextOverlay, CoreContext, DomainSet, SaasConfig};
use crate::tools::toolpacks::ToolGroups;
/// One open user agent.
-#[derive(Debug)]
pub struct UserAgentState {
pub id: UserAgentId,
pub layout: UserAgentLayout,
@@ -29,6 +28,12 @@ pub struct UserAgentState {
context: Arc<CoreContext>,
}
+impl std::fmt::Debug for UserAgentState {
+ fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+ f.debug_struct("UserAgentState").field("id", &self.id).finish()
+ }
+}
+
impl UserAgentState {
/// The context every piece of this agent's work runs under.
pub fn context(&self) -> &Arc<CoreContext> {
diff --git a/crates/openhuman-core/src/user_agents/ops.rs b/crates/openhuman-core/src/user_agents/ops.rs
index 1064f6d47e..787e54d1cc 100644
--- a/crates/openhuman-core/src/user_agents/ops.rs
+++ b/crates/openhuman-core/src/user_agents/ops.rs
@@ -15,7 +15,7 @@ fn require_host() -> Result<std::sync::Arc<AgentHost>, String> {
/// Create the agent for gateway user `user_id`, if it does not exist yet.
pub fn provision(user_id: &str) -> Result<Outcome<ProvisionResult>, String> {
- provision_on(&require_host()?, user_id)
+ provision_on(&*require_host()?, user_id)
}
pub(crate) fn provision_on(
@@ -34,7 +34,7 @@ pub(crate) fn provision_on(
/// Close agent `agent_id` and archive its state.
pub fn deprovision(agent_id: &str) -> Result<Outcome<DeprovisionResult>, String> {
- deprovision_on(&require_host()?, agent_id)
+ deprovision_on(&*require_host()?, agent_id)
}
pub(crate) fn deprovision_on(
@@ -60,7 +60,7 @@ pub fn list() -> Result<Outcome<Vec<UserAgentSummary>>, String> {
/// One agent, or an error when it is not provisioned.
pub fn status(agent_id: &str) -> Result<Outcome<UserAgentSummary>, String> {
- status_on(&require_host()?, agent_id)
+ status_on(&*require_host()?, agent_id)
}
pub(crate) fn status_on(