Files
buryan-infra/ops/ai/tool_gateway.py
T
architect 29fe3881a8
lint / hygiene (push) Failing after 22s
lint / hygiene (pull_request) Failing after 26s
standard / check (pull_request) Successful in 11s
[STAGE5] Allow local gateway tools in validation; tests 7/7
2026-11-30 00:44:57 +03:00

19 lines
668 B
Python

"""Read-only Tool Gateway policy registry (Stage 5)."""
from pathlib import Path
import yaml
PATH = Path("/root/buryan-infra/docs/architecture/REGISTRY/tool_gateway.yaml")
def load_tools():
data = yaml.safe_load(PATH.read_text())
tools = data.get("tools") or []
for t in tools:
if not (t.get("gateway") or t.get("local")):
raise ValueError("tool without gateway: %s" % t.get("name"))
if t.get("direct_prod"):
raise ValueError("direct production access forbidden: %s" % t.get("name"))
if t.get("mode") not in ("read", "write"):
raise ValueError("bad mode: %s" % t.get("name"))
return tools