Skip to content

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

fix(skills): remove ops_create module and update ops references

Steven Enamakel032bcc1c7d33
diff --git a/crates/openhuman-core/src/skills/ops.rs b/crates/openhuman-core/src/skills/ops.rs
index c18089fdc4..3a2d1c8a7f 100644
--- a/crates/openhuman-core/src/skills/ops.rs
+++ b/crates/openhuman-core/src/skills/ops.rs
@@ -47,7 +47,7 @@ pub use super::ops_types::{
};
#[cfg(test)]
-pub(crate) use super::ops_create::{create_workflow_inner, slugify_workflow_name};
+pub(crate) use super::ops_create::create_workflow_inner;
#[cfg(test)]
pub(crate) use super::ops_discover::discover_workflows_inner;
#[cfg(test)]
diff --git a/crates/openhuman-core/src/skills/ops_create.rs b/crates/openhuman-core/src/skills/ops_create.rs
index e4fbb28235..d93834a525 100644
--- a/crates/openhuman-core/src/skills/ops_create.rs
+++ b/crates/openhuman-core/src/skills/ops_create.rs
@@ -109,7 +109,7 @@ pub struct CreateWorkflowParams {
/// * Slug is derived from `params.name` (lowercased, `[a-z0-9-]` only,
/// non-alphanumeric runs collapsed to a single `-`).
/// * Empty / non-alphanumeric-only names are rejected.
-/// * Slug is length-bounded by [`MAX_NAME_LEN`].
+/// * Slug is length-bounded by `MAX_NAME_LEN`.
/// * The resolved `<scope-root>/<slug>` path is canonicalized and verified
/// to stay inside the canonical scope root (same `starts_with` guard used
/// by [`read_workflow_resource`]) to defeat `..` or absolute-path inputs.
diff --git a/crates/openhuman-core/src/skills/ops_create_and_url_tests.rs b/crates/openhuman-core/src/skills/ops_create_and_url_tests.rs
index a496fd74ac..5ec643d159 100644
--- a/crates/openhuman-core/src/skills/ops_create_and_url_tests.rs
+++ b/crates/openhuman-core/src/skills/ops_create_and_url_tests.rs
@@ -296,280 +296,6 @@ fn create_skill_rejects_empty_description() {
);
}
-#[test]
-fn slugify_collapses_separators_and_trims() {
- assert_eq!(
- slugify_workflow_name("Hello World").unwrap(),
- "hello-world"
- );
- assert_eq!(slugify_workflow_name("--foo__bar--").unwrap(), "foo-bar");
- assert_eq!(
- slugify_workflow_name("ALL CAPS skill!").unwrap(),
- "all-caps-skill"
- );
- assert!(slugify_workflow_name(" ").is_err());
- assert!(slugify_workflow_name("!!!").is_err());
-}
-
-#[test]
-fn validate_install_url_accepts_public_https() {
- for url in &[
- "https://registry.npmjs.org/@acme/skill",
- "https://example.com/skill.tar.gz",
- "https://github.com/acme/skill/releases/download/v1/skill.tgz",
- "https://8.8.8.8/x",
- ] {
- validate_install_url(url).unwrap_or_else(|e| panic!("{url} rejected: {e}"));
- }
-}
-
-#[test]
-fn validate_install_url_rejects_non_https_scheme() {
- for url in &[
- "http://example.com/x",
- "ftp://example.com/x",
- "file:///etc/passwd",
- "git+ssh://[email protected]/repo",
- "javascript:alert(1)",
- ] {
- assert!(
- validate_install_url(url).is_err(),
- "{url} should be rejected"
- );
- }
-}
-
-#[test]
-fn validate_install_url_rejects_empty_and_oversized() {
- assert!(validate_install_url("").is_err());
- assert!(validate_install_url(" ").is_err());
- let huge = format!("https://example.com/{}", "a".repeat(MAX_INSTALL_URL_LEN));
- assert!(validate_install_url(&huge).is_err());
-}
-
-#[test]
-fn validate_install_url_rejects_private_and_loopback() {
- for url in &[
- "https://localhost/x",
- "https://foo.localhost/x",
- "https://foo.local/x",
- "https://127.0.0.1/x",
- "https://127.42.1.1/x",
- "https://10.0.0.5/x",
- "https://172.16.0.1/x",
- "https://172.31.255.255/x",
- "https://192.168.1.1/x",
- "https://169.254.169.254/x", // cloud metadata IP
- "https://100.64.0.1/x", // CGN
- "https://0.0.0.0/x",
- "https://255.255.255.255/x",
- "https://224.0.0.1/x", // multicast
- "https://[::1]/x",
- "https://[::]/x",
- "https://[fe80::1]/x",
- "https://[fc00::1]/x",
- "https://[fd12:3456:789a::1]/x",
- "https://[ff02::1]/x",
- ] {
- assert!(
- validate_install_url(url).is_err(),
- "{url} should be rejected"
- );
- }
-}
-
-#[test]
-fn validate_install_url_rejects_malformed() {
- // missing scheme -> parse error
- assert!(validate_install_url("not-a-url").is_err());
- // special scheme with empty host -> parse error
- assert!(validate_install_url("https://").is_err());
- // non-https scheme rejected even when otherwise well-formed
- assert!(validate_install_url("ftp://example.com/x").is_err());
- // unparseable bracketed host
- assert!(validate_install_url("https://[not-an-ip]/x").is_err());
-}
-
-#[test]
-fn normalize_install_url_rewrites_github_blob_to_raw() {
- let out =
- normalize_install_url("https://github.com/owner/repo/blob/main/path/to/SKILL.md").unwrap();
- assert_eq!(
- out,
- "https://raw.githubusercontent.com/owner/repo/main/path/to/SKILL.md"
- );
-}
-
-#[test]
-fn normalize_install_url_rewrites_github_blob_nested_path() {
- let out = normalize_install_url("https://github.com/owner/repo/blob/feat/x/dir/sub/SKILL.md")
- .unwrap();
- assert_eq!(
- out,
- "https://raw.githubusercontent.com/owner/repo/feat/x/dir/sub/SKILL.md"
- );
-}
-
-#[test]
-fn normalize_install_url_passes_raw_github_through() {
- let raw = "https://raw.githubusercontent.com/owner/repo/main/SKILL.md";
- assert_eq!(normalize_install_url(raw).unwrap(), raw);
-}
-
-#[test]
-fn normalize_install_url_rejects_tree_urls() {
- let err = normalize_install_url("https://github.com/owner/repo/tree/main/path").unwrap_err();
- assert!(err.contains("unsupported url form"), "{err}");
- assert!(err.contains("tree/dir"), "{err}");
-}
-
-#[test]
-fn normalize_install_url_rejects_whole_repo() {
- let err = normalize_install_url("https://github.com/owner/repo").unwrap_err();
- assert!(err.contains("unsupported url form"), "{err}");
- assert!(err.contains("whole-repo"), "{err}");
-}
-
-#[test]
-fn normalize_install_url_accepts_a_file_api_that_names_the_md_in_its_query() {
- let url = "https://clawhub.ai/api/v1/skills/apple-design/file?path=SKILL.md";
- assert_eq!(normalize_install_url(url).unwrap(), url);
- let err =
- normalize_install_url("https://clawhub.ai/api/v1/skills/x/file?path=run.sh").unwrap_err();
- assert!(err.contains(".md"), "{err}");
- // Only ClawHub's file endpoint may name the file in its query.
- for other in [
- "https://example.com/api/v1/skills/x/file?path=SKILL.md",
- "https://clawhub.ai/download?path=SKILL.md",
- ] {
- let err = normalize_install_url(other).unwrap_err();
- assert!(err.contains(".md"), "{other}: {err}");
- }
-}
-
-#[test]
-fn normalize_install_url_rejects_non_md_suffix() {
- let err = normalize_install_url("https://example.com/skill.txt").unwrap_err();
- assert!(err.contains("unsupported url form"), "{err}");
- assert!(err.contains(".md"), "{err}");
-}
-
-#[test]
-fn normalize_install_url_accepts_uppercase_md_suffix() {
- let raw = "https://example.com/SKILL.MD";
- assert_eq!(normalize_install_url(raw).unwrap(), raw);
-}
-
-#[test]
-fn derive_install_slug_prefers_metadata_id() {
- let mut fm = WorkflowFrontmatter {
- name: "My Workflow".to_string(),
- description: "x".to_string(),
- ..Default::default()
- };
- fm.metadata.insert(
- "id".to_string(),
- serde_yaml::Value::String("canonical-id".to_string()),
- );
- assert_eq!(derive_install_slug(&fm).unwrap(), "canonical-id");
-}
-
-#[test]
-fn derive_install_slug_sanitizes_name_fallback() {
- let fm = WorkflowFrontmatter {
- name: "My Cool Workflow!!".to_string(),
- description: "x".to_string(),
- ..Default::default()
- };
- assert_eq!(derive_install_slug(&fm).unwrap(), "my-cool-workflow");
-}
-
-#[test]
-fn derive_install_slug_collapses_runs_and_trims_edges() {
- let fm = WorkflowFrontmatter {
- name: "---foo__bar baz---".to_string(),
- description: "x".to_string(),
- ..Default::default()
- };
- assert_eq!(derive_install_slug(&fm).unwrap(), "foo-bar-baz");
-}
-
-#[test]
-fn derive_install_slug_rejects_empty_after_sanitize() {
- let fm = WorkflowFrontmatter {
- name: "!!!".to_string(),
- description: "x".to_string(),
- ..Default::default()
- };
- let err = derive_install_slug(&fm).unwrap_err();
- assert!(err.contains("invalid SKILL.md"), "{err}");
-}
-
-#[test]
-fn derive_install_slug_rejects_oversized() {
- let fm = WorkflowFrontmatter {
- name: "a".repeat(MAX_NAME_LEN + 1),
- description: "x".to_string(),
- ..Default::default()
- };
- let err = derive_install_slug(&fm).unwrap_err();
- assert!(err.contains("invalid SKILL.md"), "{err}");
- assert!(err.contains("exceeds"), "{err}");
-}
-
-#[test]
-fn derive_install_slug_sanitizes_path_escape_attempts() {
- // `..` and `/` are non-alphanumeric so they collapse to `-` during
- // sanitization — verify no path-escape characters survive.
- let fm = WorkflowFrontmatter {
- name: "../etc/passwd".to_string(),
- description: "x".to_string(),
- ..Default::default()
- };
- let slug = derive_install_slug(&fm).unwrap();
- assert!(!slug.contains(".."), "slug leaked ..: {slug}");
- assert!(!slug.contains('/'), "slug leaked /: {slug}");
- assert!(!slug.contains('\\'), "slug leaked \\: {slug}");
-}
-
-#[test]
-fn parse_skill_md_str_happy_path() {
- let content = "---\nname: demo\ndescription: a demo skill\n---\n\n# Body\n";
- let (fm, body, warnings) = parse_workflow_md_str(content).unwrap();
- assert_eq!(fm.name, "demo");
- assert_eq!(fm.description, "a demo skill");
- assert!(body.contains("# Body"));
- assert!(warnings.is_empty());
-}
-
-#[test]
-fn parse_skill_md_str_unterminated_frontmatter_returns_none() {
- let content = "---\nname: demo\ndescription: missing close\n# Body\n";
- assert!(parse_workflow_md_str(content).is_none());
-}
-
-#[test]
-fn parse_skill_md_str_no_frontmatter_treats_whole_as_body() {
- let content = "# Just a body\nno frontmatter here\n";
- let (fm, body, warnings) = parse_workflow_md_str(content).unwrap();
- assert!(fm.name.is_empty());
- assert_eq!(body, content);
- assert!(warnings.is_empty());
-}
-
-#[test]
-fn parse_skill_md_str_bad_yaml_returns_empty_frontmatter_with_warning() {
- let content = "---\nname: [unterminated\ndescription: also bad\n---\n";
- let (fm, _body, warnings) = parse_workflow_md_str(content).unwrap();
- assert!(fm.name.is_empty());
- assert!(
- warnings
- .iter()
- .any(|w| w.contains("frontmatter parse error")),
- "expected warning, got {warnings:?}"
- );
-}
-
#[tokio::test]
async fn install_workflow_from_url_is_idempotent_when_skill_already_exists() {
use wiremock::matchers::{method, path};
diff --git a/vendor/tinyskills b/vendor/tinyskills
index b6958d9282..32d38b8929 160000
--- a/vendor/tinyskills
+++ b/vendor/tinyskills
@@ -1 +1 @@
-Subproject commit b6958d928204a6a955b3c25d6b5fdf32fb0ae3d5
+Subproject commit 32d38b892988dbe240b8e9f227cae40c50eb9765