Activation reaches plugin discovery before the application dependencies exist. Give PM its own locked Python project and runtime so it can install or repair the application without importing that dependency tree. Keep PM outside the application workspace. A shared uv workspace resolves the application graph and cannot provide this isolation. Route mutations through an isolated worker and preserve transaction callbacks, cancellation, custom package registrations, and correlated receipts. Use the same runtime builder for source installs and packaged payloads. Keep offline wheelhouse support in that builder. Nix builds the independent PM lock as a separate derivation. Refuse lazy-disabled bootstrap before installing tools or dependencies. Move first-party YAML readers and writers to ruamel. Keep the application lock's transitive PyYAML requirements for third-party packages. Verification: - Focused canonical Python suite: 177 passed, 1 host-gated skip. - Electron backend probes: 12 passed. Electron typecheck passed. - Both uv locks, scoped lint, Bash syntax, and whitespace checks passed. - Cold activation, corrupt-app repair, offline staging, and relocation ran. - Built and exercised the Nix PM runtime and standalone YAML merge script. Six broader caller test files retain the same 24 failing test IDs as an archive of HEAD. The existing real-home guard blocks those tests before they can exercise the affected paths. No full-suite pass is claimed. Native Windows signing and full Bionic package execution remain unverified.
49 lines
2.2 KiB
Python
49 lines
2.2 KiB
Python
"""The session_platforms frontmatter gate (skills-index slim PR).
|
|
|
|
A skill whose metadata.hermes.session_platforms names gateway channels is
|
|
hidden from the skills index on every other channel; unknown platform
|
|
fails OPEN (offline builds/tests must not hide skills).
|
|
"""
|
|
from agent.prompt_builder import _skill_should_show
|
|
from agent.skill_utils import extract_skill_conditions
|
|
|
|
|
|
def _conds(platforms):
|
|
return extract_skill_conditions(
|
|
{"metadata": {"hermes": {"session_platforms": platforms}}}
|
|
)
|
|
|
|
|
|
class TestSessionPlatformGate:
|
|
def test_hidden_on_other_channel(self):
|
|
assert _skill_should_show(_conds(["teams", "cron"]), {"terminal"}, set(), "desktop") is False
|
|
assert _skill_should_show(_conds(["teams", "cron"]), {"terminal"}, set(), "telegram") is False
|
|
|
|
def test_shown_on_named_channel(self):
|
|
assert _skill_should_show(_conds(["teams", "cron"]), {"terminal"}, set(), "teams") is True
|
|
assert _skill_should_show(_conds(["teams", "cron"]), {"terminal"}, set(), "cron") is True
|
|
|
|
def test_case_insensitive(self):
|
|
assert _skill_should_show(_conds(["Teams"]), {"terminal"}, set(), "TEAMS") is True
|
|
|
|
def test_unknown_platform_fails_open(self):
|
|
assert _skill_should_show(_conds(["teams"]), {"terminal"}, set(), None) is True
|
|
assert _skill_should_show(_conds(["teams"]), {"terminal"}, set(), "") is True
|
|
|
|
def test_empty_list_visible_everywhere(self):
|
|
assert _skill_should_show(_conds([]), {"terminal"}, set(), "desktop") is True
|
|
|
|
def test_gate_runs_even_without_tool_info(self):
|
|
# The channel gate is independent of tool-filtering backward compat.
|
|
assert _skill_should_show(_conds(["teams"]), None, None, "desktop") is False
|
|
|
|
def test_teams_meeting_pipeline_carries_the_gate(self):
|
|
from pathlib import Path
|
|
import re, hermes_yaml as yaml
|
|
|
|
p = Path(__file__).resolve().parents[2] / "skills" / "productivity" / "teams-meeting-pipeline" / "SKILL.md"
|
|
content = p.read_text(encoding="utf-8")
|
|
m = re.search(r"\n---\s*\n", content[3:])
|
|
fm = yaml.safe_load(content[3 : m.start() + 3])
|
|
assert fm["metadata"]["hermes"]["session_platforms"] == ["teams", "cron"]
|