Skip to content

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

chore: files changed crates/openhuman-core/src/agent/debug/mod.rs,crates/openhuman-core/src/agent/se

Steven Enamakelc0d7e0ec9bf2
diff --git a/crates/openhuman-core/src/agent/debug/mod.rs b/crates/openhuman-core/src/agent/debug/mod.rs
index 8c489f6030..94142ae6f1 100644
--- a/crates/openhuman-core/src/agent/debug/mod.rs
+++ b/crates/openhuman-core/src/agent/debug/mod.rs
@@ -185,12 +185,8 @@ async fn render_via_session(
config: &Config,
agent_id: &str,
) -> Result<DumpedPrompt> {
- let mut agent = OpenHumanSessionHost::from_config_for_agent(
- ctx,
- config,
- agent_id,
- )
- .with_context(|| format!("building session agent for `{agent_id}`"))?;
+ let mut agent = OpenHumanSessionHost::from_config_for_agent(ctx, config, agent_id)
+ .with_context(|| format!("building session agent for `{agent_id}`"))?;
// Match turn-1 behaviour: fetch the user's active Composio
// connections so the rendered prompt mirrors what the LLM actually
diff --git a/crates/openhuman-core/src/agent/session_host/prelude_integrations.rs b/crates/openhuman-core/src/agent/session_host/prelude_integrations.rs
index bf318f6e12..f563a71002 100644
--- a/crates/openhuman-core/src/agent/session_host/prelude_integrations.rs
+++ b/crates/openhuman-core/src/agent/session_host/prelude_integrations.rs
@@ -458,9 +458,7 @@ impl OpenHumanTurnPrelude {
// of the old per-turn filesystem scan.
let latest = config
.as_deref()
- .map(|config| {
- crate::skills::load_workflow_metadata_for(&self.dispatch_ctx(), config)
- })
+ .map(|config| crate::skills::load_workflow_metadata_for(&self.dispatch_ctx(), config))
.unwrap_or_default();
let id = |workflow: &tinyskills::Skill| {
if workflow.dir_name.is_empty() {
diff --git a/crates/openhuman-core/src/core/runtime/bootstrap.rs b/crates/openhuman-core/src/core/runtime/bootstrap.rs
index 7d721b0dbd..ad017fe199 100644
--- a/crates/openhuman-core/src/core/runtime/bootstrap.rs
+++ b/crates/openhuman-core/src/core/runtime/bootstrap.rs
@@ -255,11 +255,7 @@ pub(crate) async fn bootstrap_core_runtime(
// Gated on the Skills domain (#4808 review): under `harness()`/`none()` the
// skills controllers are absent, so their trigger subscriber must not install.
if domains.allows(crate::core::all::DomainGroup::Skills) {
- crate::skills::bus::ensure_triggered_workflow_subscriber_for(
- ctx,
- &cfg,
- Some(domains),
- );
+ crate::skills::bus::ensure_triggered_workflow_subscriber_for(ctx, &cfg, Some(domains));
} else {
log::debug!("[boot] triggered-workflow subscriber SKIPPED — Skills domain disabled");
}
diff --git a/crates/openhuman-core/src/skills/bundled/flow_authoring.rs b/crates/openhuman-core/src/skills/bundled/flow_authoring.rs
index e6bf03e4b0..89e7c383db 100644
--- a/crates/openhuman-core/src/skills/bundled/flow_authoring.rs
+++ b/crates/openhuman-core/src/skills/bundled/flow_authoring.rs
@@ -5,18 +5,18 @@
//! materialization, and keeps a process snapshot so synchronous discovery can
//! verify the disk tree without reaching across the async bus boundary.
+use sha2::Digest;
use std::collections::{BTreeSet, HashMap, HashSet};
use std::path::{Path, PathBuf};
use std::sync::atomic::{AtomicU64, Ordering};
use std::sync::{Arc, LazyLock, Mutex, RwLock};
use std::time::Duration;
-use sha2::Digest;
use tokio::sync::Mutex as AsyncMutex;
use crate::config::Config;
use crate::core::runtime::{DispatchCtx, DomainSet};
-use tinyskills::{MaterializeEntry, MaterializeFile, MaterializeSource, Skill, SkillScope};
use tinyflows_bus::copilot::ResourceFile;
+use tinyskills::{MaterializeEntry, MaterializeFile, MaterializeSource, Skill, SkillScope};
use super::super::ops_discover::DiscoveryGate;
@@ -55,11 +55,7 @@ pub(crate) fn root(workspace: &Path, gate: &DiscoveryGate) -> PathBuf {
/// Schedule optional resource loading without holding up runtime bootstrap,
/// channel construction, or the first ordinary agent turn.
-pub(crate) fn schedule_prewarm(
- ctx: &DispatchCtx,
- config: &Config,
- domains: Option<DomainSet>,
-) {
+pub(crate) fn schedule_prewarm(ctx: &DispatchCtx, config: &Config, domains: Option<DomainSet>) {
let owned_ctx = ctx.clone();
let owned_config = config.clone();
schedule_prewarm_operation(ctx, config, domains, async move {
@@ -135,11 +131,7 @@ fn warmup_lock(key: &SnapshotKey) -> Arc<AsyncMutex<()>> {
/// Fetch and materialize Copilot resources when every owning capability is
/// enabled. Failures clear the snapshot and return normally so optional module
/// availability never blocks ordinary chat startup.
-pub(crate) async fn prewarm(
- ctx: &DispatchCtx,
- config: &Config,
- domains: Option<DomainSet>,
-) {
+pub(crate) async fn prewarm(ctx: &DispatchCtx, config: &Config, domains: Option<DomainSet>) {
let gate = DiscoveryGate::from_config(ctx, config, domains);
if !gate.flow_authoring_enabled() {
tracing::debug!(
@@ -209,7 +201,9 @@ async fn prewarm_locked(
resources.sort_by(|left, right| left.path.cmp(&right.path));
if !module_is_serving() {
- tracing::warn!("[skills][bundled] TinyFlows module is not serving after ListResources; hiding builtin");
+ tracing::warn!(
+ "[skills][bundled] TinyFlows module is not serving after ListResources; hiding builtin"
+ );
clear_snapshot(key);
return;
}
@@ -233,7 +227,9 @@ pub(crate) fn generation_if_current(workspace: &Path, gate: &DiscoveryGate) -> O
.ok()
.and_then(|snapshots| snapshots.get(&key).cloned())?;
if !materialization_matches(workspace, gate, &snapshot) {
- tracing::warn!("[skills][bundled] cached flow-authoring materialization changed; hiding builtin");
+ tracing::warn!(
+ "[skills][bundled] cached flow-authoring materialization changed; hiding builtin"
+ );
clear_snapshot(&key);
return None;
}
@@ -253,7 +249,10 @@ pub(crate) fn materialized_skill(
clear_snapshot(&key);
return None;
}
- let skill = tinyskills::load_skill_dir(&root(workspace, gate).join(FLOW_SKILL_ID), SkillScope::Builtin)?;
+ let skill = tinyskills::load_skill_dir(
+ &root(workspace, gate).join(FLOW_SKILL_ID),
+ SkillScope::Builtin,
+ )?;
(skill.id() == FLOW_SKILL_ID).then_some(skill)
}
@@ -282,8 +281,8 @@ pub(crate) fn read_resource(
.find(|file| file.path == requested)
.map(|file| file.contents.as_str())
.ok_or_else(|| "resource is not present in the current TinyFlows snapshot".to_string())?;
- let content = tinyskills::read_resource(skill, relative_path)
- .map_err(|error| error.to_string())?;
+ let content =
+ tinyskills::read_resource(skill, relative_path).map_err(|error| error.to_string())?;
if content != expected {
clear_snapshot(&key);
return Err("flow-authoring resource bytes changed".to_string());
@@ -314,9 +313,9 @@ fn valid_resource_manifest(files: &[ResourceFile]) -> bool {
if files.iter().any(|file| !paths.insert(file.path.as_str())) {
return false;
}
- files.iter().any(|file| {
- file.path == tinyskills::WORKFLOW_MD || file.path == tinyskills::SKILL_MD
- })
+ files
+ .iter()
+ .any(|file| file.path == tinyskills::WORKFLOW_MD || file.path == tinyskills::SKILL_MD)
}
fn materialize(
@@ -392,9 +391,11 @@ fn materialization_matches(workspace: &Path, gate: &DiscoveryGate, snapshot: &Sn
return false;
}
- let Some(manifest) = snapshot.files.iter().find(|file| {
- file.path == tinyskills::WORKFLOW_MD || file.path == tinyskills::SKILL_MD
- }) else {
+ let Some(manifest) = snapshot
+ .files
+ .iter()
+ .find(|file| file.path == tinyskills::WORKFLOW_MD || file.path == tinyskills::SKILL_MD)
+ else {
return false;
};
let Some(location) = skill.location.as_deref() else {
diff --git a/crates/openhuman-core/src/skills/bundled/flow_authoring_tests.rs b/crates/openhuman-core/src/skills/bundled/flow_authoring_tests.rs
index 2f1671782c..4cc36417a8 100644
--- a/crates/openhuman-core/src/skills/bundled/flow_authoring_tests.rs
+++ b/crates/openhuman-core/src/skills/bundled/flow_authoring_tests.rs
@@ -70,7 +70,10 @@ fn resource_snapshot_revisions_follow_changed_bus_bytes() {
let updated = publish_snapshot(workspace.path(), &gate, resources("second version"))
.expect("materialize updated resource set");
- assert!(updated > first, "changed bus bytes advance the snapshot revision");
+ assert!(
+ updated > first,
+ "changed bus bytes advance the snapshot revision"
+ );
let current = snapshot_for(&snapshot_key(workspace.path(), &gate), updated).expect("snapshot");
assert!(materialization_matches(workspace.path(), &gate, &current));
assert_eq!(current.files[1].contents, "second version");
diff --git a/crates/openhuman-core/src/skills/bus.rs b/crates/openhuman-core/src/skills/bus.rs
index 96695772f1..567eb8675f 100644
--- a/crates/openhuman-core/src/skills/bus.rs
+++ b/crates/openhuman-core/src/skills/bus.rs
@@ -215,9 +215,8 @@ pub(crate) fn ensure_triggered_workflow_subscriber_for(
domains: Option<crate::core::runtime::DomainSet>,
) {
TRIGGERED_WORKFLOW_HANDLE.get_or_init(|| {
- let workflows = crate::skills::ops_discover::load_workflow_metadata_for_domains(
- ctx, config, domains,
- );
+ let workflows =
+ crate::skills::ops_discover::load_workflow_metadata_for_domains(ctx, config, domains);
register_triggered_workflow_subscriber(&workflows)
});
}
diff --git a/crates/openhuman-core/src/skills/ops_discover.rs b/crates/openhuman-core/src/skills/ops_discover.rs
index 42a9b956a1..f87cdbcd6c 100644
--- a/crates/openhuman-core/src/skills/ops_discover.rs
+++ b/crates/openhuman-core/src/skills/ops_discover.rs
@@ -25,10 +25,10 @@ pub use api::{
pub use resource::{read_workflow_resource, read_workflow_resource_for};
pub(crate) use api::discover_workflows_inner;
-pub(crate) use api::DiscoveryGate;
+pub(crate) use api::invalidate_workflow_metadata_cache;
pub(crate) use api::load_workflow_metadata_for_domains;
pub(crate) use api::load_workflow_metadata_for_with_home;
-pub(crate) use api::invalidate_workflow_metadata_cache;
+pub(crate) use api::DiscoveryGate;
#[cfg(test)]
pub(crate) use api::DISCOVERY_CALLS;
diff --git a/crates/openhuman-core/src/skills/ops_discover/api.rs b/crates/openhuman-core/src/skills/ops_discover/api.rs
index 91dd76257b..c7e8527ceb 100644
--- a/crates/openhuman-core/src/skills/ops_discover/api.rs
+++ b/crates/openhuman-core/src/skills/ops_discover/api.rs
@@ -60,9 +60,7 @@ impl DiscoveryGate {
let parent_config = ctx.embedder_config();
let module_selection = module_selection_fingerprint(&config.modules);
let module_selection = match parent_config.as_ref() {
- Some(parent)
- if module_selection_fingerprint(&parent.modules) != module_selection =>
- {
+ Some(parent) if module_selection_fingerprint(&parent.modules) != module_selection => {
None
}
_ => Some(module_selection),
@@ -81,9 +79,7 @@ impl DiscoveryGate {
}
fn skills_enabled(&self) -> bool {
- cfg!(feature = "skills")
- && self.skills_component
- && self.skills_domain.unwrap_or(true)
+ cfg!(feature = "skills") && self.skills_component && self.skills_domain.unwrap_or(true)
}
pub(crate) fn flow_authoring_enabled(&self) -> bool {
@@ -237,11 +233,7 @@ fn load_workflow_metadata_for_domains_with_home(
None => home_override.or_else(discovery_home_dir),
};
let gate = DiscoveryGate::from_config(ctx, config, domains);
- load_workflow_metadata_with_gate(
- &config.workspace_dir,
- home,
- gate,
- )
+ load_workflow_metadata_with_gate(&config.workspace_dir, home, gate)
}
pub(super) fn load_workflow_metadata_with_gate(
@@ -336,9 +328,7 @@ fn flow_generation_for(workspace: &Path, gate: &DiscoveryGate) -> Option<u64> {
#[cfg(feature = "flows")]
{
gate.flow_authoring_enabled()
- .then(|| {
- crate::skills::bundled::flow_authoring::generation_if_current(workspace, gate)
- })
+ .then(|| crate::skills::bundled::flow_authoring::generation_if_current(workspace, gate))
.flatten()
}
#[cfg(not(feature = "flows"))]
diff --git a/crates/openhuman-core/src/skills/ops_discover/resource.rs b/crates/openhuman-core/src/skills/ops_discover/resource.rs
index 98ad29644a..3bb846aab1 100644
--- a/crates/openhuman-core/src/skills/ops_discover/resource.rs
+++ b/crates/openhuman-core/src/skills/ops_discover/resource.rs
@@ -1,6 +1,6 @@
//! OpenHuman discovery context around `tinyskills` resource reads.
-use super::api::{DiscoveryGate, load_workflow_metadata_with_gate};
+use super::api::{load_workflow_metadata_with_gate, DiscoveryGate};
use std::path::Path;
pub fn read_workflow_resource(
@@ -58,11 +58,9 @@ fn read_workflow_resource_with_gate(
if !gate.flow_authoring_enabled() {
return Err("flow-authoring is unavailable in this context".to_string());
}
- let generation = crate::skills::bundled::flow_authoring::generation_if_current(
- workspace_dir,
- &gate,
- )
- .ok_or_else(|| "flow-authoring resources are unavailable".to_string())?;
+ let generation =
+ crate::skills::bundled::flow_authoring::generation_if_current(workspace_dir, &gate)
+ .ok_or_else(|| "flow-authoring resources are unavailable".to_string())?;
return crate::skills::bundled::flow_authoring::read_resource(
workspace_dir,
&gate,
diff --git a/crates/openhuman-core/src/skills/ops_discover/scan.rs b/crates/openhuman-core/src/skills/ops_discover/scan.rs
index 0f6d2cec8f..82ff9f4e66 100644
--- a/crates/openhuman-core/src/skills/ops_discover/scan.rs
+++ b/crates/openhuman-core/src/skills/ops_discover/scan.rs
@@ -51,13 +51,9 @@ pub(super) fn discover_filtered(
#[cfg(feature = "flows")]
if gate.flow_authoring_enabled() && kinds.contains(&RootKind::Skill) {
if let (Some(workspace), Some(generation)) = (workspace_dir, flow_generation) {
- if let Some(flow_authoring) =
- crate::skills::bundled::flow_authoring::materialized_skill(
- workspace,
- gate,
- generation,
- )
- {
+ if let Some(flow_authoring) = crate::skills::bundled::flow_authoring::materialized_skill(
+ workspace, gate, generation,
+ ) {
builtin.push(flow_authoring);
}
}
diff --git a/crates/openhuman-core/src/skills/ops_discovery_tests.rs b/crates/openhuman-core/src/skills/ops_discovery_tests.rs
index 0f4651f37c..c461271e8f 100644
--- a/crates/openhuman-core/src/skills/ops_discovery_tests.rs
+++ b/crates/openhuman-core/src/skills/ops_discovery_tests.rs
@@ -390,18 +390,17 @@ async fn module_builtin_gate_only_narrows_context_and_explicit_config() {
let all = ComponentSet::all();
let base = CoreContext::for_test_with_components(all);
let enabled_context = base.derive_with(
- ContextOverlay::new(enabled_config.clone(), DomainSet::full(), ToolGroups::none())
- .profile("shared"),
+ ContextOverlay::new(
+ enabled_config.clone(),
+ DomainSet::full(),
+ ToolGroups::none(),
+ )
+ .profile("shared"),
);
let enabled = CoreContext::scope(enabled_context, async {
let dispatch = crate::core::runtime::DispatchCtx::ambient();
- crate::skills::bundled::flow_authoring::prewarm(
- &dispatch,
- &enabled_config,
- None,
- )
- .await;
+ crate::skills::bundled::flow_authoring::prewarm(&dispatch, &enabled_config, None).await;
crate::skills::load_workflow_metadata_for(&dispatch, &enabled_config)
})
.await;
@@ -411,8 +410,12 @@ async fn module_builtin_gate_only_narrows_context_and_explicit_config() {
context_components.tinyflows = false;
let context_component_context = CoreContext::for_test_with_components(context_components)
.derive_with(
- ContextOverlay::new(enabled_config.clone(), DomainSet::full(), ToolGroups::none())
- .profile("shared"),
+ ContextOverlay::new(
+ enabled_config.clone(),
+ DomainSet::full(),
+ ToolGroups::none(),
+ )
+ .profile("shared"),
);
let context_component_hidden = CoreContext::scope(context_component_context, async {
let dispatch = crate::core::runtime::DispatchCtx::ambient();
@@ -452,8 +455,12 @@ async fn module_builtin_gate_only_narrows_context_and_explicit_config() {
disabled_config.components.tinyflows = false;
let config_hidden = CoreContext::scope(
CoreContext::for_test_with_components(all).derive_with(
- ContextOverlay::new(enabled_config.clone(), DomainSet::full(), ToolGroups::none())
- .profile("shared"),
+ ContextOverlay::new(
+ enabled_config.clone(),
+ DomainSet::full(),
+ ToolGroups::none(),
+ )
+ .profile("shared"),
),
async {
let dispatch = crate::core::runtime::DispatchCtx::ambient();
@@ -462,7 +469,9 @@ async fn module_builtin_gate_only_narrows_context_and_explicit_config() {
)
.await;
assert!(
- !config_hidden.iter().any(|skill| skill.id() == "flow-authoring"),
+ !config_hidden
+ .iter()
+ .any(|skill| skill.id() == "flow-authoring"),
"a narrower supplied Config hides resources from an enabled parent context"
);
@@ -470,8 +479,12 @@ async fn module_builtin_gate_only_narrows_context_and_explicit_config() {
modules_disabled.modules.enabled = false;
let modules_hidden = CoreContext::scope(
CoreContext::for_test_with_components(all).derive_with(
- ContextOverlay::new(enabled_config.clone(), DomainSet::full(), ToolGroups::none())
- .profile("shared"),
+ ContextOverlay::new(
+ enabled_config.clone(),
+ DomainSet::full(),
+ ToolGroups::none(),
+ )
+ .profile("shared"),
),
async {
let dispatch = crate::core::runtime::DispatchCtx::ambient();
@@ -490,8 +503,12 @@ async fn module_builtin_gate_only_narrows_context_and_explicit_config() {
skills_disabled.skills = false;
let skills_context_hidden = CoreContext::scope(
CoreContext::for_test_with_components(skills_disabled).derive_with(
- ContextOverlay::new(enabled_config.clone(), DomainSet::full(), ToolGroups::none())
- .profile("shared"),
+ ContextOverlay::new(
+ enabled_config.clone(),
+ DomainSet::full(),
+ ToolGroups::none(),
+ )
+ .profile("shared"),
),
async {
let dispatch = crate::core::runtime::DispatchCtx::ambient();
@@ -569,7 +586,10 @@ async fn module_builtin_gate_only_narrows_context_and_explicit_config() {
)
})
.await;
- assert!(tenant_b_after_tamper.is_ok(), "tenant A tampering must not evict tenant B");
+ assert!(
+ tenant_b_after_tamper.is_ok(),
+ "tenant A tampering must not evict tenant B"
+ );
let _ = flow_b;
}
diff --git a/crates/openhuman-core/src/skills/tools/read.rs b/crates/openhuman-core/src/skills/tools/read.rs
index 977fbe6ad6..d838d4458f 100644
--- a/crates/openhuman-core/src/skills/tools/read.rs
+++ b/crates/openhuman-core/src/skills/tools/read.rs
@@ -183,13 +183,9 @@ impl Tool for WorkflowReadResourceTool {
let skill_id = read_workflow_id(&args)?;
let relative_path = read_required_str(&args, "relative_path")?;
let ctx = crate::core::runtime::DispatchCtx::ambient();
- let content = read_workflow_resource_for(
- &ctx,
- &self.config,
- &skill_id,
- Path::new(&relative_path),
- )
- .map_err(|e| anyhow::anyhow!("read_workflow_resource: {e}"))?;
+ let content =
+ read_workflow_resource_for(&ctx, &self.config, &skill_id, Path::new(&relative_path))
+ .map_err(|e| anyhow::anyhow!("read_workflow_resource: {e}"))?;
Ok(ToolResult::success(serde_json::to_string(&json!({
"workflow_id": skill_id,
"relative_path": relative_path,
diff --git a/tests/tinyflows_published_prompt_e2e.rs b/tests/tinyflows_published_prompt_e2e.rs
index 15b8527978..f129b12ada 100644
--- a/tests/tinyflows_published_prompt_e2e.rs
+++ b/tests/tinyflows_published_prompt_e2e.rs
@@ -107,19 +107,16 @@ async fn published_module_prompts_render_through_the_normal_host_path() {
"api_url = \"http://127.0.0.1:1\"\n\n[components]\nskills = true\nflows = true\ntinyflows = true\n\n[modules]\nenabled = false\n",
)
.expect("disabled components config");
- let disabled_config = openhuman_core::config::Config::load_from_config_path(
- &disabled_config_path,
- &workspace,
- )
- .await
- .expect("load disabled profile config");
+ let disabled_config =
+ openhuman_core::config::Config::load_from_config_path(&disabled_config_path, &workspace)
+ .await
+ .expect("load disabled profile config");
let disabled = openhuman_core::skills::load_workflow_metadata_for(&ctx, &disabled_config);
assert!(
!disabled.iter().any(|skill| skill.id() == "flow-authoring"),
"a profile with modules disabled cannot see the shared workspace builtin"
);
- let mut disabled_options =
- openhuman_core::agent::debug::DumpPromptOptions::new("orchestrator");
+ let mut disabled_options = openhuman_core::agent::debug::DumpPromptOptions::new("orchestrator");
disabled_options.workspace_dir_override = Some(workspace.clone());
disabled_options.config_path_override = Some(disabled_config_path);
let ordinary_prompt = openhuman_core::agent::debug::dump_agent_prompt(disabled_options)