Files
openworker/harness/tests/python-skills-contract.py
Rohit PrasadandDevika Verma d53e058eda Introduce OpenWorker Harness SDK (in beta), agent service cluster and relevant developer documentation (#844)
Allow developers to easily build AI apps without worrying about the harness part.
Bundles the Rust agent runtime as a SDK (Rust and TypeScript) for building desktop and web applications. Applications can manage a local harness or connect to an authenticated harness service on k8s with separately scaled workers and sandbox execution.

The implementation is primarily contained in harness/, with deployment tooling in deploy/, Markdown guides in docs/harness/guides/, and the static documentation site in docs-site/. It does not replace the existing Python harness or migrate OpenWorker Desktop.

Co-authored-by: Devika Verma <devikaverma11@gmail.com>
2026-11-06 09:45:20 -08:00

32 lines
1.5 KiB
Python

"""Development-only shared skill contract against the checked-in Python reference."""
import json
import sys
import tempfile
from pathlib import Path
repo = Path(__file__).resolve().parents[2]
sys.path.insert(0, str(repo))
from coworker.skills.base import _parse_skill, SkillLoader, skill_catalog_text, skill_tools
fixtures = json.loads(Path(__file__).with_name("skills-contract.json").read_text())
with tempfile.TemporaryDirectory() as tmp:
root = Path(tmp)
for group in ["shared", "differences"]:
for case in fixtures[group]:
folder = root / case["folder"]
folder.mkdir(exist_ok=True)
path = folder / "SKILL.md"
path.write_text(case["text"])
skill = _parse_skill(path)
if group == "shared":
for key in ["name", "description", "instructions", "allowed_tools"]:
assert getattr(skill, key) == case[key], (case, key)
else:
for key in ["name", "description", "allowed_tools"]:
if "python_" + key in case:
assert getattr(skill, key) == case["python_" + key], (case, key)
path.write_text("---\nname: report\ndescription: Report procedure\n---\nBODY_NOT_IN_CATALOG")
loader = SkillLoader([root])
assert "BODY_NOT_IN_CATALOG" not in skill_catalog_text(loader)
print(f"PASS: {len(fixtures['shared'])} shared skill parsing cases; {len(fixtures['differences'])} explicit Python/native differences; lazy catalog")