Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

refactor(security): use tinybox-bus CommandClass directly

Steven Enamakele8825cd139f3
diff --git a/crates/openhuman-core/Cargo.toml b/crates/openhuman-core/Cargo.toml
index e229ed229c..f5996c459e 100644
--- a/crates/openhuman-core/Cargo.toml
+++ b/crates/openhuman-core/Cargo.toml
@@ -138,7 +138,7 @@ tinyagents-harness = { path = "../../vendor/tinyagents/crates/tinyagents-harness
"multimodal",
"builtin-tools",
] }
-tinybox-bus = { path = "../../vendor/tinybox/crates/tinybox-bus", optional = true }
+tinybox-bus = { path = "../../vendor/tinybox/crates/tinybox-bus" }
tinyagents-definition = { path = "../../vendor/tinyagents/crates/tinyagents-definition" }
# Live (realtime voice) agent sessions: `tinyagents-live` runs a
# `tinyliveagents` provider session (Gemini Live direct/relayed, ElevenLabs
@@ -670,7 +670,6 @@ tinymemes = ["dep:tinymemes"]
# the first call. They are wire vocabulary only (no I/O, no runtime).
modules = [
"tinybus/modules",
- "dep:tinybox-bus",
"dep:tinydocs-bus",
"dep:tinyhosts-bus",
"dep:tinyvoice-bus",
diff --git a/crates/openhuman-core/src/security/mod.rs b/crates/openhuman-core/src/security/mod.rs
index 47ad123692..d6d4483946 100644
--- a/crates/openhuman-core/src/security/mod.rs
+++ b/crates/openhuman-core/src/security/mod.rs
@@ -44,7 +44,7 @@ pub use policy::SecurityPolicy;
pub use policy::ToolOperation;
pub use policy::{ensure_openhuman_scratch_dir, openhuman_scratch_dir};
#[allow(unused_imports)]
-pub use policy::{CommandClass, GateDecision};
+pub use policy::GateDecision;
#[allow(unused_imports)]
pub use policy::{TrustedAccess, TrustedRoot};
pub use policy::{POLICY_BLOCKED_MARKER, POLICY_DENIED_MARKER};
diff --git a/crates/openhuman-core/src/security/policy/command_checks.rs b/crates/openhuman-core/src/security/policy/command_checks.rs
index fa84e2cbd3..5480f6afdc 100644
--- a/crates/openhuman-core/src/security/policy/command_checks.rs
+++ b/crates/openhuman-core/src/security/policy/command_checks.rs
@@ -3,8 +3,9 @@ use std::path::{Path, PathBuf};
#[cfg(test)]
use super::types::CommandRiskLevel;
use super::types::{
- AutonomyLevel, CommandClass, GateDecision, SecurityPolicy, POLICY_BLOCKED_MARKER,
+ AutonomyLevel, GateDecision, SecurityPolicy, POLICY_BLOCKED_MARKER,
};
+use tinybox_bus::shell::CommandClass;
#[cfg(test)]
use crate::util::floor_char_boundary;
#[cfg(test)]
@@ -80,15 +81,7 @@ impl SecurityPolicy {
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
- }
- })
+ .map(|segment| segment.class)
.max()
.unwrap_or(CommandClass::Read);
if analysis.redirection || analysis.tee {
@@ -240,15 +233,7 @@ impl SecurityPolicy {
let base = normalized_command_name(base_raw);
let args: Vec<String> = words.map(|w| w.to_ascii_lowercase()).collect();
let joined = cmd_part.to_ascii_lowercase();
- let segment_class = match classify_segment(&base, &args, &joined) {
- tinybox_core::shell::classify::CommandClass::Read => CommandClass::Read,
- tinybox_core::shell::classify::CommandClass::Write => CommandClass::Write,
- tinybox_core::shell::classify::CommandClass::Network => CommandClass::Network,
- tinybox_core::shell::classify::CommandClass::Install => CommandClass::Install,
- tinybox_core::shell::classify::CommandClass::Destructive => {
- CommandClass::Destructive
- }
- };
+ let segment_class = classify_segment(&base, &args, &joined);
class = class.max(segment_class);
}
// A redirect or `tee` writes a file regardless of the base command.
diff --git a/crates/openhuman-core/src/security/policy/mod.rs b/crates/openhuman-core/src/security/policy/mod.rs
index 500cc64e9a..c2f07b85d7 100644
--- a/crates/openhuman-core/src/security/policy/mod.rs
+++ b/crates/openhuman-core/src/security/policy/mod.rs
@@ -15,7 +15,7 @@ pub(crate) use path_checks::{
ALWAYS_FORBIDDEN_PREFIXES, SENSITIVE_COMPONENTS, SENSITIVE_FILES, SENSITIVE_PAIRS,
};
pub use types::{
- tool_result_artifacts_dir, ActionTracker, AutonomyLevel, CommandClass, CommandRiskLevel,
+ tool_result_artifacts_dir, ActionTracker, AutonomyLevel, CommandRiskLevel,
GateDecision, SecurityPolicy, ToolOperation, TrustedAccess, TrustedRoot, POLICY_BLOCKED_MARKER,
POLICY_DENIED_MARKER,
};
diff --git a/crates/openhuman-core/src/security/policy/types.rs b/crates/openhuman-core/src/security/policy/types.rs
index 954130fd36..045101258e 100644
--- a/crates/openhuman-core/src/security/policy/types.rs
+++ b/crates/openhuman-core/src/security/policy/types.rs
@@ -71,17 +71,6 @@ pub enum CommandRiskLevel {
High,
}
-/// Coarse permission bucket the harness approval gate keys on. TinyBox
-/// supplies parser facts; OpenHuman owns this authorization category.
-#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
-pub enum CommandClass {
- Read,
- Write,
- Network,
- Install,
- Destructive,
-}
-
/// What the harness should do with an acting tool call of a given
/// [`CommandClass`] under the session's [`AutonomyLevel`]. Computed by
/// [`SecurityPolicy::gate_decision`]; the harness translates `Prompt` into an