mirror of
https://github.com/hansjone/oclaw.git
synced 2026-10-09 01:50:44 +08:00
- Gate builtin netx tools; ops docs/skills use mcp__netx__* - Import Cursor mcpServers JSON; pass env_schema defaults to subprocess - Allow source_type=local; UTF-8 MCP stdio on Windows Co-authored-by: Cursor <cursoragent@cursor.com>
35 lines
1.2 KiB
Python
35 lines
1.2 KiB
Python
"""Expert registry: netx builtin tools gated by OCLAW_NETX_BUILTIN_TOOLS."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import os
|
|
|
|
import pytest
|
|
|
|
from runtime.tools import expert_registry
|
|
|
|
|
|
@pytest.fixture(autouse=True)
|
|
def _clear_expert_cache():
|
|
expert_registry._CACHED_FACTORIES_BY_EXPERT = None
|
|
expert_registry._CACHED_SPECS_BY_EXPERT = None
|
|
yield
|
|
expert_registry._CACHED_FACTORIES_BY_EXPERT = None
|
|
expert_registry._CACHED_SPECS_BY_EXPERT = None
|
|
|
|
|
|
def test_netx_tools_skipped_when_builtin_disabled(monkeypatch):
|
|
monkeypatch.delenv("OCLAW_NETX_BUILTIN_TOOLS", raising=False)
|
|
factories = expert_registry.discover_expert_tool_factories()
|
|
network_ops = factories.get("network_ops") or []
|
|
names = {f().name for f in network_ops}
|
|
assert not any(n.startswith("netx_") for n in names)
|
|
|
|
|
|
def test_netx_tools_registered_when_builtin_enabled(monkeypatch):
|
|
monkeypatch.setenv("OCLAW_NETX_BUILTIN_TOOLS", "1")
|
|
factories = expert_registry.discover_expert_tool_factories()
|
|
network_ops = factories.get("network_ops") or []
|
|
names = {f().name for f in network_ops}
|
|
assert "netx_query_ume_alarms" in names
|
|
assert "netx_exec_managed_ne" in names
|