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(tinyagents): thread approval context through host bundle
Steven Enamakel11bc496c501f
diff --git a/crates/openhuman-core/src/agent/tinyagents/host/bundle.rs b/crates/openhuman-core/src/agent/tinyagents/host/bundle.rsindex 461a0e01ee..f42887f0b9 100644--- a/crates/openhuman-core/src/agent/tinyagents/host/bundle.rs+++ b/crates/openhuman-core/src/agent/tinyagents/host/bundle.rs@@ -166,7 +166,8 @@ impl OpenHumanHostBundleFactory {// An untrusted-input turn is read from its own explicit run context:// a screen may run on another task, so no ambient scope is consulted.let mut security = OpenHumanSecurityGate::new(inputs.security_policy, inputs.tool_sets)- .with_input_screening(!turn.untrusted_input_turn);+ .with_input_screening(!turn.untrusted_input_turn)+ .with_approval(turn.approval.clone());if let Some(policy) = inputs.tool_policy {security = security.with_tool_policy(policy);}diff --git a/crates/openhuman-core/src/agent/tinyagents/host/security_gate.rs b/crates/openhuman-core/src/agent/tinyagents/host/security_gate.rsindex df084f73a3..1dd0e38eca 100644--- a/crates/openhuman-core/src/agent/tinyagents/host/security_gate.rs+++ b/crates/openhuman-core/src/agent/tinyagents/host/security_gate.rs@@ -146,6 +146,9 @@ pub struct OpenHumanSecurityGate {/// `false` for a host-only turn reading untrusted data/// ([`Self::with_input_screening`]): its input is data, not instructions.screens_input: bool,+ /// The owning turn's approval context (chat routing, copilot flag, flow+ /// run), read from the turn's explicit run context when the gate is built.+ approval: ApprovalTurnContext,}impl OpenHumanSecurityGate {@@ -163,9 +166,17 @@ impl OpenHumanSecurityGate {tool_sets,pending_audit: Mutex::new(HashMap::new()),screens_input: true,+ approval: ApprovalTurnContext::default(),}}+ /// Binds the owning turn's approval context, so a parked approval is routed+ /// to the turn's chat surface and stamped with its flow run.+ pub fn with_approval(mut self, approval: ApprovalTurnContext) -> Self {+ self.approval = approval;+ self+ }+/// Whether this gate screens the turn's input. A host-only turn reading/// untrusted data (`OpenHumanRunContext::untrusted_input_turn`) passes/// `false`: its input is data, not instructions.@@ -346,7 +357,7 @@ impl OpenHumanSecurityGate {// executor close the audit row later *without* raising a second// approval card. See mismatch (2).let (outcome, request_id) = gate- .intercept_audited(&call.tool_name, &summary, redacted)+ .intercept_audited(&self.approval, &call.tool_name, &summary, redacted).await;if matches!(outcome, GateOutcome::Allow) {// Only an approval that persisted a row yields an id; thediff --git a/crates/openhuman-core/src/agent/tinyagents/middleware/approval.rs b/crates/openhuman-core/src/agent/tinyagents/middleware/approval.rsindex 34863c7422..a6e7f8a8e1 100644--- a/crates/openhuman-core/src/agent/tinyagents/middleware/approval.rs+++ b/crates/openhuman-core/src/agent/tinyagents/middleware/approval.rs@@ -117,7 +117,7 @@ impl ApprovalResolver<crate::agent::tinyagents::host::OpenHumanRunContext>async fn resolve(&self,- _ctx: &RunContext<crate::agent::tinyagents::host::OpenHumanRunContext>,+ ctx: &RunContext<crate::agent::tinyagents::host::OpenHumanRunContext>,call: &TaToolCall,) -> ApprovalResolution {let Some(gate) = ApprovalGate::try_global() else {@@ -136,7 +136,7 @@ impl ApprovalResolver<crate::agent::tinyagents::host::OpenHumanRunContext>let summary = summarize_action(&call.name, &call.arguments);let redacted = redact_args(&call.arguments);let (outcome, request_id) = gate- .intercept_audited(approval_name.as_ref(), &summary, redacted)+ .intercept_audited(&ctx.data.approval, approval_name.as_ref(), &summary, redacted).await;match outcome {GateOutcome::Deny { reason } => {