[STAGE5] Migrate MEDIA reads via gateway; writes require approval
lint / hygiene (pull_request) Failing after 22s
standard / check (pull_request) Successful in 14s
lint / hygiene (push) Failing after 23s
standard / check (push) Successful in 13s

This commit is contained in:
architect committed 2026-11-30 00:50:46 +03:00
1 parent 9b61e7b6c2
commit 22ec23f0e7
4 files changed
+19 -1

No files matched your search

+2
View File
@@ -44,6 +44,8 @@ direct 127.0.0.1:9120 → blocked
- feature flag `HUB_GATEWAY_SECRETARY=1` включён;
- `InfraBot` переведён на scoped `infra.read` (status/alerts/disk/content/services/gaps/inbox/sources/history/users);
- feature flag `HUB_GATEWAY_INFRA=1` включён;
- `MediaBot` переведён на `media.call`: read разрешён, write (`хочу/оценка/пополнить/тв/музыка`) блокируется до approval;
- feature flag `HUB_GATEWAY_MEDIA=1` включён;
- hub-bots active, 9 ботов на связи.
## Порядок миграции
@@ -129,6 +129,10 @@ tools:
mode: read
local: infra_read
approval: false
- name: media.call
mode: read
local: media_call
approval: false
- name: audit.write
gateway: http://127.0.0.1:9160/api/sprint/status
mode: write
+1 -1
View File
@@ -27,7 +27,7 @@ GET /v1/models
| S5-04 | Memory | done: SQLite namespaced memory + TTL/search, tests 3/3 |
| S5-05 | Night Shift | done: timers 00:00/07:30, llm-night-start/stop |
| S5-06 | Tool Gateway / agent approvals | done: agent-gw enforced + approval queue; legacy migration = G5 |
| S5-07 | Gate G5 | in_progress: Photo+Book+Home+Digest+Search+Cam+Infra; Secretary intent/ask; MEDIA direct |
| S5-07 | Gate G5 | in_progress: все боты через gateway; MEDIA write заблокирован; Secretary alias direct |
## Tool Gateway runtime
+12
View File
@@ -122,6 +122,18 @@ def local_call(handler, q="", params=None):
if handler == "core_ask":
data, err = _hub_module("core_api")._get("/ask", {"q": q}, timeout=180)
return {"ok": not bool(err), "data": data, "error": err}
if handler == "media_call":
cmd = (params.get("cmd") or [""])[0]
arg = (params.get("arg") or [""])[0]
write = {"пополнить", "хочу", "оценка", "тв", "музыка"}
if cmd in write:
return {"ok": False, "data": None, "error": "approval required for write command"}
bot = _hub_module("bots").MediaBot(None, None)
bot.register()
entry = bot.commands.get(cmd)
if not entry:
return {"ok": False, "data": None, "error": "unknown media command"}
return {"ok": True, "data": entry[1](arg), "error": None}
if handler == "infra_read":
bot = _hub_module("bots").InfraBot(None, None)
prom = _hub_module("sources").Prom()