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(agent_chat): move turn guards into agent_chat module
Steven Enamakel89be5775eee8
diff --git a/crates/openhuman-core/src/agent_runs/agent_chat/mod.rs b/crates/openhuman-core/src/agent_runs/agent_chat/mod.rsindex 58b18cf932..ba0274c760 100644--- a/crates/openhuman-core/src/agent_runs/agent_chat/mod.rs+++ b/crates/openhuman-core/src/agent_runs/agent_chat/mod.rs@@ -1,9 +1,5 @@//! Full agent chat turns and their shared turn guards.-#[cfg(test)]-#[path = "session_turn_tests.rs"]-mod tests;-pub(crate) mod guards;mod session_turn;diff --git a/crates/openhuman-core/src/inference/host_runtime/ops.rs b/crates/openhuman-core/src/inference/host_runtime/ops.rsindex e3227f2f89..8c55a09021 100644--- a/crates/openhuman-core/src/inference/host_runtime/ops.rs+++ b/crates/openhuman-core/src/inference/host_runtime/ops.rs@@ -11,7 +11,6 @@ mod tests;mod agent_chat_simple;mod complete_once;mod runtime_ops;-mod turn_guards;pub use agent_chat_simple::agent_chat_simple;pub use complete_once::{complete_once, CompletionEndpoint};@@ -23,6 +22,6 @@ pub use runtime_ops::{#[cfg(test)]use crate::config::Config;#[cfg(test)]-use turn_guards::{+use crate::agent_runs::agent_chat::guards::{effective_agent_chat_origin, grant_turn_cwd, normalize_model_override, resolve_turn_cwd,};diff --git a/crates/openhuman-core/src/inference/host_runtime/ops/agent_chat_simple.rs b/crates/openhuman-core/src/inference/host_runtime/ops/agent_chat_simple.rsnew file mode 100644index 0000000000..3c73d453c9--- /dev/null+++ b/crates/openhuman-core/src/inference/host_runtime/ops/agent_chat_simple.rs@@ -0,0 +1,75 @@+//! The lightweight provider-only agent chat variant.++use crate::config::Config;+use crate::core::Outcome;+use crate::inference::provider as providers;+use crate::agent_runs::agent_chat::guards::{+ enforce_user_prompt_or_reject, normalize_model_override,+};++/// A simplified chat interface that does not update the base configuration.+pub async fn agent_chat_simple(+ ctx: &crate::core::runtime::DispatchCtx,+ config: &Config,+ message: &str,+ model_override: Option<String>,+ temperature: Option<f64>,+ thread_id: Option<String>,+) -> Result<Outcome<String>, String> {+ enforce_user_prompt_or_reject(message, "local_ai.ops.agent_chat_simple")?;++ let mut effective = config.clone();+ if let Some(model) = normalize_model_override(model_override) {+ effective.default_model = Some(model);+ }+ if let Some(temp) = temperature {+ effective.default_temperature = temp;+ }++ let default_model = effective+ .default_model+ .clone()+ .unwrap_or_else(|| crate::config::DEFAULT_MODEL.to_string());++ let (model, resolved_model): (+ std::sync::Arc<dyn tinyinference_llm::model::ChatModel<()>>,+ String,+ ) = if providers::factory::resolves_to_managed_backend("chat", &effective) {+ let (backend, resolved_model) =+ providers::factory::make_openhuman_backend_model_for_thread(+ "chat",+ &effective,+ &default_model,+ true,+ thread_id.as_deref(),+ &crate::security::egress::EgressLedger::none(),+ )+ .map_err(|e| e.to_string())?;+ (backend, resolved_model)+ } else {+ providers::create_chat_model_with_model_id_in(+ ctx,+ "chat",+ &effective,+ effective.default_temperature,+ )+ .map_err(|e| e.to_string())?+ };+ tracing::debug!(+ requested_model = %default_model,+ resolved_model = %resolved_model,+ temperature = effective.default_temperature,+ "[inference] agent_chat_simple invoking crate-native chat model"+ );+ let run = model.invoke(+ &(),+ tinyinference_llm::model::ModelRequest::new(vec![+ tinyinference_llm::message::Message::user(message.to_string()),+ ])+ .with_model(default_model.clone())+ .with_temperature(effective.default_temperature),+ );+ let response = run.await.map_err(|e| e.to_string())?.text();++ Ok(Outcome::single_log(response, "agent simple chat completed"))+}diff --git a/crates/openhuman-core/src/inference/host_runtime/ops/runtime_ops.rs b/crates/openhuman-core/src/inference/host_runtime/ops/runtime_ops.rsindex 4cd6bbafec..f66a242e9d 100644--- a/crates/openhuman-core/src/inference/host_runtime/ops/runtime_ops.rs+++ b/crates/openhuman-core/src/inference/host_runtime/ops/runtime_ops.rs@@ -13,7 +13,7 @@ use {tinyinference_local::status::LocalAiTtsResult,};-use super::turn_guards::enforce_user_prompt_or_reject;+use crate::agent_runs::agent_chat::guards::enforce_user_prompt_or_reject;/// Returns the current operational status of the local AI stack.pub async fn local_ai_status(config: &Config) -> Result<Outcome<LocalAiStatus>, String> {