Skip to content

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

refactor(agent): move host runtime adapters out of tinybox module

Steven Enamakelbc2f0c22d989
diff --git a/crates/openhuman-core/src/modules/tinybox/host_runtime.rs b/crates/openhuman-core/src/agent/host_runtime.rs
similarity index 100%
rename from crates/openhuman-core/src/modules/tinybox/host_runtime.rs
rename to crates/openhuman-core/src/agent/host_runtime.rs
diff --git a/crates/openhuman-core/src/modules/tinybox/host_runtime_tests.rs b/crates/openhuman-core/src/agent/host_runtime_tests.rs
similarity index 100%
rename from crates/openhuman-core/src/modules/tinybox/host_runtime_tests.rs
rename to crates/openhuman-core/src/agent/host_runtime_tests.rs
diff --git a/crates/openhuman-core/src/agent/mod.rs b/crates/openhuman-core/src/agent/mod.rs
index fddb0ab201..65f69bdfca 100644
--- a/crates/openhuman-core/src/agent/mod.rs
+++ b/crates/openhuman-core/src/agent/mod.rs
@@ -25,6 +25,8 @@ pub(crate) mod cost;
pub mod goals;
pub mod harness;
pub mod hooks;
+/// Host-side runtime adapters used by agent tools and shell policy.
+pub mod host_runtime;
/// Host-registered agents the core's own drivers (cron, workflow nodes) can
/// resolve by id, with their definition, host tools and context.
pub mod host_agents;
diff --git a/crates/openhuman-core/src/agent/session_host/builder/factory.rs b/crates/openhuman-core/src/agent/session_host/builder/factory.rs
index 0ccb4bf7a6..200e6e0532 100644
--- a/crates/openhuman-core/src/agent/session_host/builder/factory.rs
+++ b/crates/openhuman-core/src/agent/session_host/builder/factory.rs
@@ -8,7 +8,7 @@ use crate::agent_registry::host_definition::{
};
use crate::config::Config;
use crate::core::runtime::DispatchCtx;
-use crate::modules::tinybox::host_runtime;
+use crate::agent::host_runtime;
use crate::security::SecurityPolicy;
use crate::tools;
use anyhow::Result;
diff --git a/crates/openhuman-core/src/agent/tinyagents/middleware/failure_policy.rs b/crates/openhuman-core/src/agent/tinyagents/middleware/failure_policy.rs
index f4348ea34f..06c2cb5f12 100644
--- a/crates/openhuman-core/src/agent/tinyagents/middleware/failure_policy.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/middleware/failure_policy.rs
@@ -100,7 +100,7 @@ const ALWAYS_RETRYABLE_ON_TIMEOUT: &[&str] = &[
/// The shell agent commands run under on this host, for a nudge that has to
/// say which commands exist.
fn host_shell_description() -> String {
- let shell = match crate::modules::tinybox::host_runtime::host_shell_flavor() {
+ let shell = match crate::agent::host_runtime::host_shell_flavor() {
tinybox_bus::ShellFlavor::Cmd => "cmd.exe",
tinybox_bus::ShellFlavor::Posix => "bash or sh",
};
diff --git a/crates/openhuman-core/src/channels/runtime/startup/turn_parts.rs b/crates/openhuman-core/src/channels/runtime/startup/turn_parts.rs
index 0266f0d716..d1808cb576 100644
--- a/crates/openhuman-core/src/channels/runtime/startup/turn_parts.rs
+++ b/crates/openhuman-core/src/channels/runtime/startup/turn_parts.rs
@@ -13,7 +13,7 @@ use crate::channels::system_prompt::{ChannelPromptInputs, ChannelSystemPrompt};
use crate::config::Config;
use crate::core::runtime::DispatchCtx;
use crate::inference::provider;
-use crate::modules::tinybox::host_runtime;
+use crate::agent::host_runtime;
use crate::security::SecurityPolicy;
use crate::tools;
use anyhow::Result;
diff --git a/crates/openhuman-core/src/inference/host_runtime/mod.rs b/crates/openhuman-core/src/inference/host_runtime/mod.rs
index f8e4b40b4c..fabd370a8d 100644
--- a/crates/openhuman-core/src/inference/host_runtime/mod.rs
+++ b/crates/openhuman-core/src/inference/host_runtime/mod.rs
@@ -25,7 +25,7 @@ pub mod ops;
mod schemas;
// `pub(crate)` so the shared `apply_no_window` helper can be reused from the
-// agent shell runtime (`modules::tinybox::host_runtime`) — single source of truth for the
+// agent shell runtime (`agent::host_runtime`) — single source of truth for the
// Windows `CREATE_NO_WINDOW` flag (#3727/#3728).
pub mod service;
diff --git a/crates/openhuman-core/src/modules/tinybox.rs b/crates/openhuman-core/src/modules/tinybox.rs
index fffd7423df..547e6c882f 100644
--- a/crates/openhuman-core/src/modules/tinybox.rs
+++ b/crates/openhuman-core/src/modules/tinybox.rs
@@ -9,7 +9,6 @@ use std::time::Duration;
use serde::{de::DeserializeOwned, Serialize};
pub use tinybox_bus as contract;
-pub mod host_runtime;
use crate::config::Config;
diff --git a/crates/openhuman-core/src/sandbox/README.md b/crates/openhuman-core/src/sandbox/README.md
index 493af22cc6..8b6ceb03b1 100644
--- a/crates/openhuman-core/src/sandbox/README.md
+++ b/crates/openhuman-core/src/sandbox/README.md
@@ -233,7 +233,7 @@ The settings surface (`get_sandbox_settings`, `[security.sandbox]` and
default install the sandbox and the `is_always_forbidden` floor are what
bound an agent.
- Shell selection and the child environment for each platform are TinyBox's
- (`SelectShell` / `StartNativeShellExec`); `modules::tinybox::host_runtime::host_shell_flavor`
+ (`SelectShell` / `StartNativeShellExec`); `agent::host_runtime::host_shell_flavor`
only tells the model which family that is.
- The agent's `SandboxMode` is declared in its definition
(`tinyagents_definition::SandboxMode`) and read per call through
diff --git a/crates/openhuman-core/src/tools/impl/system/shell.rs b/crates/openhuman-core/src/tools/impl/system/shell.rs
index aa9e7ef389..279dbcd63f 100644
--- a/crates/openhuman-core/src/tools/impl/system/shell.rs
+++ b/crates/openhuman-core/src/tools/impl/system/shell.rs
@@ -5,7 +5,7 @@ use super::shell_support::{command_failure, exec_result, python_utf8_env, tool_t
use crate::agent::tinyagents::host::run_context::dispatch_ctx_for_tool;
use crate::config::Config;
use crate::core::runtime::DispatchCtx;
-use crate::modules::tinybox::host_runtime::RuntimeAdapter;
+use crate::agent::host_runtime::RuntimeAdapter;
use crate::security::{AuditLogger, CommandExecutionLog, SecurityPolicy};
use async_trait::async_trait;
use serde_json::json;
diff --git a/crates/openhuman-core/src/tools/impl/system/shell_description.rs b/crates/openhuman-core/src/tools/impl/system/shell_description.rs
index b9ca9a54b0..7a6ac2ebec 100644
--- a/crates/openhuman-core/src/tools/impl/system/shell_description.rs
+++ b/crates/openhuman-core/src/tools/impl/system/shell_description.rs
@@ -5,7 +5,7 @@
//! a pure function of the contract's [`ShellFlavor`] so both flavors are testable
//! on any host.
-use crate::modules::tinybox::host_runtime::ShellFlavor;
+use crate::agent::host_runtime::ShellFlavor;
/// The `shell` tool description for the shell this host spawns. Models default
/// to POSIX syntax, so on Windows the description says outright that commands
diff --git a/crates/openhuman-core/src/tools/impl/system/shell_tests.rs b/crates/openhuman-core/src/tools/impl/system/shell_tests.rs
index a712052e83..f13ee919ad 100644
--- a/crates/openhuman-core/src/tools/impl/system/shell_tests.rs
+++ b/crates/openhuman-core/src/tools/impl/system/shell_tests.rs
@@ -1,5 +1,5 @@
use super::*;
-use crate::modules::tinybox::host_runtime::{NativeRuntime, RuntimeAdapter};
+use crate::agent::host_runtime::{NativeRuntime, RuntimeAdapter};
use crate::security::{AutonomyLevel, SecurityPolicy};
use tinybox_bus::CommandClass;
diff --git a/crates/openhuman-core/src/tools/impl/system/shell_tests_platform_tests.rs b/crates/openhuman-core/src/tools/impl/system/shell_tests_platform_tests.rs
index e12ad99f62..503a4a6a14 100644
--- a/crates/openhuman-core/src/tools/impl/system/shell_tests_platform_tests.rs
+++ b/crates/openhuman-core/src/tools/impl/system/shell_tests_platform_tests.rs
@@ -5,7 +5,7 @@
//! pinned on every CI host, not only on a Windows runner.
use super::*;
-use crate::modules::tinybox::host_runtime::{host_shell_flavor, ShellFlavor};
+use crate::agent::host_runtime::{host_shell_flavor, ShellFlavor};
#[cfg(feature = "modules")]
use crate::tools::system::shell_support::PYTHON_UTF8_DEFAULTS;
use std::collections::HashMap;
@@ -185,7 +185,7 @@ fn the_tool_describes_the_shell_its_runtime_spawns() {
#[test]
fn the_docker_runtime_always_runs_posix_sh() {
- let docker = crate::modules::tinybox::host_runtime::create_runtime(
+ let docker = crate::agent::host_runtime::create_runtime(
&crate::config::RuntimeConfig {
kind: "docker".into(),
..crate::config::RuntimeConfig::default()
diff --git a/crates/openhuman-core/src/tools/native_ops.rs b/crates/openhuman-core/src/tools/native_ops.rs
index 5fed8340e7..6f0ec24d0a 100644
--- a/crates/openhuman-core/src/tools/native_ops.rs
+++ b/crates/openhuman-core/src/tools/native_ops.rs
@@ -4,7 +4,7 @@ use std::time::Instant;
use crate::config::Config;
use crate::core::bus::BUS;
use crate::core::events::DomainEvent;
-use crate::modules::tinybox::host_runtime::{NativeRuntime, RuntimeAdapter};
+use crate::agent::host_runtime::{NativeRuntime, RuntimeAdapter};
use crate::security::SecurityPolicy;
use crate::tools;
use crate::tools::native_ops_types::{ExecuteToolOutcome, RuntimeToolSummary};
diff --git a/crates/openhuman-core/src/tools/ops.rs b/crates/openhuman-core/src/tools/ops.rs
index 42fe1a3b87..efc5c0f312 100644
--- a/crates/openhuman-core/src/tools/ops.rs
+++ b/crates/openhuman-core/src/tools/ops.rs
@@ -2,7 +2,7 @@
use super::implementations::network::{McpListServersTool, McpListToolsTool};
use super::*;
use crate::config::{Config, DelegateAgentConfig};
-use crate::modules::tinybox::host_runtime::{NativeRuntime, RuntimeAdapter};
+use crate::agent::host_runtime::{NativeRuntime, RuntimeAdapter};
use crate::security::{AuditLogger, SecurityPolicy};
use crate::tools::delegate::DelegateTool;
use std::collections::HashMap;