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(agent): update module paths to agent_registry and security
Steven Enamakelcbbab34a38dc
diff --git a/crates/openhuman-core/src/agent/prompts/flow_archetype_tests.rs b/crates/openhuman-core/src/agent/prompts/flow_archetype_tests.rsindex 4ca087373d..595c674a77 100644--- a/crates/openhuman-core/src/agent/prompts/flow_archetype_tests.rs+++ b/crates/openhuman-core/src/agent/prompts/flow_archetype_tests.rs@@ -3,7 +3,7 @@ use tinyagents_definition::DefinitionSource;#[test]fn only_dynamic_builtin_flow_definitions_use_the_bus_prompt() {- let registry = crate::agent::harness::host_definition::AgentDefinitionRegistry::builtins_only();+ let registry = crate::agent_registry::host_definition::AgentDefinitionRegistry::builtins_only();for id in ["workflow_builder", "flow_discovery"] {let mut definition = registry.get(id).expect("builtin flow agent").clone();assert!(is_bus_backed_builtin(&definition));@@ -22,7 +22,7 @@ fn only_dynamic_builtin_flow_definitions_use_the_bus_prompt() {#[test]fn renamed_dynamic_flow_builtin_keeps_its_prompt_owner() {- let registry = crate::agent::harness::host_definition::AgentDefinitionRegistry::builtins_only();+ let registry = crate::agent_registry::host_definition::AgentDefinitionRegistry::builtins_only();let mut definition = registry.get("workflow_builder").expect("workflow_builder builtin")@@ -38,7 +38,7 @@ fn renamed_dynamic_flow_builtin_keeps_its_prompt_owner() {#[tokio::test]async fn flow_prompt_requires_the_scoped_config_and_respects_component_disable() {- let registry = crate::agent::harness::host_definition::AgentDefinitionRegistry::builtins_only();+ let registry = crate::agent_registry::host_definition::AgentDefinitionRegistry::builtins_only();let definition = registry.get("workflow_builder").expect("workflow_builder builtin");@@ -57,7 +57,7 @@ async fn flow_prompt_requires_the_scoped_config_and_respects_component_disable()#[tokio::test]async fn flow_prompt_fetch_uses_the_copilot_get_prompt_bus_member() {- let registry = crate::agent::harness::host_definition::AgentDefinitionRegistry::builtins_only();+ let registry = crate::agent_registry::host_definition::AgentDefinitionRegistry::builtins_only();let mut config = Config::default();let temp = tempfile::tempdir().expect("workspace");config.workspace_dir = temp.path().join("workspace");diff --git a/crates/openhuman-core/src/flows/agent_route.rs b/crates/openhuman-core/src/flows/agent_route.rsindex 88c91b664e..7a06534890 100644--- a/crates/openhuman-core/src/flows/agent_route.rs+++ b/crates/openhuman-core/src/flows/agent_route.rs@@ -22,7 +22,7 @@ pub(crate) fn route_for_agent_ref(agent_ref: &str) -> AgentRoute {if crate::agent::host_agents::resolve(agent_ref).is_some() {return AgentRoute::HostAgent;}- let has_definition = crate::agent::harness::host_definition::AgentDefinitionRegistry::current()+ let has_definition = crate::agent_registry::host_definition::AgentDefinitionRegistry::current().map(|reg| reg.get(agent_ref).is_some()).unwrap_or(false);if has_definition {@@ -65,7 +65,7 @@ pub(crate) fn harness_model_default_override(node_model: &str) -> String {/// over the lookup result so the decision is unit-testable without a live/// `Config`/registry.pub(crate) fn route_custom_entry_lookup(- entry: Option<&crate::agent::registry::AgentRegistryEntry>,+ entry: Option<&crate::agent_registry::AgentRegistryEntry>,) -> AgentRoute {match entry {Some(e) if e.enabled => AgentRoute::Harness,diff --git a/crates/openhuman-core/src/flows/agent_route_tests.rs b/crates/openhuman-core/src/flows/agent_route_tests.rsindex d95f9561c3..cc2d4043d2 100644--- a/crates/openhuman-core/src/flows/agent_route_tests.rs+++ b/crates/openhuman-core/src/flows/agent_route_tests.rs@@ -2,9 +2,9 @@ use super::*;use serde_json::json;-fn custom_registry_entry(enabled: bool) -> crate::agent::registry::AgentRegistryEntry {- use crate::agent::registry::types::{AgentRegistrySource, AgentSubagentPolicy};- crate::agent::registry::AgentRegistryEntry {+fn custom_registry_entry(enabled: bool) -> crate::agent_registry::AgentRegistryEntry {+ use crate::agent_registry::types::{AgentRegistrySource, AgentSubagentPolicy};+ crate::agent_registry::AgentRegistryEntry {id: "finance_analyst".to_string(),name: "Finance Analyst".to_string(),description: "Reviews spend and drafts finance summaries.".to_string(),@@ -49,7 +49,7 @@ fn harness_model_default_override_forwards_raw_models_verbatim() {#[test]fn route_for_agent_ref_selects_harness_for_definitions_else_fallback() {- let _ = crate::agent::harness::host_definition::AgentDefinitionRegistry::init_global_builtins();+ let _ = crate::agent_registry::host_definition::AgentDefinitionRegistry::init_global_builtins();assert_eq!(route_for_agent_ref("workflow_builder"), AgentRoute::Harness);assert_eq!(route_for_agent_ref("planner"), AgentRoute::Harness);assert_eq!(diff --git a/crates/openhuman-core/src/flows/caps_host/agent.rs b/crates/openhuman-core/src/flows/caps_host/agent.rsindex f747716cff..b15313d431 100644--- a/crates/openhuman-core/src/flows/caps_host/agent.rs+++ b/crates/openhuman-core/src/flows/caps_host/agent.rs@@ -28,7 +28,7 @@ mod harness;/// agent kind by one of two paths, chosen by [`route_for_agent_ref`]:////// 1. **Full harness turn** (the common case, Phase A). When `agent_ref` names a-/// harness [`AgentDefinition`](crate::agent::harness::host_definition::AgentDefinition),+/// harness [`AgentDefinition`](crate::agent_registry::host_definition::AgentDefinition),/// the node builds a real session agent/// ([`OpenHumanSessionHost::from_config_for_agent`](crate::agent::OpenHumanSessionHost::from_config_for_agent)/// + `set_agent_definition_name`) and drives one full turn via@@ -43,7 +43,7 @@ mod harness;/// the flow's tinyagents graph./// 2. **Persona-shaping completion fallback** (no regression for custom agents)./// When `agent_ref` only resolves to a custom-/// [`AgentRegistryEntry`](crate::agent::registry::AgentRegistryEntry)+/// [`AgentRegistryEntry`](crate::agent_registry::AgentRegistryEntry)/// (no harness definition), the node keeps the original single-completion/// behavior: the entry's `system_prompt` / `model` are shaped on top of the/// node request and run through [`OpenHumanLlm::complete`].@@ -78,7 +78,7 @@ pub struct OpenHumanAgentRunner {/// with every acting dispatch.pub approval: crate::security::approval::ApprovalTurnContext,/// Run-scoped event stream consumed by `CapsHost.AgentEvents`.- pub progress: Option<tokio::sync::mpsc::Sender<crate::agent::progress::AgentProgress>>,+ pub progress: Option<tokio::sync::mpsc::Sender<crate::progress::AgentProgress>>,}/// Bounded callback state for one in-flight host agent turn.@@ -193,7 +193,7 @@ impl OpenHumanAgentRunner {// build a named agent. Idempotent: a booted core already did this at// startup; a bare flow run (tests, standalone) has not. A failure here// is non-fatal — we log and fall through to the registry-entry route.- if let Err(e) = crate::agent::harness::host_definition::AgentDefinitionRegistry::init_global(+ if let Err(e) = crate::agent_registry::host_definition::AgentDefinitionRegistry::init_global(&self.config.workspace_dir,) {tracing::warn!(@@ -251,7 +251,7 @@ impl OpenHumanAgentRunner {// are disabled, which `run_via_registry_fallback` already// rejects with a clear error).let custom_entry =- crate::agent::registry::find_custom_in_config(&self.config, agent_ref);+ crate::agent_registry::find_custom_in_config(&self.config, agent_ref);let entry_model = custom_entry.as_ref().and_then(|e| e.model.clone());match route_custom_entry_lookup(custom_entry.as_ref()) {AgentRoute::Harness | AgentRoute::HostAgent => {diff --git a/crates/openhuman-core/src/flows/caps_host/agent_fallback.rs b/crates/openhuman-core/src/flows/caps_host/agent_fallback.rsindex 42e70df80c..88c9e516b2 100644--- a/crates/openhuman-core/src/flows/caps_host/agent_fallback.rs+++ b/crates/openhuman-core/src/flows/caps_host/agent_fallback.rs@@ -2,7 +2,7 @@ use super::*;impl OpenHumanAgentRunner {/// Persona-shaping single-completion fallback for a custom- /// [`AgentRegistryEntry`](crate::agent::registry::AgentRegistryEntry)+ /// [`AgentRegistryEntry`](crate::agent_registry::AgentRegistryEntry)/// with no harness definition — the pre-Phase-A behavior, kept so custom/// agents don't regress.pub(super) async fn run_via_registry_fallback(@@ -13,7 +13,7 @@ impl OpenHumanAgentRunner {conn: Option<&str>,) -> Result<Value> {// Resolve + validate the requested agent kind against the registry.- let entry = crate::agent::registry::get_agent(dispatch, agent_ref)+ let entry = crate::agent_registry::get_agent(dispatch, agent_ref).await.map_err(EngineError::Capability)?.ok_or_else(|| {diff --git a/crates/openhuman-core/src/flows/caps_host/agent_harness.rs b/crates/openhuman-core/src/flows/caps_host/agent_harness.rsindex 1a18817acd..523dc64ee0 100644--- a/crates/openhuman-core/src/flows/caps_host/agent_harness.rs+++ b/crates/openhuman-core/src/flows/caps_host/agent_harness.rs@@ -152,7 +152,7 @@ impl OpenHumanAgentRunner {//// Cancellation: the run_registry token aborts the engine future, and the// inner turn drops with it (task-local scope unwinds cleanly).- use crate::agent::turn_origin;+ use crate::security::turn_origin;let escalated_origin = escalated_origin_for_nested_harness(self.ctx.turn_origin());if let Some(ref escalated) = escalated_origin {tracing::debug!(diff --git a/crates/openhuman-core/src/flows/caps_host/binding.rs b/crates/openhuman-core/src/flows/caps_host/binding.rsindex c0fde6a456..89aafa9836 100644--- a/crates/openhuman-core/src/flows/caps_host/binding.rs+++ b/crates/openhuman-core/src/flows/caps_host/binding.rs@@ -175,9 +175,9 @@ pub(crate) async fn serve(require_approval: bool,catalog: Arc<CatalogStorageRegistration>,) -> Result<CapsHostRegistration, String> {- let origin = crate::agent::turn_origin::AgentTurnOrigin::TrustedAutomation {+ let origin = crate::security::turn_origin::AgentTurnOrigin::TrustedAutomation {job_id: flow_id.clone(),- source: crate::agent::turn_origin::TrustedAutomationSource::Workflow { require_approval },+ source: crate::security::turn_origin::TrustedAutomationSource::Workflow { require_approval },};let ctx = ctx.with_turn_origin(origin);let security = Arc::new(crate::security::SecurityPolicy::from_config(diff --git a/crates/openhuman-core/src/flows/caps_host/ops_tier_live_config_tests.rs b/crates/openhuman-core/src/flows/caps_host/ops_tier_live_config_tests.rsindex 091c9bf0a4..2db0a191fd 100644--- a/crates/openhuman-core/src/flows/caps_host/ops_tier_live_config_tests.rs+++ b/crates/openhuman-core/src/flows/caps_host/ops_tier_live_config_tests.rs@@ -36,9 +36,9 @@ async fn save_tier_config(config: &Config) {fn has_issue48_workflow_origin(ctx: &crate::core::runtime::DispatchCtx) -> bool {matches!(ctx.turn_origin(),- Some(crate::agent::turn_origin::AgentTurnOrigin::TrustedAutomation {+ Some(crate::security::turn_origin::AgentTurnOrigin::TrustedAutomation {job_id,- source: crate::agent::turn_origin::TrustedAutomationSource::Workflow {+ source: crate::security::turn_origin::TrustedAutomationSource::Workflow {require_approval: true,},}) if job_id == "issue48-flow-run"@@ -58,9 +58,9 @@ async fn one_live_capability_observes_full_readonly_full_updates() {AutonomyLevel::ReadOnly,);save_tier_config(&decoy).await;- let origin = crate::agent::turn_origin::AgentTurnOrigin::TrustedAutomation {+ let origin = crate::security::turn_origin::AgentTurnOrigin::TrustedAutomation {job_id: "issue48-flow-run".to_string(),- source: crate::agent::turn_origin::TrustedAutomationSource::Workflow {+ source: crate::security::turn_origin::TrustedAutomationSource::Workflow {require_approval: true,},};diff --git a/crates/openhuman-core/src/flows/caps_host/prompt.rs b/crates/openhuman-core/src/flows/caps_host/prompt.rsindex bf410a013d..1d335d3904 100644--- a/crates/openhuman-core/src/flows/caps_host/prompt.rs+++ b/crates/openhuman-core/src/flows/caps_host/prompt.rs@@ -45,7 +45,7 @@ pub(crate) fn model_response_to_completion_value(.map(crate::agent::tinyagents::ta_call_to_oh_call).collect::<Vec<_>>(),"usage": usage_to_json(- &crate::agent::tinyagents::model::usage_info_from_response(response)+ &crate::inference::provider::model::usage_info_from_response(response)),"reasoning_content": tinyagents_runtime::transcript::reasoning_from_content(&response.message.contentdiff --git a/crates/openhuman-core/src/flows/caps_host/service.rs b/crates/openhuman-core/src/flows/caps_host/service.rsindex 790f1fae29..4536a07a17 100644--- a/crates/openhuman-core/src/flows/caps_host/service.rs+++ b/crates/openhuman-core/src/flows/caps_host/service.rs@@ -268,12 +268,12 @@ impl CapsHostService {let scope = Arc::clone(&binding);scope.within(async move {- crate::agent::harness::host_definition::AgentDefinitionRegistry::init_global(+ crate::agent_registry::host_definition::AgentDefinitionRegistry::init_global(&binding.config.workspace_dir,).map_err(|error| error.to_string())?;let registry =- crate::agent::harness::host_definition::AgentDefinitionRegistry::current();+ crate::agent_registry::host_definition::AgentDefinitionRegistry::current();registry.and_then(|registry| registry.get(&id).cloned()).map(to_bus_agent_definition)@@ -288,12 +288,12 @@ impl CapsHostService {let scope = Arc::clone(&binding);scope.within(async move {- crate::agent::harness::host_definition::AgentDefinitionRegistry::init_global(+ crate::agent_registry::host_definition::AgentDefinitionRegistry::init_global(&binding.config.workspace_dir,).map_err(|error| error.to_string())?;let registry =- crate::agent::harness::host_definition::AgentDefinitionRegistry::current();+ crate::agent_registry::host_definition::AgentDefinitionRegistry::current();registry.map(|registry| {registrydiff --git a/crates/openhuman-core/src/flows/caps_host/service_agent.rs b/crates/openhuman-core/src/flows/caps_host/service_agent.rsindex 652c63175e..673fff75c3 100644--- a/crates/openhuman-core/src/flows/caps_host/service_agent.rs+++ b/crates/openhuman-core/src/flows/caps_host/service_agent.rs@@ -24,7 +24,7 @@ pub(crate) async fn run_agent(let progress_state = Arc::clone(&state);let progress = tokio::spawn(async move {while let Some(event) = progress_rx.recv().await {- if let crate::agent::progress::AgentProgress::TurnCompleted {+ if let crate::progress::AgentProgress::TurnCompleted {stop: Some(stop), ..} = &event{@@ -163,8 +163,8 @@ pub(crate) async fn run_agent(}}-fn progress_event(event: crate::agent::progress::AgentProgress) -> Option<(String, String)> {- use crate::agent::progress::AgentProgress;+fn progress_event(event: crate::progress::AgentProgress) -> Option<(String, String)> {+ use crate::progress::AgentProgress;match event {AgentProgress::TurnStarted => Some(("turn_started".into(), "Agent turn started".into())),AgentProgress::IterationStarted { iteration, .. } => {diff --git a/crates/openhuman-core/src/flows/caps_host/service_helpers.rs b/crates/openhuman-core/src/flows/caps_host/service_helpers.rsindex 8c85984f98..71f6d25a0b 100644--- a/crates/openhuman-core/src/flows/caps_host/service_helpers.rs+++ b/crates/openhuman-core/src/flows/caps_host/service_helpers.rs@@ -21,7 +21,7 @@ pub(super) fn bus_error(error: impl std::fmt::Display) -> tinybus::Error {}pub(super) fn to_bus_agent_definition(- definition: crate::agent::harness::host_definition::AgentDefinition,+ definition: crate::agent_registry::host_definition::AgentDefinition,) -> Result<runs::AgentDefinition, String> {use tinyagents_definition::{ModelSpec, PromptSource, ToolScope};diff --git a/crates/openhuman-core/src/flows/host_gates/agent_refs.rs b/crates/openhuman-core/src/flows/host_gates/agent_refs.rsindex 65ec0a1827..3fdbb9f502 100644--- a/crates/openhuman-core/src/flows/host_gates/agent_refs.rs+++ b/crates/openhuman-core/src/flows/host_gates/agent_refs.rs@@ -27,11 +27,11 @@ use tinyflows::model::{NodeKind, WorkflowGraph};/// `RegistryFallback` "unknown agent_ref" hard error mid-run/// (`run_via_registry_fallback` in `tinyflows/caps.rs`) — a real ref is one/// that resolves via [`crate::flows::agent_route::route_for_agent_ref`]-/// to a harness [`AgentDefinition`](crate::agent::harness::host_definition::AgentDefinition)+/// to a harness [`AgentDefinition`](crate::agent_registry::host_definition::AgentDefinition)/// (`AgentRoute::Harness`), OR — when it routes to `AgentRoute::RegistryFallback`/// — resolves to an *enabled*-/// [`AgentRegistryEntry`](crate::agent::registry::AgentRegistryEntry)-/// via [`crate::agent::registry::get_agent`]. Both are exactly the+/// [`AgentRegistryEntry`](crate::agent_registry::AgentRegistryEntry)+/// via [`crate::agent_registry::get_agent`]. Both are exactly the/// checks `OpenHumanAgentRunner::run_agent` performs at run time, reused here/// rather than duplicated so the two planes cannot drift.///@@ -67,8 +67,8 @@ pub(crate) async fn validate_agent_refs(config: &Config,graph: &WorkflowGraph,) -> Vec<String> {- use crate::agent::harness::host_definition::AgentDefinitionRegistry;- use crate::agent::registry::AgentRegistryEntry;+ use crate::agent_registry::host_definition::AgentDefinitionRegistry;+ use crate::agent_registry::AgentRegistryEntry;use crate::flows::agent_route::{route_for_agent_ref, AgentRoute};let mut errors = Vec::new();@@ -110,7 +110,7 @@ pub(crate) async fn validate_agent_refs(}AgentRoute::RegistryFallback => {if custom_registry.is_none() {- custom_registry = Some(crate::agent::registry::list_agents(ctx, true).await);+ custom_registry = Some(crate::agent_registry::list_agents(ctx, true).await);}match custom_registry.as_ref().expect("just populated") {Ok(entries) => match entries.iter().find(|entry| entry.id == agent_ref) {diff --git a/crates/openhuman-core/src/flows/host_gates/agent_refs_tests.rs b/crates/openhuman-core/src/flows/host_gates/agent_refs_tests.rsindex 36b2f6571b..c75204faba 100644--- a/crates/openhuman-core/src/flows/host_gates/agent_refs_tests.rs+++ b/crates/openhuman-core/src/flows/host_gates/agent_refs_tests.rs@@ -136,7 +136,7 @@ async fn agent_ref_unknown_is_rejected() {/// never cross.#[tokio::test]async fn agent_ref_gate_reads_the_registry_of_the_explicit_context() {- use crate::agent::registry::types::{AgentRegistryEntry, AgentRegistrySource};+ use crate::agent_registry::types::{AgentRegistryEntry, AgentRegistrySource};use crate::core::runtime::{CoreContext, DispatchCtx, DomainSet};let entry = AgentRegistryEntry {diff --git a/crates/openhuman-core/src/flows/ops_run_finalizer_tests.rs b/crates/openhuman-core/src/flows/ops_run_finalizer_tests.rsindex 3915a74c9b..5f5289c285 100644--- a/crates/openhuman-core/src/flows/ops_run_finalizer_tests.rs+++ b/crates/openhuman-core/src/flows/ops_run_finalizer_tests.rs@@ -14,7 +14,7 @@ async fn streamed_flow_finalizer_settles_the_bridge_workspace_turn_state() {),);- crate::agent::harness::host_definition::AgentDefinitionRegistry::init_global(+ crate::agent_registry::host_definition::AgentDefinitionRegistry::init_global(&config_b.workspace_dir,).expect("agent registry init");