Extract Cortex OS Hermes WebUI Host Adapter

This commit is contained in:
Svrnty
2026-05-29 02:53:40 -04:00
parent 8b6c810f4a
commit 1707a7b09d
6 changed files with 116 additions and 20 deletions
@@ -0,0 +1,51 @@
from unittest.mock import Mock
from routes import cortex_os_extension
def test_adapter_constants_preserve_s27_identity():
assert cortex_os_extension.PACKAGE_ID == "cortex-os-extension"
assert cortex_os_extension.MEMBER_ID == "s23-runtime-health-read-only-slice"
assert cortex_os_extension.ACTIVE_DEVELOPMENT_MOUNT_TARGET == "hermes-webui"
assert cortex_os_extension.RUNTIME_HEALTH_METHOD == "GET"
assert cortex_os_extension.RUNTIME_HEALTH_ROUTE == "/api/cortex-os/runtime-health"
def test_adapter_registers_runtime_health_route_and_assets_only():
api = Mock()
api.logger.return_value = Mock()
cortex_os_extension.register(api, "svrnty")
api.inject_stylesheet.assert_called_once_with(
"/plugins/svrnty/cortex-os/runtime-health/runtime_health.css"
)
api.inject_script.assert_called_once_with(
"/plugins/svrnty/cortex-os/runtime-health/runtime_health.js"
)
api.register_route.assert_called_once()
method, path = api.register_route.call_args.args[:2]
assert method == "/api/cortex-os/runtime-health"
assert path == "GET"
api.register_static.assert_not_called()
api.config_get.assert_not_called()
api.register_audio_attachment_processor.assert_not_called()
def test_adapter_source_has_no_forbidden_runtime_discovery():
source = cortex_os_extension.__loader__.get_source(cortex_os_extension.__name__)
forbidden = [
"glob(",
"rglob(",
"subprocess",
"os.walk",
"sot/08-OUTPUTS",
"hermes_webui",
"hermes_agent",
"register_static",
"config_get",
"register_audio_attachment_processor",
"product readiness",
]
for snippet in forbidden:
assert snippet not in source