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(security): authorize shell calls from TinyBox command facts
Steven Enamakel828f594f820e
diff --git a/crates/openhuman-core/src/agent/tinyagents/host/security_gate.rs b/crates/openhuman-core/src/agent/tinyagents/host/security_gate.rsindex fe2118c1c2..985879e579 100644--- a/crates/openhuman-core/src/agent/tinyagents/host/security_gate.rs+++ b/crates/openhuman-core/src/agent/tinyagents/host/security_gate.rs@@ -4,14 +4,14 @@//! This is `docs/specs/plan-agents.md` Phase 4 for the most policy-sensitive//! seam in the set. The tinyagents runtime holds *no* authority: it asks, and//! obeys. Everything it would otherwise have to guess at lives on this side —-//! the autonomy tier, the command classifier, the per-channel tool policy, the+//! the autonomy tier, policy over TinyBox's command facts, the per-channel tool policy, the//! human-in-the-loop approval park, and the prompt-injection screen.//!//! # Domains adapted//!//! - [`crate::security::policy`] — [`SecurityPolicy`], its-//! [`SecurityPolicy::classify_command`] / [`SecurityPolicy::check_gated_command`]-//! / [`SecurityPolicy::gate_decision`] triad, and [`AutonomyLevel`].+//! [`SecurityPolicy::check_gated_command_analysis`] / [`SecurityPolicy::gate_decision`]+//! decisions, and [`AutonomyLevel`].//! - [`crate::approval`] — the process-global [`ApprovalGate`],//! [`GateOutcome`], and the `summarize_action` / `redact_args` pair that keep//! raw arguments out of the approval card.@@ -79,6 +79,7 @@ use std::collections::HashMap;use std::sync::{Arc, Mutex};use async_trait::async_trait;+use serde::Deserialize;use tinyagents_harness::error::Result as TaResult;use tinyagents_harness::host::security_gate::{ContentOrigin, GateDecision, ScreenOutcome, SecurityGate, ToolCallRequest,@@ -96,11 +97,32 @@ use tinytools::{PermissionLevel, Tool};/// The tool name whose arguments carry a shell command string.////// Command classification is not a generic capability: only `shell` has a-/// `command` argument for [`SecurityPolicy::classify_command`] to read. Every-/// other tool is classified by its declared permission level and+/// `command` argument for TinyBox to analyze. Every other tool is classified by its declared permission level and/// `external_effect_with_args`, which is what the rest of the harness does too.const SHELL_TOOL: &str = "shell";+#[derive(Deserialize)]+struct PreparedShellAuthorization {+ tool_name: String,+ request_arguments: serde_json::Value,+ effective_arguments: serde_json::Value,+ tool_facts: serde_json::Value,+}++fn shell_analysis_for_call(+ call: &ToolCallRequest,+ context: Option<&serde_json::Value>,+) -> Option<(serde_json::Value, serde_json::Value)> {+ let prepared: PreparedShellAuthorization = serde_json::from_value(context?.clone()).ok()?;+ if prepared.tool_name != SHELL_TOOL || prepared.request_arguments != call.arguments {+ return None;+ }+ Some((+ prepared.effective_arguments,+ prepared.tool_facts.get("analysis")?.clone(),+ ))+}+/// The channel tool-policy's verdict for one tool, as three explicit outcomes.////// Deliberately not `Option<String>`. That shape can only say "denied" or@@ -265,17 +287,18 @@ impl OpenHumanSecurityGate {/// Classifies a `shell` call and maps OpenHuman's three-way policy verdict/// onto this trait's.///- /// Mirrors `ShellTool::external_effect_with_args` exactly: the deterministic- /// [`SecurityPolicy::classify_command`] floor, raised (never lowered) by the- /// model's self-declared `category`. [`SecurityPolicy::check_gated_command`]- /// runs first because it also enforces the hidden-execution guard- /// (`$(…)`, backticks, background `&`) that classification alone misses.+ /// Applies host policy to TinyBox's generic command facts, then raises (never+ /// lowers) the result with the model's self-declared `category`.+ #[cfg(feature = "modules")]fn shell_decision(policy: &SecurityPolicy,args: &serde_json::Value,+ analysis: &serde_json::Value,) -> std::result::Result<PolicyGateDecision, String> {- let command = args.get("command").and_then(|v| v.as_str()).unwrap_or("");- let mut class: CommandClass = policy.check_gated_command(command)?;+ let analysis: crate::modules::tinybox::contract::CommandAnalysis =+ serde_json::from_value(analysis.clone())+ .map_err(|_| "TinyBox command analysis is invalid".to_owned())?;+ let mut class: CommandClass = policy.check_gated_command_analysis(&analysis)?;if let Some(declared) = args.get("category").and_then(|v| v.as_str())@@ -375,34 +398,11 @@ impl OpenHumanSecurityGate {}decision_for_outcome(&call.tool_name, outcome)}-}--#[path = "security_gate_approval.rs"]-mod approval;-use approval::decision_for_outcome;--#[async_trait]-impl SecurityGate for OpenHumanSecurityGate {- /// Answers in five stages, each of which can only narrow the answer:- ///- /// 1. the channel tool policy (`agent_tool_policy`),- /// 2. tool resolution — an unregistered name is denied,- /// 3. `shell` command classification, which supersedes stage 4 for that one- /// tool because it is strictly finer-grained,- /// 4. the autonomy tier for acting tools (`can_act`) plus the non-mutating- /// rate-limit read, and- /// 5. the approval park for anything the tier prompts on.- ///- /// **A human approval never short-circuits the remaining stages.** Approving- /// at stage 1 settles the *channel* restriction and nothing else; the call- /// still has to survive tool resolution, the shell classifier, and the- /// autonomy tier. Returning straight after the park would have let a- /// channel that merely asks for confirmation authorize a `shell` command the- /// tier blocks, or an acting tool under `readonly` — turning the channel's- /// second-strictest setting into an override of the user's own autonomy- /// choice. A refusal at any stage is still terminal, and `channel_approved`- /// is carried forward so a later prompting stage does not ask twice.- async fn authorize_tool(&self, call: &ToolCallRequest) -> TaResult<GateDecision> {+ async fn authorize_tool_with_facts(+ &self,+ call: &ToolCallRequest,+ authorization_context: Option<&serde_json::Value>,+ ) -> TaResult<GateDecision> {// A nested call (made by a running tool, not the model) can never be// parked for a human, and the stages below prompt. Fail closed rather// than prompt or guess which stages would have: nested calls are off@@ -548,45 +548,64 @@ impl SecurityGate for OpenHumanSecurityGate {// which OpenHuman's own `ShellTool` permits. So shell answers here// and returns.if call.tool_name == SHELL_TOOL {- match Self::shell_decision(&policy, &call.arguments) {- Err(raw_reason) => {- tracing::warn!(- target: "tinyagents",- tool = %call.tool_name,- "[tinyagents::host::security] shell command blocked by security policy"- );- return Ok(GateDecision::deny(- PolicyDenial::SecurityPolicyBlocked {- tool: &call.tool_name,- raw_reason: &raw_reason,- }- .render(),- ));- }- Ok(PolicyGateDecision::Block) => {- // `check_gated_command` already rejects the read-only Block- // case; this arm catches a Block produced by the model's- // escalate-only `category` hint.- let raw = format!(- "{} Security policy: this command's category is not permitted in the \- current access tier.",+ #[cfg(feature = "modules")]+ {+ let Some((effective_arguments, analysis)) =+ shell_analysis_for_call(call, authorization_context)+ else {+ return Ok(GateDecision::deny(format!(+ "{} Shell authorization facts are unavailable or do not match this call.",crate::security::POLICY_BLOCKED_MARKER- );- return Ok(GateDecision::deny(- PolicyDenial::SecurityPolicyBlocked {- tool: &call.tool_name,- raw_reason: &raw,- }- .render(),- ));- }- Ok(PolicyGateDecision::Prompt) => {- return Ok(self.park_once(call, channel_approved).await);- }- Ok(PolicyGateDecision::Allow) => {- return Ok(self.settled(channel_approved));+ )));+ };+ match Self::shell_decision(&policy, &effective_arguments, &analysis) {+ Err(raw_reason) => {+ tracing::warn!(+ target: "tinyagents",+ tool = %call.tool_name,+ "[tinyagents::host::security] shell command blocked by security policy"+ );+ return Ok(GateDecision::deny(+ PolicyDenial::SecurityPolicyBlocked {+ tool: &call.tool_name,+ raw_reason: &raw_reason,+ }+ .render(),+ ));+ }+ Ok(PolicyGateDecision::Block) => {+ // `check_gated_command_analysis` already rejects the read-only Block+ // case; this arm catches a Block produced by the model's+ // escalate-only `category` hint.+ let raw = format!(+ "{} Security policy: this command's category is not permitted in the \+ current access tier.",+ crate::security::POLICY_BLOCKED_MARKER+ );+ return Ok(GateDecision::deny(+ PolicyDenial::SecurityPolicyBlocked {+ tool: &call.tool_name,+ raw_reason: &raw,+ }+ .render(),+ ));+ }+ Ok(PolicyGateDecision::Prompt) => {+ return Ok(self.park_once(call, channel_approved).await);+ }+ Ok(PolicyGateDecision::Allow) => {+ return Ok(self.settled(channel_approved));+ }}}+ #[cfg(not(feature = "modules"))]+ {+ let _ = authorization_context;+ return Ok(GateDecision::deny(format!(+ "{} Shell command analysis is unavailable in this build.",+ crate::security::POLICY_BLOCKED_MARKER+ )));+ }}let required = tool.permission_level_with_args(&call.arguments);@@ -644,6 +663,44 @@ impl SecurityGate for OpenHumanSecurityGate {);Ok(self.settled(channel_approved))}+}++#[path = "security_gate_approval.rs"]+mod approval;+use approval::decision_for_outcome;++#[async_trait]+impl SecurityGate for OpenHumanSecurityGate {+ /// Answers in five stages, each of which can only narrow the answer:+ ///+ /// 1. the channel tool policy (`agent_tool_policy`),+ /// 2. tool resolution — an unregistered name is denied,+ /// 3. `shell` command classification, which supersedes stage 4 for that one+ /// tool because it is strictly finer-grained,+ /// 4. the autonomy tier for acting tools (`can_act`) plus the non-mutating+ /// rate-limit read, and+ /// 5. the approval park for anything the tier prompts on.+ ///+ /// **A human approval never short-circuits the remaining stages.** Approving+ /// at stage 1 settles the *channel* restriction and nothing else; the call+ /// still has to survive tool resolution, the shell classifier, and the+ /// autonomy tier. Returning straight after the park would have let a+ /// channel that merely asks for confirmation authorize a `shell` command the+ /// tier blocks, or an acting tool under `readonly` — turning the channel's+ /// second-strictest setting into an override of the user's own autonomy+ /// choice. A refusal at any stage is still terminal, and `channel_approved`+ /// is carried forward so a later prompting stage does not ask twice.+ async fn authorize_tool(&self, call: &ToolCallRequest) -> TaResult<GateDecision> {+ self.authorize_tool_with_facts(call, None).await+ }++ async fn authorize_tool_with_context(+ &self,+ call: &ToolCallRequest,+ context: Option<&serde_json::Value>,+ ) -> TaResult<GateDecision> {+ self.authorize_tool_with_facts(call, context).await+ }/// Runs OpenHuman's prompt-injection detector over `text`.///diff --git a/crates/openhuman-core/src/agent/tinyagents/host/security_gate_tests.rs b/crates/openhuman-core/src/agent/tinyagents/host/security_gate_tests.rsindex 32aaf4c3d0..0d54e45ab6 100644--- a/crates/openhuman-core/src/agent/tinyagents/host/security_gate_tests.rs+++ b/crates/openhuman-core/src/agent/tinyagents/host/security_gate_tests.rs@@ -64,6 +64,71 @@ fn req(tool_name: &str, args: serde_json::Value) -> ToolCallRequest {ToolCallRequest::new(tool_name, args, "lead")}+#[cfg(feature = "modules")]+fn shell_context(+ args: &serde_json::Value,+ class: crate::modules::tinybox::contract::CommandClass,+ hidden_execution: bool,+ literal_words: &[&str],+) -> serde_json::Value {+ shell_context_for_args(args, args, class, hidden_execution, literal_words)+}++#[cfg(feature = "modules")]+fn shell_context_for_args(+ request_arguments: &serde_json::Value,+ effective_arguments: &serde_json::Value,+ class: crate::modules::tinybox::contract::CommandClass,+ hidden_execution: bool,+ literal_words: &[&str],+) -> serde_json::Value {+ use crate::modules::tinybox::contract::{CommandAnalysis, CommandSegment};++ let analysis = CommandAnalysis {+ segments: vec![CommandSegment {+ source: "command".into(),+ command: "command".into(),+ basename: "command".into(),+ normalized_name: "command".into(),+ arguments: Vec::new(),+ class,+ leading_env_assignment: false,+ dangerous_env_prefix: false,+ executor: false,+ }],+ hidden_execution,+ redirection: false,+ expansion: false,+ tee: false,+ background: false,+ literal_words: literal_words+ .iter()+ .map(|word| (*word).to_owned())+ .collect(),+ };+ json!({+ "tool_name": SHELL_TOOL,+ "request_arguments": request_arguments,+ "effective_arguments": effective_arguments,+ "tool_facts": {"analysis": analysis},+ })+}++#[cfg(feature = "modules")]+fn shell_analysis(+ class: crate::modules::tinybox::contract::CommandClass,+ hidden_execution: bool,+ literal_words: &[&str],+) -> serde_json::Value {+ shell_context(+ &json!({"command": "fixture"}),+ class,+ hidden_execution,+ literal_words,+ )["tool_facts"]["analysis"]+ .clone()+}+#[tokio::test]async fn there_is_no_audit_id_to_drain_when_nothing_was_prompted() {// No approval gate is installed in tests, so nothing parks and nothing@@ -152,31 +217,131 @@ async fn an_empty_registry_denies_everything() {}#[tokio::test]+#[cfg(feature = "modules")]async fn a_read_class_shell_command_runs_without_a_prompt() {+ let args = json!({"command": "ls -la"});let decision = gate(AutonomyLevel::Supervised)- .authorize_tool(&req(SHELL_TOOL, json!({ "command": "ls -la" })))+ .authorize_tool_with_context(+ &req(SHELL_TOOL, args.clone()),+ Some(&shell_context(+ &args,+ crate::modules::tinybox::contract::CommandClass::Read,+ false,+ &["ls", "-la"],+ )),+ ).await.unwrap();assert_eq!(decision, GateDecision::Allow);}#[tokio::test]+#[cfg(feature = "modules")]+async fn shell_authorization_denies_when_module_facts_are_missing() {+ let gate = gate(AutonomyLevel::Full);+ let decision = gate+ .authorize_tool(&req(SHELL_TOOL, json!({"command": "ls -la"})))+ .await+ .expect("authorization result");+ assert!(+ !decision.is_allowed(),+ "shell must fail closed when TinyBox analysis is unavailable"+ );+}++#[tokio::test]+#[cfg(feature = "modules")]+async fn shell_authorization_rejects_facts_bound_to_different_arguments() {+ let gate = gate(AutonomyLevel::Full);+ let args = json!({"command": "ls -la"});+ let analysis = crate::modules::tinybox::contract::CommandAnalysis {+ segments: vec![],+ hidden_execution: false,+ redirection: false,+ expansion: false,+ tee: false,+ background: false,+ literal_words: vec!["ls".to_owned()],+ };+ let context = json!({+ "tool_name": "shell",+ "request_arguments": {"command": "other command"},+ "effective_arguments": {"command": "cat ~/.ssh/id_rsa"},+ "tool_facts": {"analysis": analysis},+ });+ let decision = gate+ .authorize_tool_with_context(&req(SHELL_TOOL, args), Some(&context))+ .await+ .expect("authorization result");+ assert!(+ !decision.is_allowed(),+ "facts for another command must not authorize this call"+ );+}++#[test]+#[cfg(feature = "modules")]+fn shell_policy_uses_the_effective_arguments_bound_by_the_harness() {+ let request_arguments = json!({"command": "touch output"});+ let effective_arguments = json!({+ "command": "touch output",+ "category": "destructive"+ });+ let context = shell_context_for_args(+ &request_arguments,+ &effective_arguments,+ crate::modules::tinybox::contract::CommandClass::Write,+ false,+ &["touch", "output"],+ );+ let call = req(SHELL_TOOL, request_arguments);+ let (effective, analysis) =+ shell_analysis_for_call(&call, Some(&context)).expect("call-bound facts");++ assert_eq!(effective, effective_arguments);+ assert_eq!(+ OpenHumanSecurityGate::shell_decision(&SecurityPolicy::default(), &effective, &analysis),+ Ok(PolicyGateDecision::Prompt)+ );+}++#[tokio::test]+#[cfg(feature = "modules")]async fn a_read_class_shell_command_still_runs_in_read_only_mode() {// The regression the stage ordering exists for: `shell` declares the// coarse `Execute` permission level, so a naive tier check would refuse// `ls` in read-only mode — which OpenHuman's own ShellTool permits,// because `classify_command` says the command itself is a Read.+ let args = json!({"command": "ls -la"});let decision = gate(AutonomyLevel::ReadOnly)- .authorize_tool(&req(SHELL_TOOL, json!({ "command": "ls -la" })))+ .authorize_tool_with_context(+ &req(SHELL_TOOL, args.clone()),+ Some(&shell_context(+ &args,+ crate::modules::tinybox::contract::CommandClass::Read,+ false,+ &["ls", "-la"],+ )),+ ).await.unwrap();assert_eq!(decision, GateDecision::Allow);}#[tokio::test]+#[cfg(feature = "modules")]async fn a_write_shell_command_is_blocked_outright_in_read_only() {+ let args = json!({"command": "rm -rf /tmp/x"});let decision = gate(AutonomyLevel::ReadOnly)- .authorize_tool(&req(SHELL_TOOL, json!({ "command": "rm -rf /tmp/x" })))+ .authorize_tool_with_context(+ &req(SHELL_TOOL, args.clone()),+ Some(&shell_context(+ &args,+ crate::modules::tinybox::contract::CommandClass::Write,+ false,+ &["rm", "-rf", "/tmp/x"],+ )),+ ).await.unwrap();assert!(!decision.is_allowed());@@ -187,17 +352,28 @@ async fn a_write_shell_command_is_blocked_outright_in_read_only() {}#[tokio::test]+#[cfg(feature = "modules")]async fn hidden_execution_is_blocked_below_the_full_tier() {// `check_gated_command`'s structural guard: a substitution could smuggle// an unseen command past the approval the human actually read.+ let args = json!({"command": "echo $(whoami)"});let decision = gate(AutonomyLevel::Supervised)- .authorize_tool(&req(SHELL_TOOL, json!({ "command": "echo $(whoami)" })))+ .authorize_tool_with_context(+ &req(SHELL_TOOL, args.clone()),+ Some(&shell_context(+ &args,+ crate::modules::tinybox::contract::CommandClass::Write,+ true,+ &["echo"],+ )),+ ).await.unwrap();assert!(!decision.is_allowed());}#[test]+#[cfg(feature = "modules")]fn the_declared_category_can_only_raise_the_command_class() {let full = SecurityPolicy {autonomy: AutonomyLevel::Full,@@ -205,14 +381,27 @@ fn the_declared_category_can_only_raise_the_command_class() {};// `touch` is Write, which Full runs silently…assert_eq!(- OpenHumanSecurityGate::shell_decision(&full, &json!({ "command": "touch f" })),+ OpenHumanSecurityGate::shell_decision(+ &full,+ &json!({ "command": "touch f" }),+ &shell_analysis(+ crate::modules::tinybox::contract::CommandClass::Write,+ false,+ &["touch", "f"],+ ),+ ),Ok(PolicyGateDecision::Allow));// …until the model itself declares it destructive, which must prompt.assert_eq!(OpenHumanSecurityGate::shell_decision(&full,- &json!({ "command": "touch f", "category": "destructive" })+ &json!({ "command": "touch f", "category": "destructive" }),+ &shell_analysis(+ crate::modules::tinybox::contract::CommandClass::Write,+ false,+ &["touch", "f"],+ )),Ok(PolicyGateDecision::Prompt));@@ -221,17 +410,31 @@ fn the_declared_category_can_only_raise_the_command_class() {assert_eq!(OpenHumanSecurityGate::shell_decision(&full,- &json!({ "command": "curl https://example.invalid", "category": "read" })+ &json!({ "command": "curl https://example.invalid", "category": "read" }),+ &shell_analysis(+ crate::modules::tinybox::contract::CommandClass::Network,+ false,+ &["curl", "https://example.invalid"],+ )),Ok(PolicyGateDecision::Prompt));}#[test]+#[cfg(feature = "modules")]fn a_missing_command_argument_classifies_as_read_rather_than_panicking() {let supervised = SecurityPolicy::default();assert_eq!(- OpenHumanSecurityGate::shell_decision(&supervised, &json!({})),+ OpenHumanSecurityGate::shell_decision(+ &supervised,+ &json!({}),+ &shell_analysis(+ crate::modules::tinybox::contract::CommandClass::Read,+ false,+ &[],+ ),+ ),Ok(PolicyGateDecision::Allow));}diff --git a/crates/openhuman-core/src/agent/tinyagents/tools.rs b/crates/openhuman-core/src/agent/tinyagents/tools.rsindex 6c55353f92..6f6884bd3c 100644--- a/crates/openhuman-core/src/agent/tinyagents/tools.rs+++ b/crates/openhuman-core/src/agent/tinyagents/tools.rs@@ -173,6 +173,16 @@ impl Tool for CanonicalSharedToolAdapter {self.resolved_tool().and_then(Tool::family)}+ async fn prepare_authorization(+ &self,+ arguments: &serde_json::Value,+ ) -> anyhow::Result<Option<serde_json::Value>> {+ match self.resolved_tool() {+ Some(tool) => tool.prepare_authorization(arguments).await,+ None => Ok(None),+ }+ }+async fn execute(&self, args: serde_json::Value) -> anyhow::Result<ToolResult> {self.execute_with_context(args,diff --git a/crates/openhuman-core/src/agent/tinyagents/use_skill_dispatch.rs b/crates/openhuman-core/src/agent/tinyagents/use_skill_dispatch.rsindex 8ea53f85af..61b868c11f 100644--- a/crates/openhuman-core/src/agent/tinyagents/use_skill_dispatch.rs+++ b/crates/openhuman-core/src/agent/tinyagents/use_skill_dispatch.rs@@ -60,6 +60,69 @@ impl ToolDispatch<(), OpenHumanRunContext> for UseSkillDispatch {self.tool.clone()}+ fn bind_call(+ &self,+ arguments: &Value,+ ) -> anyhow::Result<Option<Arc<dyn ToolDispatch<(), OpenHumanRunContext>>>> {+ let requested = arguments+ .get("skill")+ .and_then(Value::as_str)+ .zip(named_tool(arguments));+ let Some((skill, name)) = requested else {+ // Disclosure and malformed calls stay on the outer adapter. They+ // cannot execute a packed target.+ return Ok(None);+ };++ let Some(tools) = self.handle.resolve_registry_for(&CATALOG, skill, name) else {+ let result = ToolResult::error(format!(+ "{} No tool `{name}` in skill `{skill}`. Call `use_skill {{ \"skill\": \"{skill}\" }}` to see what it contains.\n\nSkills:\n{}",+ CATALOG.not_found_marker(),+ CATALOG.pack_index_markdown()+ ));+ return Ok(Some(Arc::new(BoundUseSkillDispatch {+ outer: self.tool.clone(),+ inner: None,+ inner_arguments: arguments+ .get("args")+ .cloned()+ .unwrap_or_else(|| serde_json::json!({})),+ typed: None,+ answer: Some(result),+ })));+ };++ let inner_arguments = arguments+ .get("args")+ .cloned()+ .unwrap_or_else(|| serde_json::json!({}));+ let Some(inner_adapter) =+ super::tools::CanonicalSharedToolAdapter::for_name(vec![tools], name)+ .map(|adapter| Arc::new(adapter) as Arc<dyn Tool>)+ else {+ // Freeze the not-found result too: a target appearing after+ // authorization must not turn a rejected call into an execution.+ let marker = CATALOG.not_found_marker();+ let result =+ ToolResult::error(format!("{marker} No tool `{name}` in the requested skill."));+ return Ok(Some(Arc::new(BoundUseSkillDispatch {+ outer: self.tool.clone(),+ inner: None,+ inner_arguments,+ typed: None,+ answer: Some(result),+ })));+ };+ let typed = typed_dispatch_for(&name, inner_adapter.clone());+ Ok(Some(Arc::new(BoundUseSkillDispatch {+ outer: self.tool.clone(),+ inner: Some(inner_adapter),+ inner_arguments,+ typed,+ answer: None,+ })))+ }+async fn execute(&self,_state: &(),@@ -133,6 +196,169 @@ impl ToolDispatch<(), OpenHumanRunContext> for UseSkillDispatch {}}+struct BoundUseSkillDispatch {+ outer: Arc<dyn Tool>,+ inner: Option<Arc<dyn Tool>>,+ inner_arguments: Value,+ typed: Option<Arc<dyn ToolDispatch<(), OpenHumanRunContext>>>,+ answer: Option<ToolResult>,+}++struct BoundUseSkillTool {+ outer: Arc<dyn Tool>,+ inner: Option<Arc<dyn Tool>>,+ inner_arguments: Value,+ answer: Option<ToolResult>,+}++#[async_trait]+impl Tool for BoundUseSkillTool {+ fn name(&self) -> &str {+ self.outer.name()+ }++ fn description(&self) -> &str {+ self.outer.description()+ }++ fn parameters_schema(&self) -> Value {+ self.outer.parameters_schema()+ }++ fn policy(&self) -> tinytools::ToolPolicy {+ self.inner+ .as_ref()+ .map_or_else(|| self.outer.policy(), |tool| tool.policy())+ }++ fn supports_markdown(&self) -> bool {+ self.inner+ .as_ref()+ .is_some_and(|tool| tool.supports_markdown())+ }++ fn permission_level(&self) -> tinytools::PermissionLevel {+ self.inner.as_ref().map_or_else(+ || self.outer.permission_level(),+ |tool| tool.permission_level(),+ )+ }++ fn permission_level_with_args(&self, _arguments: &Value) -> tinytools::PermissionLevel {+ self.inner.as_ref().map_or_else(+ || self.outer.permission_level(),+ |tool| tool.permission_level_with_args(&self.inner_arguments),+ )+ }++ fn external_effect_with_args(&self, _arguments: &Value) -> bool {+ self.inner+ .as_ref()+ .is_some_and(|tool| tool.external_effect_with_args(&self.inner_arguments))+ }++ fn timeout_policy(&self, _arguments: &Value) -> tinytools::ToolTimeout {+ self.inner+ .as_ref()+ .map_or(tinytools::ToolTimeout::Inherit, |tool| {+ tool.timeout_policy(&self.inner_arguments)+ })+ }++ async fn prepare_authorization(&self, _arguments: &Value) -> anyhow::Result<Option<Value>> {+ match &self.inner {+ Some(tool) => tool.prepare_authorization(&self.inner_arguments).await,+ None => Ok(None),+ }+ }++ async fn execute(&self, _arguments: Value) -> anyhow::Result<ToolResult> {+ if let Some(answer) = &self.answer {+ return Ok(answer.clone());+ }+ match &self.inner {+ Some(tool) => tool.execute(self.inner_arguments.clone()).await,+ None => self.outer.execute(Value::Null).await,+ }+ }++ async fn execute_with_context(+ &self,+ _arguments: Value,+ options: ToolCallOptions,+ context: Option<&dyn tinytools::ToolRunContext>,+ ) -> anyhow::Result<ToolResult> {+ if let Some(answer) = &self.answer {+ return Ok(answer.clone());+ }+ match &self.inner {+ Some(tool) => {+ tool.execute_with_context(self.inner_arguments.clone(), options, context)+ .await+ }+ None => {+ self.outer+ .execute_with_context(Value::Null, options, context)+ .await+ }+ }+ }+}++#[async_trait]+impl ToolDispatch<(), OpenHumanRunContext> for BoundUseSkillDispatch {+ fn tool(&self) -> Arc<dyn Tool> {+ Arc::new(BoundUseSkillTool {+ outer: self.outer.clone(),+ inner: self.inner.clone(),+ inner_arguments: self.inner_arguments.clone(),+ answer: self.answer.clone(),+ })+ }++ fn output_origin(&self) -> tinyagents_harness::host::ContentOrigin {+ self.typed+ .as_ref()+ .map_or(tinyagents_harness::host::ContentOrigin::Tool, |dispatch| {+ dispatch.output_origin()+ })+ }++ async fn execute(+ &self,+ state: &(),+ call_id: tinyagents_harness::CallId,+ _arguments: Value,+ options: ToolCallOptions,+ parent: &RunContext<OpenHumanRunContext>,+ ) -> anyhow::Result<ToolResult> {+ if let Some(answer) = &self.answer {+ return Ok(answer.clone());+ }+ let Some(inner) = &self.inner else {+ return self+ .outer+ .execute_with_context(Value::Null, options, None)+ .await;+ };+ if let Some(dispatch) = &self.typed {+ return dispatch+ .execute(+ state,+ call_id,+ self.inner_arguments.clone(),+ options,+ parent,+ )+ .await;+ }+ let context = ToolExecutionContext::from_run_context(parent, call_id);+ inner+ .execute_with_context(self.inner_arguments.clone(), options, Some(&context))+ .await+ }+}+#[cfg(test)]#[path = "use_skill_dispatch_tests.rs"]mod tests;diff --git a/crates/openhuman-core/src/agent/tinyagents/use_skill_dispatch_tests.rs b/crates/openhuman-core/src/agent/tinyagents/use_skill_dispatch_tests.rsindex 7d1987e3d2..bf34d78e65 100644--- a/crates/openhuman-core/src/agent/tinyagents/use_skill_dispatch_tests.rs+++ b/crates/openhuman-core/src/agent/tinyagents/use_skill_dispatch_tests.rs@@ -36,7 +36,7 @@ use tinytools::{Tool, ToolCallOptions, ToolResult};/// archetype dispatch never calls the wrapped tool's own `execute` — it/// dispatches straight to `execute_archetype_delegation_with_live_parent` —/// so this stub's body is unreachable in a passing run.-struct StubCreateImage;+struct StubCreateImage(&'static str);#[async_trait]impl Tool for StubCreateImage {@@ -50,7 +50,14 @@ impl Tool for StubCreateImage {json!({})}async fn execute(&self, _args: serde_json::Value) -> anyhow::Result<ToolResult> {- unreachable!("archetype dispatch must not fall back to the wrapped tool's own execute")+ Ok(ToolResult::success(self.0))+ }++ async fn prepare_authorization(+ &self,+ _args: &serde_json::Value,+ ) -> anyhow::Result<Option<serde_json::Value>> {+ Ok(Some(json!({"target": self.0})))}}@@ -116,13 +123,13 @@ fn parent_execution_context(workspace_dir: &Path) -> ParentExecutionContext {/// real `UseSkillTool` plus one packed archetype-delegate stub, a/// `PackRegistryHandle` bound to it, and the `CanonicalSharedToolAdapter`/// wrapping `use_skill` that the harness would have registered.-fn build_use_skill_dispatch() -> UseSkillDispatch {+fn build_use_skill_dispatch_with_handle() -> (UseSkillDispatch, PackRegistryHandle) {let handle = PackRegistryHandle::default();let use_skill_tool: Box<dyn Tool> = Box::new(UseSkillTool::new(handle.clone(),crate::tools::toolpacks::CATALOG,));- let create_image_tool: Box<dyn Tool> = Box::new(StubCreateImage);+ let create_image_tool: Box<dyn Tool> = Box::new(StubCreateImage("original"));let durable: Arc<Vec<Box<dyn Tool>>> = Arc::new(vec![use_skill_tool, create_image_tool]);handle.bind(Arc::downgrade(&durable));@@ -131,7 +138,51 @@ fn build_use_skill_dispatch() -> UseSkillDispatch {tinyagents_harness::tool::packs::USE_SKILL,).expect("use_skill resolves in the durable registry it was just placed in");- UseSkillDispatch::new(Arc::new(adapter), handle)+ (+ UseSkillDispatch::new(Arc::new(adapter), handle.clone()),+ handle,+ )+}++fn build_use_skill_dispatch() -> UseSkillDispatch {+ build_use_skill_dispatch_with_handle().0+}++#[tokio::test]+async fn use_skill_dispatch_keeps_authorized_target_after_registry_rebind() {+ let (dispatch, handle) = build_use_skill_dispatch_with_handle();+ let arguments = json!({+ "skill": "media",+ "tool": "create_image",+ "args": { "prompt": "a red bicycle", "blocking": true },+ });+ let pinned = dispatch+ .bind_call(&arguments)+ .expect("bind succeeds")+ .expect("known packed target binds");++ let replacement: Arc<Vec<Box<dyn Tool>>> = Arc::new(vec![+ Box::new(UseSkillTool::new(+ handle.clone(),+ crate::tools::toolpacks::CATALOG,+ )),+ Box::new(StubCreateImage("replacement")),+ ]);+ handle.bind(Arc::downgrade(&replacement));++ let facts = pinned+ .tool()+ .prepare_authorization(&arguments)+ .await+ .expect("authorization facts are returned");+ let result = pinned+ .tool()+ .execute(arguments)+ .await+ .expect("bound call returns a result");++ assert_eq!(facts, Some(json!({"target": "original"})));+ assert_eq!(result.text(), "original");}/// The regression itself: `use_skill { skill: "media", tool: "create_image",diff --git a/crates/openhuman-core/src/security/policy/command_checks.rs b/crates/openhuman-core/src/security/policy/command_checks.rsindex 3334342515..0a33ea35d8 100644--- a/crates/openhuman-core/src/security/policy/command_checks.rs+++ b/crates/openhuman-core/src/security/policy/command_checks.rs@@ -15,6 +15,50 @@ use tinybox_core::shell::scan::{};impl SecurityPolicy {+ /// Apply OpenHuman's shell policy to generic facts returned by TinyBox.+ /// The module supplies parsing facts, while this host owns path checks,+ /// autonomy tiers, and approval decisions.+ #[cfg(feature = "modules")]+ pub fn check_gated_command_analysis(+ &self,+ analysis: &crate::modules::tinybox::contract::CommandAnalysis,+ ) -> Result<CommandClass, String> {+ self.check_protected_path_words(&analysis.literal_words)?;++ let mut class = analysis+ .segments+ .iter()+ .map(|segment| match segment.class {+ crate::modules::tinybox::contract::CommandClass::Read => CommandClass::Read,+ crate::modules::tinybox::contract::CommandClass::Write => CommandClass::Write,+ crate::modules::tinybox::contract::CommandClass::Network => CommandClass::Network,+ crate::modules::tinybox::contract::CommandClass::Install => CommandClass::Install,+ crate::modules::tinybox::contract::CommandClass::Destructive => {+ CommandClass::Destructive+ }+ })+ .max()+ .unwrap_or(CommandClass::Read);+ if analysis.redirection || analysis.tee {+ class = class.max(CommandClass::Write);+ }++ if !self.enabled {+ return Ok(class);+ }+ if self.gate_decision(class) == GateDecision::Block {+ return Err(format!(+ "{POLICY_BLOCKED_MARKER} Security policy: read-only mode — only read commands are permitted."+ ));+ }+ if self.autonomy != AutonomyLevel::Full && analysis.hidden_execution {+ return Err(format!(+ "{POLICY_BLOCKED_MARKER} Command blocked: hidden command execution is not allowed in this mode."+ ));+ }+ Ok(class)+ }+/// Classify command risk. Any high-risk segment marks the whole command high.pub fn command_risk_level(&self, command: &str) -> CommandRiskLevel {let mut saw_medium = false;@@ -229,13 +273,35 @@ impl SecurityPolicy {/// guard for direct path arguments and source literals; arbitrary shell or/// interpreter code still needs a filesystem sandbox to enforce the floor.pub fn check_protected_path_literals(&self, input: &str) -> Result<(), String> {- for word in strip_quoted_heredoc_bodies(input).split(|c: char| {- c.is_whitespace() || matches!(c, '\'' | '"' | '(' | ')' | '[' | ']' | ',' | ';' | '=')- }) {+ let words = strip_quoted_heredoc_bodies(input)+ .split(|c: char| {+ c.is_whitespace()+ || matches!(c, '\'' | '"' | '(' | ')' | '[' | ']' | ',' | ';' | '=')+ })+ .map(str::to_owned)+ .collect::<Vec<_>>();+ self.check_protected_path_words(&words)+ }++ /// Refuse protected paths and unsafe path literals returned by the+ /// execution module's command analysis. The host still owns path policy;+ /// the module only supplies token boundaries.+ pub fn check_protected_path_words(&self, words: &[String]) -> Result<(), String> {+ for word in words {let word = word.trim_matches(|c: char| matches!(c, ':' | '<' | '>' | '&' | '|'));if word.is_empty() || word.contains("://") {continue;}+ let candidate_path = PathBuf::from(word);+ if word.contains('\0')+ || candidate_path+ .components()+ .any(|component| matches!(component, std::path::Component::ParentDir))+ {+ return Err(format!(+ "{POLICY_BLOCKED_MARKER} Command references an unsafe path"+ ));+ }let word = ["${HOME}", "$HOME", "%USERPROFILE%"].iter().find_map(|prefix| word.strip_prefix(prefix).map(|rest| format!("~{rest}")))diff --git a/crates/openhuman-core/src/security/policy/policy_paths_and_risk_tests.rs b/crates/openhuman-core/src/security/policy/policy_paths_and_risk_tests.rsindex 11efff4485..f9d7c83359 100644--- a/crates/openhuman-core/src/security/policy/policy_paths_and_risk_tests.rs+++ b/crates/openhuman-core/src/security/policy/policy_paths_and_risk_tests.rs@@ -69,6 +69,63 @@ fn parse_declared_class_maps_known_and_rejects_unknown() {);}+#[cfg(feature = "modules")]+#[test]+fn tinybox_command_facts_drive_policy_and_keep_the_path_floor_when_disabled() {+ use crate::modules::tinybox::contract::{+ CommandAnalysis, CommandClass as ModuleClass, CommandSegment,+ };++ let write_segment = CommandSegment {+ source: "ls -la".into(),+ command: "ls -la".into(),+ basename: "ls".into(),+ normalized_name: "ls".into(),+ arguments: vec!["-la".into()],+ class: ModuleClass::Write,+ leading_env_assignment: false,+ dangerous_env_prefix: false,+ executor: false,+ };+ let analysis = CommandAnalysis {+ segments: vec![write_segment],+ hidden_execution: false,+ redirection: false,+ expansion: false,+ tee: false,+ background: false,+ literal_words: vec!["ls".into(), "-la".into()],+ };+ let readonly = SecurityPolicy {+ enabled: true,+ autonomy: AutonomyLevel::ReadOnly,+ ..SecurityPolicy::default()+ };+ assert!(readonly.check_gated_command_analysis(&analysis).is_err());++ let disabled = SecurityPolicy {+ enabled: false,+ ..SecurityPolicy::default()+ };+ let protected = CommandAnalysis {+ literal_words: vec!["cat".into(), "~/.ssh/id_rsa".into()],+ ..analysis+ };+ assert!(disabled.check_gated_command_analysis(&protected).is_err());++ let traversal = CommandAnalysis {+ literal_words: vec!["cat".into(), "workspace/../.ssh/id_rsa".into()],+ ..protected.clone()+ };+ assert!(disabled.check_gated_command_analysis(&traversal).is_err());++ let nul_path = CommandAnalysis {+ literal_words: vec!["cat".into(), "safe\0/credential".into()],+ ..protected+ };+ assert!(disabled.check_gated_command_analysis(&nul_path).is_err());+}+#[test]fn command_risk_medium_for_command_executors() {// Interpreters / code executors are medium-risk now (not high): a codingdiff --git a/crates/openhuman-core/src/tools/host_extensions.rs b/crates/openhuman-core/src/tools/host_extensions.rsindex e203b233a6..1c4a958efe 100644--- a/crates/openhuman-core/src/tools/host_extensions.rs+++ b/crates/openhuman-core/src/tools/host_extensions.rs@@ -5,7 +5,7 @@//! host implementation details, not portable tool-trait APIs.use crate::agent::orchestration::tools::DelegationTarget;-use tinyagents_harness::tool::packs::PackRegistryHandle;+use tinyagents_harness::tool::packs::{PackRegistryHandle, PackToolExtension};#[cfg(test)]use tinytools::{PermissionLevel, ToolCategory, ToolResult, ToolScope};use tinytools::{Tool, ToolRunContext};@@ -13,7 +13,12 @@ use tinytools::{Tool, ToolRunContext};/// Reads a tool's pack-registry handle from its erased host extension.pub fn pack_registry_handle(tool: &dyn Tool) -> Option<&PackRegistryHandle> {tool.host_extension()- .and_then(|any| any.downcast_ref::<PackRegistryHandle>())+ .and_then(|any| any.downcast_ref::<PackToolExtension>())+ .map(PackToolExtension::registry_handle)+ .or_else(|| {+ tool.host_extension()+ .and_then(|any| any.downcast_ref::<PackRegistryHandle>())+ })}/// Reads the target agent a synthesized `delegate_*` tool routes to.diff --git a/crates/openhuman-core/src/tools/impl/system/shell.rs b/crates/openhuman-core/src/tools/impl/system/shell.rsindex 60577a8fe8..110b8508a1 100644--- a/crates/openhuman-core/src/tools/impl/system/shell.rs+++ b/crates/openhuman-core/src/tools/impl/system/shell.rs@@ -2,7 +2,8 @@ use super::shell_platform::{command_param_description, python_utf8_env, shell_child_env, shell_description,};use crate::agent::host_runtime::RuntimeAdapter;-use crate::security::{AuditLogger, CommandExecutionLog, GateDecision, SecurityPolicy};+use crate::config::Config;+use crate::security::{AuditLogger, CommandExecutionLog, SecurityPolicy};use async_trait::async_trait;use serde_json::json;use std::path::{Path, PathBuf};@@ -41,6 +42,7 @@ pub struct ShellTool {security: Arc<SecurityPolicy>,runtime: Arc<dyn RuntimeAdapter>,audit: Arc<AuditLogger>,+ analysis_config: Option<Arc<Config>>,}impl ShellTool {@@ -53,6 +55,23 @@ impl ShellTool {security,runtime,audit,+ analysis_config: None,+ }+ }++ /// Builds a shell tool whose command facts come from the configured+ /// TinyBox module before host authorization and execution.+ pub fn with_config(+ security: Arc<SecurityPolicy>,+ runtime: Arc<dyn RuntimeAdapter>,+ audit: Arc<AuditLogger>,+ config: Arc<Config>,+ ) -> Self {+ Self {+ security,+ runtime,+ audit,+ analysis_config: Some(config),}}@@ -190,17 +209,38 @@ impl Tool for ShellTool {/// and the structural guard are enforced in `run_with_security`.fn external_effect_with_args(&self, args: &serde_json::Value) -> bool {let command = args.get("command").and_then(|v| v.as_str()).unwrap_or("");- let mut class = self.security.classify_command(command);- // Escalate-only LLM hint: max() so a self-declared category can raise- // the requirement (e.g. Write -> Destructive) but never lower it.- if let Some(declared) = args- .get("category")- .and_then(|v| v.as_str())- .and_then(SecurityPolicy::parse_declared_class)+ // This synchronous declaration cannot consult TinyBox. Be+ // conservative here; the host authorization gate uses the exact+ // per-call TinyBox analysis and applies the configured tier.+ !command.is_empty()+ }++ async fn prepare_authorization(+ &self,+ args: &serde_json::Value,+ ) -> anyhow::Result<Option<serde_json::Value>> {+ #[cfg(feature = "modules")]+ {+ let config = self+ .analysis_config+ .as_deref()+ .ok_or_else(|| anyhow::anyhow!("command analysis is unavailable"))?;+ let command = args+ .get("command")+ .and_then(serde_json::Value::as_str)+ .ok_or_else(|| anyhow::anyhow!("command analysis is unavailable"))?;+ let analysis = crate::modules::tinybox::analyze_command(config, command.to_owned())+ .await+ .map_err(|_| anyhow::anyhow!("command analysis is unavailable"))?;+ let analysis = serde_json::to_value(analysis)+ .map_err(|_| anyhow::anyhow!("command analysis is unavailable"))?;+ return Ok(Some(json!({ "analysis": analysis })));+ }+ #[cfg(not(feature = "modules"))]{- class = class.max(declared);+ let _ = args;+ Err(anyhow::anyhow!("command analysis is unavailable"))}- self.security.gate_decision(class) == GateDecision::Prompt}async fn execute(&self, args: serde_json::Value) -> anyhow::Result<ToolResult> {@@ -277,12 +317,43 @@ impl ShellTool {requested_timeout: Option<u64>,context: Option<&dyn ToolRunContext>,) -> (bool, ToolResult) {- // Read-only `Block` + the Option-2 structural guard. Approval for- // Write / Network / Destructive already happened at the harness- // `ApprovalGate` (see `external_effect_with_args`) before `execute()`- // ran; this enforces what must still hold afterwards.- if let Err(reason) = self.security.check_gated_command(command) {- return (false, ToolResult::error(reason));+ // Revalidate facts immediately before execution. The authorization+ // hook supplies the same module-owned parser to the harness gate; this+ // second call keeps direct/workflow execution on the same contract and+ // fails closed if the module disappeared after approval.+ #[cfg(feature = "modules")]+ if let Some(config) = self.analysis_config.as_deref() {+ let analysis =+ match crate::modules::tinybox::analyze_command(config, command.to_owned()).await {+ Ok(analysis) => analysis,+ Err(_) => {+ return (false, ToolResult::error("Command analysis is unavailable."))+ }+ };+ if let Err(reason) = self.security.check_gated_command_analysis(&analysis) {+ return (false, ToolResult::error(reason));+ }+ } else {+ #[cfg(test)]+ if let Err(reason) = self.security.check_gated_command(command) {+ // Unit tests exercise the standalone policy helper without+ // booting TinyBus. Production constructors always carry the+ // module config and never use this compatibility path.+ return (false, ToolResult::error(reason));+ }+ #[cfg(not(test))]+ return (false, ToolResult::error("Command analysis is unavailable."));+ }+ #[cfg(not(feature = "modules"))]+ {+ let _ = &self.analysis_config;+ let _ = command;+ #[cfg(test)]+ if let Err(reason) = self.security.check_gated_command(command) {+ return (false, ToolResult::error(reason));+ }+ #[cfg(not(test))]+ return (false, ToolResult::error("Command analysis is unavailable."));}let _cwd = self.effective_action_dir_for_context(context);diff --git a/crates/openhuman-core/src/tools/impl/system/shell_tests_schema_and_env_tests.rs b/crates/openhuman-core/src/tools/impl/system/shell_tests_schema_and_env_tests.rsindex e13879b523..6a93ed39c4 100644--- a/crates/openhuman-core/src/tools/impl/system/shell_tests_schema_and_env_tests.rs+++ b/crates/openhuman-core/src/tools/impl/system/shell_tests_schema_and_env_tests.rs@@ -1,5 +1,23 @@use super::*;+#[tokio::test]+async fn configured_shell_fails_closed_when_tinybox_analysis_is_disabled() {+ let mut config = crate::config::Config::default();+ config.modules.enabled = false;+ let tool = ShellTool::with_config(+ test_security(AutonomyLevel::Full),+ test_runtime(),+ test_audit(),+ Arc::new(config),+ );++ let error = tool+ .prepare_authorization(&json!({"command": "cat ~/.ssh/id_rsa"}))+ .await+ .expect_err("hosted shell authorization requires TinyBox analysis");+ assert_eq!(error.to_string(), "command analysis is unavailable");+}+#[cfg(not(windows))]#[tokio::test]async fn shell_emits_audit_line_on_success() {diff --git a/crates/openhuman-core/src/tools/native_ops.rs b/crates/openhuman-core/src/tools/native_ops.rsindex ce31c59216..fe1e692068 100644--- a/crates/openhuman-core/src/tools/native_ops.rs+++ b/crates/openhuman-core/src/tools/native_ops.rs@@ -31,12 +31,11 @@ fn summarize_tool(tool: &dyn Tool) -> RuntimeToolSummary {}}-fn classify_shell_tool_call(security: &SecurityPolicy, args: &serde_json::Value) -> CommandClass {- let command = args- .get("command")- .and_then(|value| value.as_str())- .unwrap_or("");- let mut class = security.classify_command(command);+fn classify_shell_tool_call(args: &serde_json::Value) -> CommandClass {+ // This synchronous summary API cannot ask TinyBox to analyze the command.+ // Report the conservative class here; the invocation path performs exact+ // module analysis before approval and execution.+ let mut class = CommandClass::Write;if let Some(declared) = args.get("category").and_then(|value| value.as_str())@@ -47,13 +46,9 @@ fn classify_shell_tool_call(security: &SecurityPolicy, args: &serde_json::Value)class}-fn command_class_for_tool(- security: &SecurityPolicy,- tool: &dyn Tool,- args: &serde_json::Value,-) -> CommandClass {+fn command_class_for_tool(tool: &dyn Tool, args: &serde_json::Value) -> CommandClass {if tool.name() == "shell" {- return classify_shell_tool_call(security, args);+ return classify_shell_tool_call(args);}let permission = tool.permission_level_with_args(args);@@ -130,8 +125,6 @@ pub fn classify_tool_call(args: &serde_json::Value,) -> Result<CommandClass, String> {debug!(tool_name, "[native_ops] classify_tool_call: start");- let security =- SecurityPolicy::from_config(&config.autonomy, &config.workspace_dir, &config.action_dir);let tools = build_runtime_tools(config)?;let tool = tools.into_iter()@@ -140,7 +133,7 @@ pub fn classify_tool_call(debug!(tool_name, "[native_ops] classify_tool_call: tool not found");format!("unknown tool `{tool_name}`")})?;- let class = command_class_for_tool(&security, tool.as_ref(), args);+ let class = command_class_for_tool(tool.as_ref(), args);debug!(tool_name,?class,diff --git a/crates/openhuman-core/src/tools/ops.rs b/crates/openhuman-core/src/tools/ops.rsindex 4492bf7624..d8daebd8d2 100644--- a/crates/openhuman-core/src/tools/ops.rs+++ b/crates/openhuman-core/src/tools/ops.rs@@ -30,8 +30,14 @@ pub fn default_tools_with_runtime(runtime: Arc<dyn RuntimeAdapter>,) -> Vec<Box<dyn Tool>> {let audit = AuditLogger::disabled();+ let config = Arc::new(Config::default());vec![- Box::new(ShellTool::new(security.clone(), runtime, audit)),+ Box::new(ShellTool::with_config(+ security.clone(),+ runtime,+ audit,+ config,+ )),Box::new(FileReadTool::new(security.clone())),Box::new(FileWriteTool::new(security)),]@@ -78,10 +84,11 @@ pub fn all_tools_with_runtime(root_config: &crate::config::Config,approval_workspace_root: Option<&std::path::Path>,) -> Vec<Box<dyn Tool>> {- let shell: Box<dyn Tool> = Box::new(ShellTool::new(+ let shell: Box<dyn Tool> = Box::new(ShellTool::with_config(security.clone(),Arc::clone(&runtime),Arc::clone(&audit),+ Arc::clone(&config),));let file_write: Box<dyn Tool> = match approval_workspace_root {diff --git a/vendor/tinyagents b/vendor/tinyagentsindex 7d97e85114..3f455792f8 160000--- a/vendor/tinyagents+++ b/vendor/tinyagents@@ -1 +1 @@-Subproject commit 7d97e8511487a89cea5fa273562aadd4a1f17177+Subproject commit 3f455792f860c7724f1deea41970cf505a66d55f