The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
refactor(turn_host): route web chat turns through shared turn host
Steven Enamakelcf1cf09beb98
diff --git a/crates/openhuman-core/src/agent/turn_host.rs b/crates/openhuman-core/src/agent/turn_host.rsindex 5116258a5d..5f95c80959 100644--- a/crates/openhuman-core/src/agent/turn_host.rs+++ b/crates/openhuman-core/src/agent/turn_host.rs@@ -7,7 +7,6 @@use std::{sync::Arc, time::Duration};use tinyagents_harness::{CancellationToken, run_queue::RunQueue};-use tinyagents_runtime::turn_runner::TurnSignal;use tokio::sync::mpsc;use crate::{@@ -47,7 +46,12 @@ pub(crate) async fn run_session_turn(session.set_on_progress(request.progress);session.set_run_queue(request.run_queue);session.set_thread_id(request.thread_id);- session.set_host_env(request.host_env);+ let mut host_env = request.host_env;+ host_env.cancellation = Some(request.cancellation);+ host_env.turn_deadline = request+ .turn_deadline+ .map(tinyagents_harness::turn_deadline::TurnDeadline::starting_now);+ session.set_host_env(host_env);if let Some(workspace) = request.workspace {session.set_workspace_descriptor(Some(workspace));}diff --git a/crates/openhuman-core/src/web_chat/turn_host.rs b/crates/openhuman-core/src/web_chat/turn_host.rsindex 851661585e..27a5f534cd 100644--- a/crates/openhuman-core/src/web_chat/turn_host.rs+++ b/crates/openhuman-core/src/web_chat/turn_host.rs@@ -232,23 +232,6 @@ impl WebHost {let _tap = AbortOnDrop(tap);let _beat = AbortOnDrop(spawn_heartbeat(&ctx, projection.clone()));- agent.set_on_progress(Some(progress_tx));- agent.set_run_queue(Some(queue));- agent.set_thread_id(Some(thread_id));- agent.set_host_env(crate::agent::turn_env::HostTurnEnv {- cancellation: Some(cancellation),- turn_deadline: request- .deadline- .map(tinyagents_harness::turn_deadline::TurnDeadline::starting_now),- ..Default::default()- });- // Also the turn's workspace, so attachment reads and delegated- // sub-agents (which load a fresh config) use the folder its uploads- // were staged in (#7714).- if let Some(dir) = thread_dir {- agent.set_workspace_descriptor(Some(tinytools::WorkspaceDescriptor::new(dir)));- }-let origin = AgentTurnOrigin::WebChat {thread_id: thread_id.to_owned(),client_id: payload.client_id.clone(),@@ -268,7 +251,24 @@ impl WebHost {let turn_started = std::time::Instant::now();let turn = Box::pin(with_origin(origin.clone(),- agent.run_single_with_approval(&request.text, Some(origin), approval),+ crate::agent::turn_host::run_session_turn(+ agent,+ crate::agent::turn_host::AgentTurnRequest {+ message: request.text.clone(),+ thread_id: Some(thread_id.to_owned()),+ origin,+ approval,+ progress: Some(progress_tx),+ run_queue: Some(queue),+ cancellation,+ turn_deadline: request.deadline,+ // Also the turn's workspace, so attachment reads and+ // delegated sub-agents use the upload folder (#7714).+ workspace: thread_dir+ .map(tinytools::WorkspaceDescriptor::new),+ host_env: Default::default(),+ },+ ),));let outcome = turn.await;let result = match outcome {