Skip to content

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

refactor(harness): widen visibility and simplify provider normalization

Steven Enamakel2acb32d0be3a
diff --git a/crates/openhuman-embed/src/agent/build.rs b/crates/openhuman-embed/src/agent/build.rs
index 84cfaf8e81..be5f99f09b 100644
--- a/crates/openhuman-embed/src/agent/build.rs
+++ b/crates/openhuman-embed/src/agent/build.rs
@@ -13,7 +13,6 @@ use openhuman_core::core::runtime::{ContextOverlay, DomainSet};
use openhuman_core::tools::toolpacks::{GroupMode, ToolGroups};
use super::{AgentError, AgentInner, AgentLayout, AgentSpec};
-use crate::harness::Provider;
use crate::runtime::Runtime;
pub(crate) fn instantiate(runtime: &Runtime, spec: AgentSpec) -> Result<AgentInner, AgentError> {
@@ -152,16 +151,12 @@ pub(crate) fn instantiate(runtime: &Runtime, spec: AgentSpec) -> Result<AgentInn
config,
definition,
profile,
- provider: normalize_provider(provider),
+ provider,
access,
layout,
})
}
-fn normalize_provider(provider: Provider) -> Provider {
- provider
-}
-
/// Every family the agent asks for must be one the runtime registered.
pub(crate) fn check_domains_narrow(requested: DomainSet, runtime: DomainSet) -> Result<(), AgentError> {
let widened: Vec<String> = DomainGroup::ALL
diff --git a/crates/openhuman-embed/src/harness/access.rs b/crates/openhuman-embed/src/harness/access.rs
index 96504b4371..59518fb96d 100644
--- a/crates/openhuman-embed/src/harness/access.rs
+++ b/crates/openhuman-embed/src/harness/access.rs
@@ -142,7 +142,7 @@ impl Access {
}
/// Write this access level into `config`.
- pub(super) fn apply(&self, config: &mut openhuman_core::config::Config) {
+ pub(crate) fn apply(&self, config: &mut openhuman_core::config::Config) {
config.autonomy.level = self.level;
config.autonomy.allow_tool_install = self.allow_tool_install;
config
diff --git a/crates/openhuman-embed/src/harness/provider.rs b/crates/openhuman-embed/src/harness/provider.rs
index 18a563de1b..c2302f8277 100644
--- a/crates/openhuman-embed/src/harness/provider.rs
+++ b/crates/openhuman-embed/src/harness/provider.rs
@@ -83,7 +83,7 @@ impl Provider {
/// Whether the route would survive [`EphemeralRoute::from_params`]'s
/// normalization. Kept separate from [`Self::is_routed`], which describes
/// the caller's syntactic choice for diagnostics.
- pub(super) fn has_usable_route(&self) -> bool {
+ pub(crate) fn has_usable_route(&self) -> bool {
self.route.as_ref().is_some_and(|route| {
!route.base_url.trim().is_empty() && !route.api_key.trim().is_empty()
})
diff --git a/crates/openhuman-embed/src/harness/skills.rs b/crates/openhuman-embed/src/harness/skills.rs
index 801007c302..560e5193e7 100644
--- a/crates/openhuman-embed/src/harness/skills.rs
+++ b/crates/openhuman-embed/src/harness/skills.rs
@@ -32,13 +32,15 @@ use super::error::HarnessError;
/// The manifest filenames a skill bundle can declare itself with, newest first.
const MANIFESTS: [&str; 3] = ["WORKFLOW.md", "SKILL.md", "skill.json"];
-/// Copy every skill bundle in `source` into `<workspace>/skills`.
+/// Copy every skill bundle in `source` into `dest_root` — the workspace's
+/// `skills/` for the one-agent harness, `personalities/<id>/skills/` for a
+/// runtime agent.
///
/// A "bundle" is an immediate subdirectory carrying one of [`MANIFESTS`]. If
/// `source` itself carries one, it is treated as a single bundle and copied
/// under its own directory name — so both `skills_dir("./skills")` and
/// `skills_dir("./skills/my-skill")` do what the caller plainly meant.
-pub(super) fn install(source: &Path, workspace_dir: &Path) -> Result<usize, HarnessError> {
+pub(crate) fn install(source: &Path, dest_root: &Path) -> Result<usize, HarnessError> {
if !source.is_dir() {
return Err(HarnessError::Invalid(format!(
"skills_dir {} is not a directory",
@@ -46,7 +48,7 @@ pub(super) fn install(source: &Path, workspace_dir: &Path) -> Result<usize, Harn
)));
}
- let dest_root = workspace_dir.join("skills");
+ let dest_root = dest_root.to_path_buf();
std::fs::create_dir_all(&dest_root).map_err(|source| HarnessError::Workspace {
what: "create the workspace skills directory",
source,
diff --git a/crates/openhuman-embed/src/harness/workspace.rs b/crates/openhuman-embed/src/harness/workspace.rs
index f2b6ecb455..8e669a8184 100644
--- a/crates/openhuman-embed/src/harness/workspace.rs
+++ b/crates/openhuman-embed/src/harness/workspace.rs
@@ -62,17 +62,17 @@ impl Workspace {
/// The `TempDir` is held rather than leaked so the directory is removed on drop.
/// Losing it would turn every ephemeral harness into a permanent temp-dir leak,
/// which on a machine whose `/tmp` is a tmpfs is a RAM leak.
-pub(super) struct ResolvedWorkspace {
- pub(super) workspace_dir: PathBuf,
- pub(super) action_dir: PathBuf,
+pub(crate) struct ResolvedWorkspace {
+ pub(crate) workspace_dir: PathBuf,
+ pub(crate) action_dir: PathBuf,
/// Where `config.toml` would live. **Not** cosmetic: its *parent* is the
/// state directory the credential store, the auth profiles and the keyring
/// file backend all resolve against. Leave it at the default while pointing
/// `workspace_dir` at a temp dir and the harness reads and writes the
/// operator's real `~/.openhuman` credentials while looking hermetic.
- pub(super) config_path: PathBuf,
- /// `None` for `Dir` / `Inherit`; those directories outlive the harness.
- pub(super) _temp: Option<tempfile::TempDir>,
+ pub(crate) config_path: PathBuf,
+ /// `None` for `Dir` / `Inherit`; those directories outlive the runtime.
+ pub(crate) _temp: Option<tempfile::TempDir>,
}
impl ResolvedWorkspace {
@@ -90,7 +90,7 @@ impl ResolvedWorkspace {
/// the same shape `load_or_init` produces (`<root>/config.toml` next to
/// `<root>/workspace`). Credential state follows that file's parent, so the
/// layout is what makes an ephemeral harness actually ephemeral.
- pub(super) fn resolve(
+ pub(crate) fn resolve(
workspace: &Workspace,
action_dir_override: Option<&Path>,
) -> Result<Self, HarnessError> {