Skip to content

armgit / cua

Public Imported from GitHub
0

Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.

fix(cua-driver): move the skill version under metadata.version (#6647)

injaneity0402233c4464
diff --git a/.github/releases/components.json b/.github/releases/components.json
index 94784198ac..3333a1815f 100644
--- a/.github/releases/components.json
+++ b/.github/releases/components.json
@@ -79,7 +79,7 @@
{
"kind": "regex",
"path": "libs/cua-driver/rust/Skills/cua-driver/SKILL.md",
- "pattern": "(?m)^(version: )\\d+\\.\\d+\\.\\d+( # x-release-please-version)$",
+ "pattern": "(?m)^( version: )\\d+\\.\\d+\\.\\d+( # x-release-please-version)$",
"replacement": "\\g<1>{version}\\g<2>",
"expectedMatches": 1
}
diff --git a/.github/scripts/tests/test_release_channels.py b/.github/scripts/tests/test_release_channels.py
index acd4582857..e32416a78c 100644
--- a/.github/scripts/tests/test_release_channels.py
+++ b/.github/scripts/tests/test_release_channels.py
@@ -494,7 +494,7 @@ def test_manifest_uses_stable_authority_with_a_separately_versioned_asset_tree(
assert changed == ["release-stage/cua-driver-skills/SKILL.md"]
assert source_skill.read_text(encoding="utf-8") == source_before
- assert version in (staged / "SKILL.md").read_text(encoding="utf-8")
+ assert f" version: {version} # x-release-please-version" in (staged / "SKILL.md").read_text(encoding="utf-8")
load_registry(registry, root=root)
assets = root / "release-upload"
diff --git a/.github/scripts/validate_release_versions.py b/.github/scripts/validate_release_versions.py
index d4b5bc6372..078296557e 100644
--- a/.github/scripts/validate_release_versions.py
+++ b/.github/scripts/validate_release_versions.py
@@ -139,7 +139,7 @@ def driver_versions(root: Path) -> tuple[str, dict[str, str]]:
),
"rust/Skills/cua-driver/SKILL.md": read_match(
base / "rust/Skills/cua-driver/SKILL.md",
- r"^version:\s*([^\s#]+)",
+ r"^ version:\s*([^\s#]+)",
),
}
for relative in driver_reference_paths(root):
diff --git a/.github/workflows/clawhub-cua-driver.yml b/.github/workflows/clawhub-cua-driver.yml
index 6a0a31bc26..77e69d742b 100644
--- a/.github/workflows/clawhub-cua-driver.yml
+++ b/.github/workflows/clawhub-cua-driver.yml
@@ -65,7 +65,7 @@ jobs:
skill_text = Path("libs/cua-driver/rust/Skills/cua-driver/SKILL.md").read_text()
frontmatter = skill_text.split("---", 2)[1]
- match = re.search(r"^version:\s*([^\s#]+)", frontmatter, re.MULTILINE)
+ match = re.search(r"^ version:\s*([^\s#]+)", frontmatter, re.MULTILINE)
if not match:
raise SystemExit("SKILL.md frontmatter has no version")
print(match.group(1))
@@ -123,7 +123,7 @@ jobs:
cargo_version = cargo["workspace"]["package"]["version"]
skill_text = Path(os.environ["SKILL_PATH"], "SKILL.md").read_text()
frontmatter = skill_text.split("---", 2)[1]
- match = re.search(r"^version:\s*([^\s#]+)", frontmatter, re.MULTILINE)
+ match = re.search(r"^ version:\s*([^\s#]+)", frontmatter, re.MULTILINE)
if not match:
raise SystemExit("SKILL.md frontmatter has no version")
skill_version = match.group(1)
diff --git a/libs/cua-driver/README.md b/libs/cua-driver/README.md
index f65263c23f..7bfd33af15 100644
--- a/libs/cua-driver/README.md
+++ b/libs/cua-driver/README.md
@@ -241,7 +241,7 @@ ClawHub CLI. A real release is available only through the
all of the following:
1. Dispatch the workflow from `main`.
-2. Enter a version that matches both `rust/Cargo.toml` and the `version` field
+2. Enter a version that matches both `rust/Cargo.toml` and the `metadata.version` field
in `rust/Skills/cua-driver/SKILL.md`.
3. Confirm the MIT-0 rights check in the workflow form.
4. Configure a repository Actions secret named `CLAWHUB_TOKEN` for a publisher
diff --git a/libs/cua-driver/rust/Skills/cua-driver/SKILL.md b/libs/cua-driver/rust/Skills/cua-driver/SKILL.md
index f6eab69ee4..1b0a0f400e 100644
--- a/libs/cua-driver/rust/Skills/cua-driver/SKILL.md
+++ b/libs/cua-driver/rust/Skills/cua-driver/SKILL.md
@@ -1,8 +1,8 @@
---
name: cua-driver
description: Drive a native GUI app (macOS, Windows, Linux) via the cua-driver CLI (default) or MCP server; snapshot its accessibility tree, act through snapshot-bound element tokens, native menu paths, exact window geometry, or pixel coordinates, and verify from fresh state. Use when the user asks you to operate, drive, automate, or perform a GUI task in a real application on the host, or to continue, resume, or recall recent Cua activity.
-version: 0.39.0 # x-release-please-version
metadata:
+ version: 0.39.0 # x-release-please-version
openclaw:
requires:
bins:
diff --git a/libs/cua-driver/rust/crates/cua-driver-core/src/mcp_skills.rs b/libs/cua-driver/rust/crates/cua-driver-core/src/mcp_skills.rs
index a51a33708d..641e1be82f 100644
--- a/libs/cua-driver/rust/crates/cua-driver-core/src/mcp_skills.rs
+++ b/libs/cua-driver/rust/crates/cua-driver-core/src/mcp_skills.rs
@@ -314,7 +314,7 @@ mod tests {
let yaml = source.split("---").nth(1).unwrap();
let expected: Value = serde_yaml_ng::from_str(yaml).unwrap();
assert_eq!(pack().entry["frontmatter"], expected);
- assert!(expected["version"].is_string());
+ assert!(expected["metadata"]["version"].is_string());
assert_eq!(
expected["metadata"]["openclaw"]["envVars"][0]["required"],
false
diff --git a/libs/cua/crates/cua-agent-setup/src/skills.rs b/libs/cua/crates/cua-agent-setup/src/skills.rs
index d17334f36c..fe4f242b93 100644
--- a/libs/cua/crates/cua-agent-setup/src/skills.rs
+++ b/libs/cua/crates/cua-agent-setup/src/skills.rs
@@ -23,7 +23,7 @@ pub struct Skill {
pub source: String,
/// Front matter `description`.
pub description: String,
- /// Front matter `version`, or the cua version.
+ /// Front matter `metadata.version`, or the cua version.
pub version: String,
/// Tree hash of the bundled files (same scheme as `fsutil::hash_dir`).
pub hash: String,
@@ -272,8 +272,8 @@ fn tree_hash(d: &Dir<'_>, files: &[&include_dir::File<'_>]) -> String {
hex::encode(h.finalize())
}
-/// `name`, `description` (folded `>-` blocks joined) and `version` from
-/// SKILL.md front matter.
+/// `name`, `description` (folded `>-` blocks joined) and `metadata.version`
+/// from SKILL.md front matter.
pub fn front_matter(md: &str) -> Option<(String, String, Option<String>)> {
let rest = md
.strip_prefix("---\n")
@@ -283,15 +283,19 @@ pub fn front_matter(md: &str) -> Option<(String, String, Option<String>)> {
let mut name = None;
let mut description = None;
let mut version = None;
+ let mut in_metadata = false;
let mut lines = fm.lines().peekable();
while let Some(l) = lines.next() {
if l.starts_with(' ') || l.starts_with('\t') {
+ if let Some(v) = l.strip_prefix(" version:").filter(|_| in_metadata) {
+ version = Some(scalar(v));
+ }
continue;
}
let Some((k, v)) = l.split_once(':') else {
continue;
};
- // Drop a trailing YAML comment (`version: 1.2 # x-release-please`).
+ in_metadata = k.trim() == "metadata";
let v = v.split(" #").next().unwrap_or("").trim();
let value = if matches!(v, ">-" | ">" | "|" | "|-") {
let mut parts = Vec::new();
@@ -306,18 +310,24 @@ pub fn front_matter(md: &str) -> Option<(String, String, Option<String>)> {
parts.retain(|p| !p.is_empty());
parts.join(" ")
} else {
- v.trim_matches('"').trim_matches('\'').to_string()
+ scalar(v)
};
match k.trim() {
"name" => name = Some(value),
"description" => description = Some(value),
- "version" => version = Some(value),
_ => {}
}
}
Some((name?, description?, version.filter(|v| !v.is_empty())))
}
+/// A plain or quoted scalar, without a trailing YAML comment
+/// (`1.2 # x-release-please-version`).
+fn scalar(v: &str) -> String {
+ let v = v.split(" #").next().unwrap_or("").trim();
+ v.trim_matches('"').trim_matches('\'').to_string()
+}
+
#[cfg(test)]
mod tests {
use super::*;
@@ -346,6 +356,16 @@ mod tests {
);
assert!(s.files >= 1);
}
+ // cua-driver carries its own release version, not the cua one.
+ let driver = bundled().into_iter().find(|s| s.name == "cua-driver");
+ let md = include_str!("../../../skills/cua-driver/SKILL.md");
+ let version = driver.unwrap().version;
+ assert!(
+ md.contains(&format!(
+ "\n version: {version} # x-release-please-version\n"
+ )),
+ "{version}"
+ );
}
#[test]
@@ -426,11 +446,14 @@ mod tests {
#[test]
fn front_matter_handles_folded_descriptions_and_comments() {
- let md = "---\nname: a\ndescription: >-\n one\n two\nversion: 1.2.3 # x-release\nmetadata:\n k: v\n---\nbody";
+ let md = "---\nname: a\ndescription: >-\n one\n two\nmetadata:\n version: 1.2.3 # x-release\n k: v\n---\nbody";
assert_eq!(
front_matter(md).unwrap(),
("a".into(), "one two".into(), Some("1.2.3".into()))
);
+ // Only `metadata.version` counts, not a top-level or deeper one.
+ let md = "---\nname: a\ndescription: d\nversion: 9.9.9\nmetadata:\n openclaw:\n version: 8.8.8\n---\n";
+ assert_eq!(front_matter(md).unwrap().2, None);
assert!(front_matter("no front matter").is_none());
}
}
diff --git a/libs/cua/skills/cua-driver/SKILL.md b/libs/cua/skills/cua-driver/SKILL.md
index 46ee3dbc6c..6a2c9158bc 100644
--- a/libs/cua/skills/cua-driver/SKILL.md
+++ b/libs/cua/skills/cua-driver/SKILL.md
@@ -1,8 +1,8 @@
---
name: cua-driver
description: Drive a native GUI app (macOS, Windows, Linux) via the cua-driver CLI (default) or MCP server; snapshot its accessibility tree, act through snapshot-bound element tokens, native menu paths, exact window geometry, or pixel coordinates, and verify from fresh state. Use when the user asks you to operate, drive, automate, or perform a GUI task in a real application on the host, or to continue, resume, or recall recent Cua activity.
-version: 0.31.0 # x-release-please-version
metadata:
+ version: 0.31.0 # x-release-please-version
openclaw:
requires:
bins: