Skip to content

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

feat(profiles): add host profile support to threads and web chat

Steven Enamakel2594c51d2141
diff --git a/crates/openhuman-core/src/profiles/host.rs b/crates/openhuman-core/src/profiles/host.rs
index 3f4aef903f..912cf59c3b 100644
--- a/crates/openhuman-core/src/profiles/host.rs
+++ b/crates/openhuman-core/src/profiles/host.rs
@@ -570,7 +570,9 @@ impl ProfileHost {
);
let stopped = CoreContext::scope(
Arc::clone(state.context()),
- crate::web_chat::cancel_all_turns(),
+ crate::web_chat::cancel_all_turns(&crate::core::runtime::DispatchCtx::new(Arc::clone(
+ state.context(),
+ ))),
)
.await;
log::info!("[profiles] fenced profile={id}: stopped {stopped} thread(s)");
diff --git a/crates/openhuman-core/src/threads/ops/crud.rs b/crates/openhuman-core/src/threads/ops/crud.rs
index 5598119986..04db99beeb 100644
--- a/crates/openhuman-core/src/threads/ops/crud.rs
+++ b/crates/openhuman-core/src/threads/ops/crud.rs
@@ -459,7 +459,7 @@ async fn thread_delete_inner(
// returns early on error; if invalidation ran after, an active
// session for the now-deleted thread could linger and try to
// append to a thread index row that no longer exists.
- web_channel::invalidate_thread_sessions(ctx, &request.thread_id).await;
+ web_channel::invalidate_thread_sessions(&ctx, &request.thread_id).await;
// Cancel any detached sub-agents this thread spawned BEFORE clearing their
// queued results: abort the in-flight ones first so a child can't record a
// completion in the gap between the two calls, then discard anything already
diff --git a/crates/openhuman-core/src/web_chat/schemas.rs b/crates/openhuman-core/src/web_chat/schemas.rs
index ed4b600d10..55ea5d4022 100644
--- a/crates/openhuman-core/src/web_chat/schemas.rs
+++ b/crates/openhuman-core/src/web_chat/schemas.rs
@@ -191,31 +191,31 @@ fn handle_chat(ctx: DispatchCtx, params: Map<String, Value>) -> ControllerFuture
})
}
-fn handle_queue_status(_ctx: DispatchCtx, params: Map<String, Value>) -> ControllerFuture {
+fn handle_queue_status(ctx: DispatchCtx, params: Map<String, Value>) -> ControllerFuture {
Box::pin(async move {
let p = deserialize_params::<WebQueueParams>(params)?;
- to_json(channel_web_queue_status(&p.thread_id).await?)
+ to_json(channel_web_queue_status(&ctx, &p.thread_id).await?)
})
}
-fn handle_queue_clear(_ctx: DispatchCtx, params: Map<String, Value>) -> ControllerFuture {
+fn handle_queue_clear(ctx: DispatchCtx, params: Map<String, Value>) -> ControllerFuture {
Box::pin(async move {
let p = deserialize_params::<WebQueueParams>(params)?;
- to_json(channel_web_queue_clear(&p.thread_id).await?)
+ to_json(channel_web_queue_clear(&ctx, &p.thread_id).await?)
})
}
-fn handle_queue_remove(_ctx: DispatchCtx, params: Map<String, Value>) -> ControllerFuture {
+fn handle_queue_remove(ctx: DispatchCtx, params: Map<String, Value>) -> ControllerFuture {
Box::pin(async move {
let p = deserialize_params::<WebQueueRemoveParams>(params)?;
- to_json(channel_web_queue_remove(&p.client_id, &p.thread_id, &p.item_id).await?)
+ to_json(channel_web_queue_remove(&ctx, &p.client_id, &p.thread_id, &p.item_id).await?)
})
}
-fn handle_cancel(_ctx: DispatchCtx, params: Map<String, Value>) -> ControllerFuture {
+fn handle_cancel(ctx: DispatchCtx, params: Map<String, Value>) -> ControllerFuture {
Box::pin(async move {
let p = deserialize_params::<WebCancelParams>(params)?;
- to_json(channel_web_cancel(&p.client_id, &p.thread_id, p.request_id.as_deref()).await?)
+ to_json(channel_web_cancel(&ctx, &p.client_id, &p.thread_id, p.request_id.as_deref()).await?)
})
}
diff --git a/crates/openhuman-rpc/src/server/socketio.rs b/crates/openhuman-rpc/src/server/socketio.rs
index f85ac22aa8..f193fba05c 100644
--- a/crates/openhuman-rpc/src/server/socketio.rs
+++ b/crates/openhuman-rpc/src/server/socketio.rs
@@ -488,6 +488,7 @@ pub fn attach_socketio() -> (socketioxide::layer::SocketIoLayer, SocketIo) {
payload.thread_id
);
let _ = crate::core_host::web_chat::cancel_chat_scoped(
+ &crate::core_host::core::runtime::DispatchCtx::host_default(),
&client_id,
&payload.thread_id,
payload.request_id.as_deref(),