[STAGE5] Tool Gateway policy registry + test
lint / hygiene (push) Failing after 22s
lint / hygiene (pull_request) Failing after 1m3s
standard / check (pull_request) Successful in 8s

This commit is contained in:
architect committed 2026-11-27 21:09:53 +03:00
1 parent 457f95d3b1
commit 649386f0b8
4 files changed
+61 -1

No files matched your search

@@ -0,0 +1,27 @@
version: 1
policy: "agents may use only gateway-listed tools; direct production access is forbidden"
tools:
- name: catalog.read
gateway: http://127.0.0.1:9120/catalog
mode: read
approval: false
- name: status.read
gateway: http://127.0.0.1:9120/status
mode: read
approval: false
- name: notify.send
gateway: http://127.0.0.1:9120/notify
mode: write
approval: true
- name: media.read
gateway: http://127.0.0.1:9180/v1/media
mode: read
approval: false
- name: events.read
gateway: http://127.0.0.1:9180/v1/events
mode: read
approval: false
- name: audit.write
gateway: http://127.0.0.1:9160/api/sprint/status
mode: write
approval: true
+1 -1
View File
@@ -26,7 +26,7 @@ GET /v1/models
| S5-03 | Evals / golden set | open |
| S5-04 | Memory | open |
| S5-05 | Night Shift | open |
| S5-06 | Tool Gateway / agent approvals | open |
| S5-06 | Tool Gateway / agent approvals | in_progress: policy registry, no enforcement |
| S5-07 | Gate G5 | open |
## Ограничение
+15
View File
@@ -0,0 +1,15 @@
import sys, unittest
from pathlib import Path
sys.path.insert(0, str(Path(__file__).resolve().parents[1]))
from tool_gateway import load_tools
class GatewayTests(unittest.TestCase):
def test_tools_have_gateway(self):
tools = load_tools()
self.assertGreaterEqual(len(tools), 3)
for t in tools:
self.assertTrue(t["gateway"].startswith("http"))
self.assertFalse(t.get("direct_prod", False))
if __name__ == "__main__":
unittest.main()
+18
View File
@@ -0,0 +1,18 @@
"""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"):
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