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(session_host): inline chat turn spec construction into driver
Steven Enamakel9d9dad34c86f
diff --git a/crates/openhuman-core/src/agent/session_host/driver.rs b/crates/openhuman-core/src/agent/session_host/driver.rsindex 50a52d941a..648d5950ca 100644--- a/crates/openhuman-core/src/agent/session_host/driver.rs+++ b/crates/openhuman-core/src/agent/session_host/driver.rs@@ -16,9 +16,8 @@ use tinyagents_session::transcript::TranscriptMessage;use tinyinference_llm::message::Message;use tinytools_agent::dialect::ToolDialect;-use crate::agent::session_host::turn::chat_spec::build_chat_turn_spec;use crate::agent::tinyagents::{- host::OpenHumanHostBase, host::OpenHumanRunContext, TurnModelSource,+ host::OpenHumanHostBase, host::OpenHumanRunContext, TurnModelSource, TurnSpec,};/// Immutable host composition consumed by [`OpenHumanSessionDriver`].@@ -194,20 +193,30 @@ impl SessionDriver<OpenHumanRunContext> for OpenHumanSessionDriver {let mut run_context = run_context;run_context.workspace = self.workspace.clone().or(run_context.workspace);run_context.sandbox_mode = Some(self.sandbox_mode);- build_chat_turn_spec(+ let provider_id = turn_models.provider_id().to_string();+ TurnSpec {run_context,turn_models,- &self.model_name,- messages,- tools,- synthesized_tools,- visible_tool_names,- self.max_iterations,+ provider_id,+ model: &self.model_name,+ history: messages,+ // Durable and synthesized tools follow the declared-snapshot order.+ tool_sets: vec![tools, synthesized_tools],+ // `Some(empty)` is deny-all; `None` re-exposes the driver registry.+ allowed: Some(visible_tool_names),+ max_iterations: self.max_iterations,+ subagent_scope: None,context_window,- self.run_queue.clone(),+ run_queue: self.run_queue.clone(),+ message_run_queue: None,+ early_exit_tools: &["ask_user_clarification"],+ pause_at_cap: true,+ max_output_tokens: Some(crate::inference::provider::AGENT_TURN_MAX_OUTPUT_TOKENS),context_mw,- tool_policy,- )+ tool_policy: Some(tool_policy),+ deterministic_cacheable: false,+ defer_turn_completed_to_caller: true,+ }.run_hosted(hosted_base, self.agent_id.clone()).await});diff --git a/crates/openhuman-core/src/agent/session_host/turn/chat_spec.rs b/crates/openhuman-core/src/agent/session_host/turn/chat_spec.rsdeleted file mode 100644index c24cff733e..0000000000--- a/crates/openhuman-core/src/agent/session_host/turn/chat_spec.rs+++ /dev/null@@ -1,56 +0,0 @@-//! Product-to-harness configuration for one hosted chat turn.--use std::{collections::HashSet, sync::Arc};--use tinyagents_session::transcript::TranscriptMessage;-use tinytools::Tool;--use crate::agent::tinyagents::{host::OpenHumanRunContext, TurnModels, TurnSpec};--/// Map the session's request-scoped execution inputs onto TinyAgents' one-/// hosted turn specification. The driver still owns authority validation and-/// invokes `run_hosted` inside its cancellation and snapshot boundary.-#[allow(clippy::too_many_arguments)]-pub(super) fn build_chat_turn_spec<'a>(- run_context: OpenHumanRunContext,- turn_models: TurnModels,- model: &'a str,- messages: Vec<TranscriptMessage>,- tools: Arc<Vec<Box<dyn Tool>>>,- synthesized_tools: Arc<Vec<Box<dyn Tool>>>,- visible_tool_names: HashSet<String>,- max_iterations: usize,- context_window: Option<u64>,- run_queue: Option<- Arc<tinyagents_harness::run_queue::RunQueue<crate::agent::queued_turn::QueuedTurn>>,- >,- context_mw: crate::agent::tinyagents::middleware::turn_context::TurnContextMiddleware,- tool_policy: crate::agent::tinyagents::ToolPolicyEnforcement,-) -> TurnSpec<'a> {- let provider_id = turn_models.provider_id().to_string();- TurnSpec {- run_context,- turn_models,- provider_id,- model,- history: messages,- // Durable and synthesized registrations follow the same order as the- // runtime snapshot, so advertised names resolve to matching instances.- tool_sets: vec![tools, synthesized_tools],- // `Some(empty)` is authoritative deny-all; `None` exposes the- // construction-time registry.- allowed: Some(visible_tool_names),- max_iterations,- subagent_scope: None,- context_window,- run_queue,- message_run_queue: None,- early_exit_tools: &["ask_user_clarification"],- pause_at_cap: true,- max_output_tokens: Some(crate::inference::provider::AGENT_TURN_MAX_OUTPUT_TOKENS),- context_mw,- tool_policy: Some(tool_policy),- deterministic_cacheable: false,- defer_turn_completed_to_caller: true,- }-}diff --git a/crates/openhuman-core/src/agent/session_host/turn/mod.rs b/crates/openhuman-core/src/agent/session_host/turn/mod.rsindex 4ea89d0c2c..e01ca7d84a 100644--- a/crates/openhuman-core/src/agent/session_host/turn/mod.rs+++ b/crates/openhuman-core/src/agent/session_host/turn/mod.rs@@ -3,5 +3,4 @@//! Generic turn lifecycle is intentionally absent: it is owned by//! `tinyagents_runtime::Session` in `runtime_session`.-pub(super) mod chat_spec;mod context;