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
feat(agent): allow untrusted input and response shaping on host-only agents
Steven Enamakel6a1938a8946a
diff --git a/crates/openhuman-core/src/agent/tinyagents/mod.rs b/crates/openhuman-core/src/agent/tinyagents/mod.rsindex 8b6665a797..254bd904ee 100644--- a/crates/openhuman-core/src/agent/tinyagents/mod.rs+++ b/crates/openhuman-core/src/agent/tinyagents/mod.rs@@ -50,10 +50,10 @@ pub mod run_mode;// for rather than an exotic one.pub mod payload_summarizer;mod policy_denial;-pub mod response_shape;pub(crate) mod reaper;pub(crate) mod reasoning;pub(crate) mod replay;+pub mod response_shape;mod routes;mod steering_forwarder;pub(crate) mod stop_hooks;diff --git a/crates/openhuman-core/src/inference/host_runtime/ops/agent_chat.rs b/crates/openhuman-core/src/inference/host_runtime/ops/agent_chat.rsindex de1bc018ae..f2dc1a8f23 100644--- a/crates/openhuman-core/src/inference/host_runtime/ops/agent_chat.rs+++ b/crates/openhuman-core/src/inference/host_runtime/ops/agent_chat.rs@@ -162,6 +162,15 @@ pub enum AgentChatTarget<'a> {/// memory, skill or MCP tool, and a deny-by-default gate for any other/// name. See [`OpenHumanSessionHost::from_config_host_only`].host_only: bool,+ /// Skip the prompt-injection guard: the message is untrusted data (a+ /// PR diff) the agent reads, not an instruction. Refused unless+ /// `host_only`, whose agent has nothing it could be talked into doing.+ untrusted_input: bool,+ /// A response format and output cap for every model call of the turn,+ /// and the slot its final call is reported into.+ shape: Option<+ &'a std::sync::Arc<crate::agent::tinyagents::response_shape::ResponseShapeScope>,+ >,},}@@ -179,6 +188,8 @@ impl std::fmt::Debug for AgentChatTarget<'_> {seed,usage,host_only,+ untrusted_input,+ shape,} => f.debug_struct("Definition").field("definition", &definition.id)@@ -186,6 +197,8 @@ impl std::fmt::Debug for AgentChatTarget<'_> {.field("seed_rows", &seed.map_or(0, <[(String, String)]>::len)).field("meters", &usage.is_some()).field("host_only", host_only)+ .field("untrusted_input", untrusted_input)+ .field("shaped", &shape.is_some()).finish(),}}@@ -298,7 +311,21 @@ pub async fn agent_chat_reply_for(cwd: Option<String>,route: Option<crate::config::schema::EphemeralRoute>,) -> Result<AgentChatReply, String> {- enforce_user_prompt_or_reject(message, "local_ai.ops.agent_chat")?;+ match target {+ AgentChatTarget::Definition {+ untrusted_input: true,+ host_only,+ ..+ } => {+ if !host_only {+ return Err("untrusted_input is only allowed on a host-only agent".to_string());+ }+ log::debug!(+ "[inference] agent_chat untrusted input on a host-only agent; guard skipped"+ );+ }+ _ => enforce_user_prompt_or_reject(message, "local_ai.ops.agent_chat")?,+ }// TAURI-RUST-RS: an upstream caller (frontend, JSON-RPC client) can pass// `model_override: Some("")`. See `normalize_model_override` for the@@ -424,7 +451,14 @@ pub async fn agent_chat_reply_for(effective_agent_chat_origin(),agent.run_single(message),);- let outcome = run.await;+ let outcome = match target {+ AgentChatTarget::Definition {+ shape: Some(scope), ..+ } => {+ crate::agent::tinyagents::response_shape::with_response_shape(scope.clone(), run).await+ }+ _ => run.await,+ };// Before the `?`. A turn that failed still spent what it spent, and the// session that counted it is about to go out of scope with the error.if let AgentChatTarget::Definition {diff --git a/crates/openhuman-embed/tests/structured_turns.rs b/crates/openhuman-embed/tests/structured_turns.rsindex 21cdb6f3e4..12d97a14ed 100644--- a/crates/openhuman-embed/tests/structured_turns.rs+++ b/crates/openhuman-embed/tests/structured_turns.rs@@ -218,11 +218,12 @@ fn untrusted_input_passes_the_prompt_guard_only_on_a_host_only_agent() {Arc::new(AtomicUsize::new(0)),)).expect("host-only agent");- let normal = runtime- .agent(routed(AgentSpec::new("normal"), &provider).definition(- AgentDefinitionSpec::new().tools(ToolScopeSpec::Named(Vec::new())),- ))- .expect("normal agent");+ let normal =+ runtime+ .agent(routed(AgentSpec::new("normal"), &provider).definition(+ AgentDefinitionSpec::new().tools(ToolScopeSpec::Named(Vec::new())),+ ))+ .expect("normal agent");let accepted = host_only.turn(INJECTION)