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/skills/bus.rs,crates/openhuman-core/src/skills/ops_di

Steven Enamakelbea640e3a233
diff --git a/crates/openhuman-core/src/skills/bus.rs b/crates/openhuman-core/src/skills/bus.rs
index 5c34489ab7..96695772f1 100644
--- a/crates/openhuman-core/src/skills/bus.rs
+++ b/crates/openhuman-core/src/skills/bus.rs
@@ -215,7 +215,9 @@ pub(crate) fn ensure_triggered_workflow_subscriber_for(
domains: Option<crate::core::runtime::DomainSet>,
) {
TRIGGERED_WORKFLOW_HANDLE.get_or_init(|| {
- let workflows = crate::skills::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 cbf7b19001..2fb6d6e2ea 100644
--- a/crates/openhuman-core/src/skills/ops_discover.rs
+++ b/crates/openhuman-core/src/skills/ops_discover.rs
@@ -25,6 +25,7 @@ pub use api::{
pub use resource::{read_workflow_resource, read_workflow_resource_for};
pub(crate) use api::discover_workflows_inner;
+pub(crate) use api::load_workflow_metadata_for_domains;
pub(crate) use api::invalidate_workflow_metadata_cache;
#[cfg(test)]
diff --git a/crates/openhuman-core/src/skills/schemas/handlers.rs b/crates/openhuman-core/src/skills/schemas/handlers.rs
index 14231a016c..f92f2af897 100644
--- a/crates/openhuman-core/src/skills/schemas/handlers.rs
+++ b/crates/openhuman-core/src/skills/schemas/handlers.rs
@@ -14,7 +14,7 @@ use crate::core::all::ControllerFuture;
use crate::core::Outcome;
use crate::skills::ops::{
create_workflow, discover_automations, discover_workflows, install_workflow_from_url,
- is_workspace_trusted, read_workflow_resource, uninstall_workflow, CreateWorkflowParams,
+ is_workspace_trusted, read_workflow_resource_for, uninstall_workflow, CreateWorkflowParams,
UninstallWorkflowParams,
};
use crate::skills::ops_install::ScanAcknowledgement;
@@ -209,7 +209,7 @@ pub(super) fn handle_skills_cancel(
}
pub(super) fn handle_skills_read_resource(
- _ctx: DispatchCtx,
+ ctx: DispatchCtx,
params: Map<String, Value>,
) -> ControllerFuture {
Box::pin(async move {
@@ -219,9 +219,9 @@ pub(super) fn handle_skills_read_resource(
relative_path = %payload.relative_path,
"[skills][rpc] read_resource"
);
- let workspace = resolve_workspace_dir().await;
+ let config = ctx.load_config().await?;
let relative = Path::new(&payload.relative_path);
- match read_workflow_resource(workspace.as_path(), &payload.workflow_id, relative) {
+ match read_workflow_resource_for(&ctx, &config, &payload.workflow_id, relative) {
Ok(content) => {
let bytes = content.len();
to_json(Outcome::new(
diff --git a/tests/tinyflows_published_prompt_e2e.rs b/tests/tinyflows_published_prompt_e2e.rs
index 6c47fdc447..8f5078b563 100644
--- a/tests/tinyflows_published_prompt_e2e.rs
+++ b/tests/tinyflows_published_prompt_e2e.rs
@@ -62,34 +62,36 @@ async fn published_module_prompts_render_through_the_normal_host_path() {
}
// This is the actual published module path: the host must materialize the
- // bus-owned skill under its own flow-resource root, then the normal
- // TinySkills discovery and resource reader must expose that Builtin.
- let flow_root = workspace
- .join(".openhuman")
- .join("builtin-flow-skills")
- .join("flow-authoring");
- assert!(
- flow_root.join("SKILL.md").is_file(),
- "published Copilot ListResources was not materialized under the flow root"
- );
- assert!(
- !workspace
- .join(".openhuman")
- .join("builtin-skills")
- .join("flow-authoring")
- .exists(),
- "dynamic TinyFlows resources must not share the static builtin root"
- );
-
- let discovered = openhuman_core::skills::load_workflow_metadata(&workspace);
+ // bus-owned skill, then the normal TinySkills discovery and resource reader
+ // must expose that Builtin under the separate dynamic root.
+ let config = openhuman_core::config::Config::load_from_config_path(&config_path, &workspace)
+ .await
+ .expect("load the same scoped Config used by the prompt dump");
+ let ctx = openhuman_core::core::runtime::DispatchCtx::host_default();
+ let discovered = openhuman_core::skills::load_workflow_metadata_for(&ctx, &config);
let flow = discovered
.iter()
.find(|skill| skill.id() == "flow-authoring")
.expect("the published module's flow-authoring skill is discoverable");
assert_eq!(flow.scope, tinyskills::SkillScope::Builtin);
+ let flow_dir = flow
+ .location
+ .as_deref()
+ .and_then(std::path::Path::parent)
+ .expect("discovered flow-authoring location");
+ assert!(
+ flow_dir.starts_with(workspace.join(".openhuman").join("builtin-flow-skills")),
+ "the dynamic builtin uses the separate product root: {}",
+ flow_dir.display()
+ );
+ assert!(
+ !flow_dir.starts_with(workspace.join(".openhuman").join("builtin-skills")),
+ "TinyFlows resources must not share the static desktop-control root"
+ );
for resource in &flow.resources {
- let body = openhuman_core::skills::read_workflow_resource(
- &workspace,
+ let body = openhuman_core::skills::read_workflow_resource_for(
+ &ctx,
+ &config,
"flow-authoring",
resource,
)
@@ -99,11 +101,52 @@ async fn published_module_prompts_render_through_the_normal_host_path() {
assert!(!body.is_empty(), "published resource {resource:?} is empty");
}
+ let disabled_config_path = temp.path().join("disabled-config.toml");
+ std::fs::write(
+ &disabled_config_path,
+ "api_url = \"http://127.0.0.1:1\"\n\n[components]\nskills = true\nflows = false\ntinyflows = false\n\n[modules]\nenabled = true\n\n[[modules.overrides]]\nid = \"tinyflows\"\npath = \"unused-while-disabled\"\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 = openhuman_core::skills::load_workflow_metadata_for(&ctx, &disabled_config);
+ assert!(
+ !disabled.iter().any(|skill| skill.id() == "flow-authoring"),
+ "a profile with TinyFlows disabled cannot see the shared workspace builtin"
+ );
+ let mut disabled_options =
+ openhuman_core::agent::debug::DumpPromptOptions::new("workflow_builder");
+ 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)
+ .await
+ .expect("ordinary prompt construction continues when TinyFlows is disabled");
+ assert!(ordinary_prompt.text.contains("## Workspace"));
+
+ // Re-enable the same profile after the disabled view and ensure the
+ // async host preflight restores the module-backed catalogue.
+ let mut enabled_options =
+ openhuman_core::agent::debug::DumpPromptOptions::new("workflow_builder");
+ enabled_options.workspace_dir_override = Some(workspace.clone());
+ enabled_options.config_path_override = Some(config_path.clone());
+ openhuman_core::agent::debug::dump_agent_prompt(enabled_options)
+ .await
+ .expect("enabled profile prompt after disabled profile");
+ let reenabled = openhuman_core::skills::load_workflow_metadata_for(&ctx, &config);
+ assert!(
+ reenabled.iter().any(|skill| skill.id() == "flow-authoring"),
+ "re-enabling TinyFlows restores the module-backed builtin"
+ );
+
// A live disk edit must invalidate both the cached metadata and the
// resource-read path; cached Builtin metadata cannot bless changed bytes.
let resource = flow.resources.first().expect("published reference files");
- std::fs::write(flow_root.join(resource), "tampered resource").expect("tamper resource");
- let after_tamper = openhuman_core::skills::load_workflow_metadata(&workspace);
+ std::fs::write(flow_dir.join(resource), "tampered resource").expect("tamper resource");
+ let after_tamper = openhuman_core::skills::load_workflow_metadata_for(&ctx, &config);
assert!(
!after_tamper
.iter()
@@ -111,8 +154,9 @@ async fn published_module_prompts_render_through_the_normal_host_path() {
"a cache hit must not advertise tampered module resources"
);
assert!(
- openhuman_core::skills::read_workflow_resource(
- &workspace,
+ openhuman_core::skills::read_workflow_resource_for(
+ &ctx,
+ &config,
"flow-authoring",
resource,
)