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/flows/mod.rs,crates/openhuman-core/src/flows/skills/m

Steven Enamakel99d8818995d3
diff --git a/crates/openhuman-core/src/flows/mod.rs b/crates/openhuman-core/src/flows/mod.rs
index d0168f54af..99cba07f06 100644
--- a/crates/openhuman-core/src/flows/mod.rs
+++ b/crates/openhuman-core/src/flows/mod.rs
@@ -39,7 +39,6 @@ mod schemas;
/// Skills this domain ships inside the binary. Needs BOTH gates: the pages
/// teach flows authoring, and `BundledSkill` is part of the skills subsystem.
#[cfg(feature = "skills")]
-pub mod skills;
mod store;
/// The tinyflows engine seam (formerly `crate::tinyflows`).
pub mod tinyflows;
diff --git a/crates/openhuman-core/src/flows/skills/mod.rs b/crates/openhuman-core/src/flows/skills/mod.rs
deleted file mode 100644
index 01b4bd3238..0000000000
--- a/crates/openhuman-core/src/flows/skills/mod.rs
+++ /dev/null
@@ -1,60 +0,0 @@
-//! Skills the flows domain ships inside the binary.
-//!
-//! `flow-authoring` is the Workflow Builder's reference manual. It used to be
-//! ~25 KB of the agent's system prompt — paid on every turn of every authoring
-//! session, including the turns that only wire two nodes together. As a bundled
-//! skill the same text is one `read_workflow_resource` call away and costs
-//! nothing until a page is actually needed.
-//!
-//! The split follows one rule, and it is the reason the whole prompt did not
-//! move: **a rule that binds goes in the prompt; a rule you look up goes
-//! here.** "Propose, never persist" cannot live in a manual, because a manual
-//! only binds a model that chose to open it. An expression's jq syntax is the
-//! opposite — nothing goes wrong by not knowing it until you need it, and a
-//! lot goes wrong by half-remembering it.
-//!
-//! The line is not obvious from the outside, and getting it wrong is caught by
-//! tests rather than by review: "prefer the minimal viable graph" was moved
-//! here on the first pass and moved back, because
-//! `standing_prompt_keeps_minimal_graph_warning_alongside_specialist_guidance`
-//! pins it in the prompt — correctly. It constrains an instinct the model has
-//! before it would think to consult anything.
-//!
-//! The manual's bytes live in `tinyflows-copilot`; this host only converts the
-//! portable file list into its native bundled-skill registration.
-
-use {tinyskills::BundledFile, tinyskills::BundledSkill};
-
-/// The `flow-authoring` bundle, embedded from the sibling directory.
-///
-/// Listed file by file rather than swept from the directory: a build-time
-/// directory walk would silently ship whatever happened to be sitting there,
-/// and `include_str!` needs literal paths anyway. The `bundled_skill_matches_
-/// the_directory_on_disk` test below fails when a page is added to the
-/// directory and not to this list, which is the mistake this shape actually
-/// invites.
-pub const FLOW_AUTHORING: BundledSkill = BundledSkill {
- dir_name: "flow-authoring",
- files: &[
- BundledFile {
- path: "WORKFLOW.md",
- contents: tinyflows_copilot::resources::FLOW_AUTHORING_WORKFLOW,
- },
- BundledFile {
- path: "references/expressions.md",
- contents: tinyflows_copilot::resources::FLOW_AUTHORING_EXPRESSIONS,
- },
- BundledFile {
- path: "references/node-config.md",
- contents: tinyflows_copilot::resources::FLOW_AUTHORING_NODE_CONFIG,
- },
- BundledFile {
- path: "references/dry-run.md",
- contents: tinyflows_copilot::resources::FLOW_AUTHORING_DRY_RUN,
- },
- ],
-};
-
-#[cfg(test)]
-#[path = "skills_tests.rs"]
-mod tests;
diff --git a/crates/openhuman-core/src/flows/skills/skills_tests.rs b/crates/openhuman-core/src/flows/skills/skills_tests.rs
deleted file mode 100644
index 833bf578f5..0000000000
--- a/crates/openhuman-core/src/flows/skills/skills_tests.rs
+++ /dev/null
@@ -1,76 +0,0 @@
-use super::*;
-
-#[test]
-fn bundled_skill_matches_the_portable_resource_list() {
- let mut listed: Vec<&str> = FLOW_AUTHORING.files.iter().map(|f| f.path).collect();
- listed.sort();
- let mut portable: Vec<&str> = tinyflows_copilot::resources::FLOW_AUTHORING_FILES
- .iter()
- .map(|f| f.path)
- .collect();
- portable.sort();
-
- assert_eq!(
- listed, portable,
- "OpenHuman's bundled-skill registration and tinyflows' portable resource list diverged"
- );
-}
-
-#[test]
-fn every_page_the_manifest_advertises_exists() {
- // The WORKFLOW.md table is what the model reads to choose a page. A
- // row naming a file that does not ship is a dead end the model cannot
- // diagnose — it just gets an error and gives up on the manual.
- let manifest = FLOW_AUTHORING
- .files
- .iter()
- .find(|f| f.path == "WORKFLOW.md")
- .expect("manifest")
- .contents;
- for file in FLOW_AUTHORING.files {
- if file.path == "WORKFLOW.md" {
- continue;
- }
- assert!(
- manifest.contains(file.path),
- "`{}` ships but the manifest's table never names it",
- file.path
- );
- }
- for line in manifest.lines() {
- for token in line.split('`') {
- if token.starts_with("references/") {
- assert!(
- FLOW_AUTHORING.files.iter().any(|f| f.path == token),
- "the manifest points at `{token}`, which does not ship"
- );
- }
- }
- }
-}
-
-#[test]
-fn the_frontmatter_description_does_not_advertise_a_dropped_page() {
- // The description is what the model reads in the `## Installed Skills`
- // catalogue to decide whether to open the skill at all, and it is prose
- // rather than a path — so the `references/` token check below cannot
- // see it. It went stale the first time a page moved back into the
- // standing prompt: the description still promised graph sizing after
- // `graph-shape.md` was deleted.
- let manifest = FLOW_AUTHORING
- .files
- .iter()
- .find(|f| f.path == "WORKFLOW.md")
- .expect("manifest")
- .contents;
- let description = manifest
- .lines()
- .find(|l| l.starts_with("description:"))
- .expect("frontmatter description");
- for dropped in ["how large a graph", "graph should be", "graph-shape"] {
- assert!(
- !description.contains(dropped),
- "the description still advertises `{dropped}`, which no longer ships"
- );
- }
-}
diff --git a/crates/openhuman-core/src/skills/bundled/flow_authoring.rs b/crates/openhuman-core/src/skills/bundled/flow_authoring.rs
index 2253eb2e97..b0c23c329e 100644
--- a/crates/openhuman-core/src/skills/bundled/flow_authoring.rs
+++ b/crates/openhuman-core/src/skills/bundled/flow_authoring.rs
@@ -425,8 +425,10 @@ fn scope_directory(gate: &DiscoveryGate) -> String {
}
fn clear_snapshot(key: &SnapshotKey) {
- if let Ok(mut snapshots) = SNAPSHOTS.write() {
- snapshots.remove(key);
+ let removed = SNAPSHOTS
+ .write()
+ .is_ok_and(|mut snapshots| snapshots.remove(key).is_some());
+ if removed {
+ crate::skills::ops_discover::invalidate_workflow_metadata_cache();
}
- crate::skills::ops_discover::invalidate_workflow_metadata_cache();
}
diff --git a/crates/openhuman-core/src/skills/ops_discovery_tests.rs b/crates/openhuman-core/src/skills/ops_discovery_tests.rs
index 8f791ec56d..ac03964760 100644
--- a/crates/openhuman-core/src/skills/ops_discovery_tests.rs
+++ b/crates/openhuman-core/src/skills/ops_discovery_tests.rs
@@ -328,42 +328,50 @@ async fn flow_authoring_is_hidden_when_tinyflows_component_is_disabled() {
use crate::tools::toolpacks::ToolGroups;
let workspace = tempfile::tempdir().unwrap();
- // Install the compiled bundles as a normal boot would. The pre-fix
- // discovery path gates only `skills`, so it incorrectly exposes the
- // flow-authoring bundle when the module that owns its resources is off.
- crate::skills::bundled::install(workspace.path());
-
let profile = |profile_id: &str, enabled: bool| {
let mut components = ComponentSet::all();
let mut domains = DomainSet::full();
+ let mut config = crate::config::Config::default();
+ config.workspace_dir = workspace.path().to_path_buf();
if !enabled {
components.flows = false;
components.tinyflows = false;
+ config.components.flows = false;
+ config.components.tinyflows = false;
domains.flows = false;
}
- let mut config = crate::config::Config::default();
- config.workspace_dir = workspace.path().to_path_buf();
- CoreContext::for_test_with_components(components).derive_with(
- ContextOverlay::new(config, domains, ToolGroups::none()).profile(profile_id),
- )
+ let context = CoreContext::for_test_with_components(components).derive_with(
+ ContextOverlay::new(config.clone(), domains, ToolGroups::none()).profile(profile_id),
+ );
+ (context, config, domains)
};
- let visible = CoreContext::scope(profile("enabled", true), async {
- load_workflow_metadata(workspace.path())
+ let (enabled_ctx, enabled_config, enabled_domains) = profile("enabled", true);
+ let visible = CoreContext::scope(enabled_ctx, async {
+ let dispatch = crate::core::runtime::DispatchCtx::ambient();
+ crate::skills::bundled::flow_authoring::prewarm(
+ &dispatch,
+ &enabled_config,
+ Some(enabled_domains),
+ )
+ .await;
+ crate::skills::load_workflow_metadata_for(&dispatch, &enabled_config)
})
.await;
- let hidden = CoreContext::scope(profile("disabled", false), async {
- load_workflow_metadata(workspace.path())
+ let (disabled_ctx, disabled_config, _) = profile("disabled", false);
+ let hidden = CoreContext::scope(disabled_ctx, async {
+ let dispatch = crate::core::runtime::DispatchCtx::ambient();
+ crate::skills::load_workflow_metadata_for(&dispatch, &disabled_config)
})
.await;
assert!(
visible.iter().any(|skill| skill.id() == "flow-authoring"),
- "the enabled profile sees its flow-authoring bundle"
+ "the enabled profile sees its module-backed flow-authoring skill"
);
assert!(
!hidden.iter().any(|skill| skill.id() == "flow-authoring"),
- "a profile with flows, TinyFlows, and the Flows domain disabled must not inherit the shared flow-authoring bundle"
+ "a profile with flows, TinyFlows, and the Flows domain disabled must not inherit another profile's flow-authoring builtin"
);
}
diff --git a/crates/openhuman-core/src/skills/search_tests.rs b/crates/openhuman-core/src/skills/search_tests.rs
index d378d5f791..feefa7c0d1 100644
--- a/crates/openhuman-core/src/skills/search_tests.rs
+++ b/crates/openhuman-core/src/skills/search_tests.rs
@@ -98,23 +98,19 @@ fn a_hit_reports_how_many_were_searched() {
assert!(value["hint"].is_null(), "a hit carries no miss hint");
}
+#[cfg(feature = "flows")]
#[tokio::test]
-async fn the_bundled_skill_is_findable_once_installed() {
- // End to end over the real pipeline: materialise the compiled-in bundles
- // into a temp workspace, then search. This is the test that would fail if
- // discovery stopped scanning the builtin root, if the scope were rejected,
- // or if the bundle's frontmatter stopped parsing.
+async fn module_owned_flow_skill_is_findable_after_scoped_prewarm() {
+ // Use TinyFlows' linked test module to exercise the same bus-owned
+ // ListResources adapter as the published native-module integration test.
let tmp = tempfile::tempdir().expect("tempdir");
- let report = crate::skills::bundled::install(tmp.path());
- assert!(report.failed.is_empty(), "install failed: {report:?}");
- if crate::skills::bundled::BUNDLED.is_empty() {
- return; // nothing ships in this feature configuration
- }
-
let config = Config {
workspace_dir: tmp.path().to_path_buf(),
..Default::default()
};
+ let ctx = crate::core::runtime::DispatchCtx::host_default();
+ crate::skills::bundled::flow_authoring::prewarm(&ctx, &config, None).await;
+
let tool = SkillSearchTool::new(Arc::new(config));
let result = tool
.execute(json!({ "query": "flow authoring" }))