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(skills): drop the host catalog cache and skills.sh probe
oxoxDev50e49034482d
diff --git a/crates/openhuman-core/src/skills/catalog/download.rs b/crates/openhuman-core/src/skills/catalog/download.rsdeleted file mode 100644index 2d5066d4b4..0000000000--- a/crates/openhuman-core/src/skills/catalog/download.rs+++ /dev/null@@ -1,79 +0,0 @@-//! Install-time location of a skills.sh entry's `SKILL.md`.-//!-//! The per-source URL knowledge (Hermes `docsPath`, GitHub blob/tree, ClawHub,-//! skills.sh candidate paths, tree-listing lookup) lives in-//! [`tinyskills`]'s catalog module. This host module keeps only what needs the-//! network: probing the conventional locations and, failing that, listing the-//! repo tree once.--use std::time::Duration;--use serde_json::Value;-use tinyskills::SkillsShRef;--/// Test override for every catalog entry's download base.-pub(super) const DOWNLOAD_BASE_URL_ENV: &str = "OPENHUMAN_SKILL_REGISTRY_DOWNLOAD_BASE_URL";-const PROBE_TIMEOUT_SECS: u64 = 15;--/// The download-base override from the environment, if set and non-empty.-pub(super) fn download_base_override() -> Option<String> {- std::env::var(DOWNLOAD_BASE_URL_ENV)- .ok()- .filter(|base| !base.trim().is_empty())-}--/// Locate a skills.sh skill's `SKILL.md` in its GitHub repo.-pub(super) async fn resolve_skills_sh(skill: &SkillsShRef<'_>) -> Result<String, String> {- let client = reqwest::Client::builder()- .timeout(Duration::from_secs(PROBE_TIMEOUT_SECS))- .user_agent("openhuman-core")- .build()- .map_err(|e| format!("failed to build http client: {e}"))?;-- // Probe every conventional location at once: probed one after another,- // each slow miss could spend the whole timeout before the next starts.- let candidates = skill.candidate_urls();- let responses =- futures::future::join_all(candidates.iter().map(|url| client.head(url).send())).await;- for (url, response) in candidates.into_iter().zip(responses) {- match response {- Ok(resp) if resp.status().is_success() => {- tracing::info!(url = %url, "[skill_registry] skills.sh SKILL.md found");- return Ok(url);- }- Ok(resp) => tracing::debug!(- url = %url,- status = resp.status().as_u16(),- "[skill_registry] skills.sh candidate missing"- ),- Err(error) => tracing::debug!(- url = %url,- error = %error,- "[skill_registry] skills.sh candidate probe failed"- ),- }- }-- // Not in a conventional directory: one recursive listing finds it anywhere.- let repo = skill.repo_label();- let name = skill.skill;- tracing::info!(repo = %repo, skill = %name, "[skill_registry] listing repo tree for skills.sh skill");- let resp = client- .get(skill.tree_api_url())- .send()- .await- .map_err(|e| format!("could not list {repo} to locate '{name}': {e}"))?;- if !resp.status().is_success() {- return Err(format!(- "could not list {repo} to locate '{name}' (GitHub returned {})",- resp.status().as_u16()- ));- }- let tree: Value = resp- .json()- .await- .map_err(|e| format!("could not read the {repo} file listing: {e}"))?;- skill- .locate_in_tree(&tree)- .map_err(|miss| skill.miss_message(&miss))-}diff --git a/crates/openhuman-core/src/skills/catalog/mod.rs b/crates/openhuman-core/src/skills/catalog/mod.rsindex 919131cd50..2789b84dc9 100644--- a/crates/openhuman-core/src/skills/catalog/mod.rs+++ b/crates/openhuman-core/src/skills/catalog/mod.rs@@ -1,6 +1,6 @@//! Skill registry: browse, search, and install skills from the aggregated//! Hermes catalog (HermesHub, ClawHub, skills.sh, LobeHub, browse.sh)-//! with local caching.+//! through the tinyskills `SkillRegistry`.//!//! ## Compile-time gate (`skills` feature)//!@@ -14,15 +14,11 @@#[cfg(feature = "skills")]pub mod agent;#[cfg(feature = "skills")]-mod download;-#[cfg(feature = "skills")]pub mod ops;#[cfg(feature = "skills")]mod registry;#[cfg(feature = "skills")]pub mod schemas;-#[cfg(feature = "skills")]-pub mod store;#[cfg(all(test, feature = "skills"))]pub(crate) mod test_fixtures;#[cfg(feature = "skills")]@@ -42,8 +38,8 @@ pub use schemas::{all_skill_registry_controller_schemas, all_skill_registry_registered_controllers,};-/// Serializes tests that mutate the process-global `OPENHUMAN_SKILL_REGISTRY_CACHE_DIR`-/// env var, so cargo's parallel runner can't interleave their cache dirs.+/// Serializes tests that mutate the registry's process-global environment or+/// its shared handle.#[cfg(all(test, feature = "skills"))]pub(crate) static TEST_ENV_LOCK: tokio::sync::Mutex<()> = tokio::sync::Mutex::const_new(());diff --git a/crates/openhuman-core/src/skills/catalog/store.rs b/crates/openhuman-core/src/skills/catalog/store.rsdeleted file mode 100644index a544532285..0000000000--- a/crates/openhuman-core/src/skills/catalog/store.rs+++ /dev/null@@ -1,102 +0,0 @@-//! Persistence for the skill registry: cached catalog entries.-//!-//! The cache lives at `~/.openhuman/skill-registry/cache.json` with a 1-hour-//! TTL. Past the TTL the cache is kept (not deleted) so callers can serve it-//! stale-while-revalidate; see [`load_cached_catalog_state`]. Set-//! `OPENHUMAN_SKILL_REGISTRY_CACHE_DIR` to relocate the cache (used by tests).--use std::path::PathBuf;--use serde::{Deserialize, Serialize};--use super::types::CatalogEntry;--const CACHE_DIR: &str = "skill-registry";-const CACHE_FILE: &str = "cache.json";-const CACHE_TTL_SECS: u64 = 3600;-const CACHE_DIR_ENV: &str = "OPENHUMAN_SKILL_REGISTRY_CACHE_DIR";--#[derive(Debug, Serialize, Deserialize)]-pub struct CatalogCache {- pub entries: Vec<CatalogEntry>,- pub fetched_at_epoch: u64,-}--/// A cached catalog tagged by freshness relative to `CACHE_TTL_SECS`.-pub enum CachedCatalog {- /// Within the TTL — safe to serve directly.- Fresh(Vec<CatalogEntry>),- /// Past the TTL — usable for stale-while-revalidate while a refresh runs.- Stale(Vec<CatalogEntry>),-}--fn registry_dir() -> Option<PathBuf> {- if let Some(raw) = std::env::var_os(CACHE_DIR_ENV) {- let trimmed = raw.to_string_lossy().trim().to_string();- if !trimmed.is_empty() {- return Some(PathBuf::from(trimmed));- }- }- dirs::home_dir().map(|h| h.join(".openhuman").join(CACHE_DIR))-}--fn now_epoch() -> u64 {- std::time::SystemTime::now()- .duration_since(std::time::UNIX_EPOCH)- .unwrap_or_default()- .as_secs()-}--/// Load the cached catalog regardless of age, tagged `Fresh`/`Stale` by TTL.-/// Returns `None` only when no readable cache exists.-pub fn load_cached_catalog_state() -> Option<CachedCatalog> {- let dir = registry_dir()?;- let path = dir.join(CACHE_FILE);- let data = std::fs::read_to_string(&path).ok()?;- let cache: CatalogCache = serde_json::from_str(&data).ok()?;-- let age_secs = now_epoch().saturating_sub(cache.fetched_at_epoch);- if age_secs > CACHE_TTL_SECS {- tracing::debug!(age_secs, "[skill_registry] cache stale (past TTL)");- Some(CachedCatalog::Stale(cache.entries))- } else {- tracing::debug!(- count = cache.entries.len(),- age_secs,- "[skill_registry] cache fresh"- );- Some(CachedCatalog::Fresh(cache.entries))- }-}--pub fn save_catalog_cache(entries: &[CatalogEntry]) {- let Some(dir) = registry_dir() else { return };- if let Err(e) = std::fs::create_dir_all(&dir) {- tracing::warn!(error = %e, "[skill_registry] failed to create cache dir");- return;- }- let cache = CatalogCache {- entries: entries.to_vec(),- fetched_at_epoch: now_epoch(),- };- let path = dir.join(CACHE_FILE);- match serde_json::to_string_pretty(&cache) {- Ok(json) => {- if let Err(e) = std::fs::write(&path, json) {- tracing::warn!(error = %e, "[skill_registry] failed to write cache");- }- }- Err(e) => tracing::warn!(error = %e, "[skill_registry] failed to serialize cache"),- }-}--pub fn clear_cache() {- let Some(dir) = registry_dir() else { return };- let path = dir.join(CACHE_FILE);- let _ = std::fs::remove_file(&path);- tracing::debug!("[skill_registry] cache cleared");-}--#[cfg(test)]-#[path = "store_tests.rs"]-mod tests;diff --git a/crates/openhuman-core/src/skills/catalog/store_tests.rs b/crates/openhuman-core/src/skills/catalog/store_tests.rsdeleted file mode 100644index b00dab7da8..0000000000--- a/crates/openhuman-core/src/skills/catalog/store_tests.rs+++ /dev/null@@ -1,11 +0,0 @@-use super::*;--/// Write a cache file directly with a controlled `fetched_at_epoch`.-fn write_cache(dir: &std::path::Path, fetched_at_epoch: u64) {- let cache = CatalogCache {- entries: Vec::new(),- fetched_at_epoch,- };- std::fs::create_dir_all(dir).unwrap();- std::fs::write(dir.join(CACHE_FILE), serde_json::to_string(&cache).unwrap()).unwrap();-}diff --git a/crates/openhuman-core/src/skills/catalog/stub.rs b/crates/openhuman-core/src/skills/catalog/stub.rsindex f3a80b4307..8bce6a7fa3 100644--- a/crates/openhuman-core/src/skills/catalog/stub.rs+++ b/crates/openhuman-core/src/skills/catalog/stub.rs@@ -4,7 +4,7 @@//! [`super`]). Mirrors only what always-on code reaches: the boot catalog//! refresh kicked off by `core::runtime::services`, the controller aggregators//! (`crates/openhuman-core/src/core/all.rs`), and the `tools` module glob-//! (`crates/openhuman-core/src/tools/mod.rs`). Everything else — the catalog store, wire+//! (`crates/openhuman-core/src/tools/mod.rs`). Everything else — the registry handle, wire//! types, and the `skill_setup` agent — is only referenced from code gated by//! the same feature, so it vanishes alongside.//!