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/bundled/flow_authoring.rs

Steven Enamakel69914f64a91b
diff --git a/crates/openhuman-core/src/skills/bundled/flow_authoring.rs b/crates/openhuman-core/src/skills/bundled/flow_authoring.rs
index b0c23c329e..afde878385 100644
--- a/crates/openhuman-core/src/skills/bundled/flow_authoring.rs
+++ b/crates/openhuman-core/src/skills/bundled/flow_authoring.rs
@@ -198,48 +198,16 @@ async fn prewarm_locked(
}
};
- if !valid_resource_manifest(&resources) {
- tracing::warn!("[skills][bundled] TinyFlows returned an invalid resource manifest; hiding builtin");
- clear_snapshot(&key);
- return;
- }
if !module_is_serving() {
tracing::warn!("[skills][bundled] TinyFlows module is not serving after ListResources; hiding builtin");
clear_snapshot(&key);
return;
}
- let previous = SNAPSHOTS
- .read()
- .ok()
- .and_then(|snapshots| snapshots.get(&key).cloned());
- if let Some(previous) = &previous {
- if !materialization_matches(workspace, &gate, previous) {
- tracing::warn!("[skills][bundled] flow-authoring disk tree changed; hiding builtin");
- clear_snapshot(&key);
- return;
- }
- if previous.files == resources {
- return;
- }
- }
-
- let generation = NEXT_GENERATION.fetch_add(1, Ordering::SeqCst);
- if let Err(error) = materialize(workspace, gate, &resources) {
+ if let Err(error) = publish_snapshot(workspace, gate, resources) {
tracing::warn!(%error, "[skills][bundled] flow-authoring materialization failed; hiding builtin");
clear_snapshot(&key);
- return;
- }
- if let Ok(mut snapshots) = SNAPSHOTS.write() {
- snapshots.insert(
- key,
- Snapshot {
- generation,
- files: resources,
- },
- );
}
- crate::skills::ops_discover::invalidate_workflow_metadata_cache();
}
/// Return the current resource generation only while the owning module and
@@ -367,6 +335,44 @@ fn materialize(
.map_err(|error| error.to_string())
}
+fn publish_snapshot(
+ workspace: &Path,
+ gate: &DiscoveryGate,
+ resources: Vec<ResourceFile>,
+) -> Result<u64, String> {
+ if !valid_resource_manifest(&resources) {
+ return Err("TinyFlows returned an invalid resource manifest".to_string());
+ }
+ let key = snapshot_key(workspace, gate);
+ let previous = SNAPSHOTS
+ .read()
+ .ok()
+ .and_then(|snapshots| snapshots.get(&key).cloned());
+ if let Some(previous) = &previous {
+ if !materialization_matches(workspace, gate, previous) {
+ clear_snapshot(&key);
+ return Err("flow-authoring disk tree changed".to_string());
+ }
+ if previous.files == resources {
+ return Ok(previous.generation);
+ }
+ }
+
+ let generation = NEXT_GENERATION.fetch_add(1, Ordering::SeqCst);
+ materialize(workspace, gate, &resources)?;
+ if let Ok(mut snapshots) = SNAPSHOTS.write() {
+ snapshots.insert(
+ key,
+ Snapshot {
+ generation,
+ files: resources,
+ },
+ );
+ }
+ crate::skills::ops_discover::invalidate_workflow_metadata_cache();
+ Ok(generation)
+}
+
fn materialization_matches(workspace: &Path, gate: &DiscoveryGate, snapshot: &Snapshot) -> bool {
let directory = root(workspace, gate).join(FLOW_SKILL_ID);
let Some(skill) = tinyskills::load_skill_dir(&directory, SkillScope::Builtin) else {