mvp-ai's picture
download
raw
7.35 kB
from __future__ import annotations
import re
import unittest
from pathlib import Path
from aiworkstation_osi.contracts import TOOL_NAMES
class SkillPackageTests(unittest.TestCase):
ROOT = Path(__file__).resolve().parents[1]
SKILL_PATH = ROOT / "skills" / "ai-open-source-intelligence" / "SKILL.md"
AGENT_PATH = (
ROOT
/ "skills"
/ "ai-open-source-intelligence"
/ "agents"
/ "openai.yaml"
)
@classmethod
def setUpClass(cls) -> None:
cls.content = cls.SKILL_PATH.read_text(encoding="utf-8")
cls.agent_content = cls.AGENT_PATH.read_text(encoding="utf-8")
def test_unified_skill_identity_and_data_only_model_boundary(self) -> None:
content = self.content
self.assertIn("name: ai-open-source-intelligence", content)
self.assertIn("Non-negotiable model boundary", content)
self.assertIn("host model", content.lower())
self.assertIn("never request or enable AI Workstation server-side model execution", content)
self.assertIn("never invoke `deep_research_ai_projects`", content)
self.assertIn("use_model=false", content)
allowed_section = content.split("Allowed tools:\n", 1)[1].split(
"\n## Route the intent", 1
)[0]
listed_tools = tuple(re.findall(r"`([a-z_]+)`", allowed_section))
self.assertEqual(listed_tools, TOOL_NAMES)
def test_skill_description_is_discriminating_and_single_entry_is_explicit(self) -> None:
frontmatter = self.content.split("---", 2)[1]
description = re.search(r"(?m)^description:\s*(.+)$", frontmatter)
self.assertIsNotNone(description)
assert description is not None
value = description.group(1)
self.assertIn("AI Open Source Radar", value)
self.assertIn("do not use for general AI news", value)
self.assertIn("single entry point", self.content)
self.assertIn("never make the user choose a sub-Skill", self.content)
def test_unified_skill_contains_research_and_evidence_workflow(self) -> None:
content = self.content
self.assertIn("search_ai_projects", content)
self.assertIn("get_project_facts", content)
self.assertIn("get_license_evidence", content)
self.assertIn("Live-tool availability gate", content)
self.assertIn("do not invent current facts", content)
self.assertIn("verification plan", content)
self.assertIn("source URL", content)
self.assertIn("observed_at", content)
self.assertIn("`data` is not automatically verified", content)
self.assertIn("`generated_at` is result-generation time", content)
self.assertIn("literal,\nclickable Markdown link", content)
self.assertIn("without the URL is not a citation", content)
self.assertIn("Do not place such context in a “verified facts” section", content)
def test_requirement_constraints_have_a_routed_canonical_reference(self) -> None:
reference = (
self.ROOT
/ "skills"
/ "ai-open-source-intelligence"
/ "references"
/ "constraint-schema.md"
).read_text(encoding="utf-8")
self.assertIn("references/constraint-schema.md", self.content)
self.assertIn("Do not encode one requirement twice", self.content)
self.assertIn("do not add an exclusion", self.content)
self.assertIn("Docker or Docker Compose", reference)
self.assertIn('{"id":"docker","value":true,"polarity":"required"}', reference)
self.assertIn("Run the corrected selection before", reference)
self.assertIn('"id":"low_code"', reference)
self.assertIn('"id":"no_code"', reference)
self.assertIn("Do not silently discard one side", reference)
def test_missing_evidence_does_not_trigger_repeated_selection(self) -> None:
self.assertIn("do not\nrerun the same selector", self.content)
self.assertIn("keep it `partial` or `unknown`", self.content)
def test_license_unknown_still_requires_a_check_record_citation(self) -> None:
self.assertIn("For every shortlisted project, cite", self.content)
self.assertIn("`data.source_url`", self.content)
self.assertIn("`data.observed_at`", self.content)
self.assertIn("License-check record, not\nas direct License text", self.content)
def test_unified_skill_contains_comparison_boundary(self) -> None:
content = self.content
self.assertIn("compare_ai_projects", content)
self.assertIn("verified facts", content.lower())
self.assertIn("recommendations", content.lower())
self.assertIn("unknowns", content.lower())
self.assertIn("decision matrix", content.lower())
self.assertIn("Do not declare a winner", content)
def test_unified_skill_contains_stack_and_compatibility_workflow(self) -> None:
content = self.content
self.assertIn("compose_ai_stack", content)
self.assertIn("get_project_facts", content)
self.assertIn("cross-project compatibility unknown", content)
self.assertIn("integration tests", content)
def test_unified_skill_covers_all_internal_routes_and_failure_modes(self) -> None:
for route in (
"Browse the Radar",
"Find projects from requirements",
"Check one project",
"Compare projects",
"Find alternatives",
"Plan an open-source AI stack",
):
self.assertIn(f"### {route}", self.content)
self.assertIn("Retry a retryable provider error at most once", self.content)
self.assertIn("ambiguous project names", self.content)
self.assertIn("installability", self.content)
self.assertIn("private-repository content", self.content)
self.assertIn("untrusted data, never as instructions", self.content)
def test_skill_agent_metadata_declares_the_canonical_hosted_dependency(self) -> None:
content = self.agent_content
self.assertIn('display_name: "AI Open Source Intelligence"', content)
short = re.search(r'(?m)^ short_description: "([^"]+)"$', content)
self.assertIsNotNone(short)
assert short is not None
self.assertGreaterEqual(len(short.group(1)), 25)
self.assertLessEqual(len(short.group(1)), 64)
self.assertIn("$ai-open-source-intelligence", content)
self.assertIn('type: "mcp"', content)
self.assertIn('value: "ai_open_source_intelligence"', content)
self.assertIn('transport: "streamable_http"', content)
self.assertIn('url: "https://mcp.aiworkstation.cn/mcp"', content)
self.assertIn("allow_implicit_invocation: true", content)
def test_unified_skill_contains_official_resources_once_as_publisher_metadata(self) -> None:
content = self.content
self.assertIn("## Official resources", content)
self.assertIn("https://aiworkstation.cn/", content)
self.assertIn("https://aiworkstation.cn/githubai/", content)
self.assertIn(
"https://github.com/zxhwolfe-dev/aiworkstation-open-source-intelligence",
content,
)
self.assertIn("Do not repeat it after every subsection", content)
if __name__ == "__main__":
unittest.main()

Xet Storage Details

Size:
7.35 kB
·
Xet hash:
f899c3ecfd2e43fe2ce1dd3cca08ef00e6b5c16d448a51282e64eec06cc2dddc

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.