Skip to content

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

feat(user_agents): expose web chat and thread control to user agents

Steven Enamakel701ebe2c9d29
diff --git a/crates/openhuman-core/src/agent/prompts/sections.rs b/crates/openhuman-core/src/agent/prompts/sections.rs
index fed4c8ff80..513ea7bf19 100644
--- a/crates/openhuman-core/src/agent/prompts/sections.rs
+++ b/crates/openhuman-core/src/agent/prompts/sections.rs
@@ -430,8 +430,13 @@ impl PromptSection for RuntimeSection {
}
fn build(&self, ctx: &PromptContext<'_>) -> Result<String> {
- let host =
- hostname::get().map_or_else(|_| "unknown".into(), |h| h.to_string_lossy().to_string());
+ // A SaaS process serves many users; the machine it runs on is not
+ // theirs to know.
+ let host = if crate::core::runtime::is_saas() {
+ "hosted".to_string()
+ } else {
+ hostname::get().map_or_else(|_| "unknown".into(), |h| h.to_string_lossy().to_string())
+ };
Ok(format!(
"## Runtime\n\nHost: {host} | OS: {} | Model: {}",
std::env::consts::OS,
diff --git a/crates/openhuman-core/src/core/runtime/saas.rs b/crates/openhuman-core/src/core/runtime/saas.rs
index 0c91a13d65..b3ced1e26f 100644
--- a/crates/openhuman-core/src/core/runtime/saas.rs
+++ b/crates/openhuman-core/src/core/runtime/saas.rs
@@ -147,6 +147,7 @@ impl DomainSet {
Self {
operator: true,
threads: true,
+ channels: true,
..Self::none()
}
}
diff --git a/crates/openhuman-core/src/core/runtime/saas_tests.rs b/crates/openhuman-core/src/core/runtime/saas_tests.rs
index aba413be44..3e751a1aa6 100644
--- a/crates/openhuman-core/src/core/runtime/saas_tests.rs
+++ b/crates/openhuman-core/src/core/runtime/saas_tests.rs
@@ -87,6 +87,7 @@ fn the_saas_presets_are_closed() {
DomainSet {
operator: true,
threads: true,
+ channels: true,
..DomainSet::none()
},
"the operator plane plus the user families isolated so far"
diff --git a/crates/openhuman-core/src/user_agents/host.rs b/crates/openhuman-core/src/user_agents/host.rs
index a0740ac138..010b27f65e 100644
--- a/crates/openhuman-core/src/user_agents/host.rs
+++ b/crates/openhuman-core/src/user_agents/host.rs
@@ -69,6 +69,7 @@ impl std::fmt::Debug for AgentHost {
pub fn user_domains() -> DomainSet {
DomainSet {
threads: true,
+ channels: true,
..DomainSet::none()
}
}
diff --git a/crates/openhuman-core/src/user_agents/surface.rs b/crates/openhuman-core/src/user_agents/surface.rs
index d1255d3575..551abf5f24 100644
--- a/crates/openhuman-core/src/user_agents/surface.rs
+++ b/crates/openhuman-core/src/user_agents/surface.rs
@@ -37,6 +37,17 @@ pub const USER_METHODS: &[&str] = &[
"openhuman.threads_transcript_get",
"openhuman.threads_goal_get",
"openhuman.threads_todos_get",
+ // Turns on a user's own threads. Their events carry the user's agent and
+ // reach only that user's `/events` stream.
+ "openhuman.threads_generate_title",
+ "openhuman.threads_edit_message",
+ "openhuman.threads_regenerate",
+ // Web chat: start, cancel and queue control for the user's own threads.
+ "openhuman.channel_web_chat",
+ "openhuman.channel_web_cancel",
+ "openhuman.channel_web_queue_status",
+ "openhuman.channel_web_queue_clear",
+ "openhuman.channel_web_queue_remove",
];
/// Whether `method` (of an operator-plane controller or not) may be
diff --git a/crates/openhuman-core/src/user_agents/surface_tests.rs b/crates/openhuman-core/src/user_agents/surface_tests.rs
index 89d03bbcd6..c9d9801165 100644
--- a/crates/openhuman-core/src/user_agents/surface_tests.rs
+++ b/crates/openhuman-core/src/user_agents/surface_tests.rs
@@ -39,11 +39,13 @@ fn the_saas_planes_never_overlap() {
}
#[test]
-fn turn_starting_thread_methods_stay_closed_for_now() {
+fn chat_is_open_but_other_channel_methods_are_not() {
+ assert!(visible_in(true, true, "openhuman.channel_web_chat", false));
+ assert!(visible_in(true, true, "openhuman.threads_regenerate", false));
for method in [
- "openhuman.threads_generate_title",
- "openhuman.threads_edit_message",
- "openhuman.threads_regenerate",
+ "openhuman.channels_list",
+ "openhuman.channels_connect",
+ "openhuman.config_update_autonomy_settings",
] {
assert!(!visible_in(true, true, method, false), "{method}");
}