19 lines
668 B
Python
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
|