oclaw/tests/test_skill_runtime_metadata_and_tools.py
oliver efa72df362 Remove plan mode, skill toolcall path, and inline netx tools.
Wave C subtraction: keep skills as prompt-only, route netx via MCP with a shared netx_http client for xlsx/context inject, and delete plan_agent_v2 from the gateway.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-11 01:17:39 +08:00

56 lines
1.9 KiB
Python

from __future__ import annotations
import os
import tempfile
import unittest
from pathlib import Path
from runtime.skills import discover_workspace_skill_manifests
class SkillRuntimeMetadataAndToolsTests(unittest.TestCase):
def setUp(self) -> None:
self._tmp = tempfile.TemporaryDirectory(ignore_cleanup_errors=True)
self.skills_root = Path(self._tmp.name) / "skills"
self.skills_root.mkdir(parents=True, exist_ok=True)
os.environ["AIA_SKILLS_ROOT"] = str(self.skills_root)
def tearDown(self) -> None:
os.environ.pop("AIA_SKILLS_ROOT", None)
self._tmp.cleanup()
def test_manifest_parses_runtime_spec(self) -> None:
d = self.skills_root / "demo_runtime"
d.mkdir(parents=True, exist_ok=True)
(d / "scripts").mkdir(parents=True, exist_ok=True)
(d / "scripts" / "run.py").write_text("print('{\"ok\": true}')\n", encoding="utf-8")
(d / "SKILL.md").write_text(
"---\n"
"name: demo_runtime\n"
"description: demo\n"
"metadata:\n"
" oclaw:\n"
" runtime:\n"
" type: python\n"
" entry: scripts/run.py\n"
" schema:\n"
" type: object\n"
" properties:\n"
" input_path: { type: string }\n"
" additionalProperties: false\n"
"---\n"
"\n"
"# demo\n",
encoding="utf-8",
)
ms = discover_workspace_skill_manifests()
m = next((x for x in ms if x.name == "demo_runtime"), None)
assert m is not None
assert isinstance(m.runtime, dict)
assert m.runtime.get("type") == "python"
assert m.runtime.get("entry") == "scripts/run.py"
assert isinstance(m.runtime.get("schema"), dict)
if __name__ == "__main__":
unittest.main()