feat(matrix-bridge-dagi): add mixed-room routing by slash/mention (M2.1)

- mixed_routing.py: parse BRIDGE_MIXED_ROOM_MAP, route by /slash > @mention > name: > default
- ingress.py: _try_enqueue_mixed for mixed rooms, session isolation {room}:{agent}, reply tagging
- config.py: bridge_mixed_room_map + bridge_mixed_defaults fields
- main.py: parse mixed config, pass to MatrixIngressLoop, expose in /health + /bridge/mappings
- docker-compose: BRIDGE_MIXED_ROOM_MAP / BRIDGE_MIXED_DEFAULTS env vars, BRIDGE_ALLOWED_AGENTS multi-value
- tests: 25 routing unit tests + 10 ingress integration tests (94 total pass)

Made-with: Cursor
This commit is contained in:
Apple
2026-03-05 01:29:18 -08:00
parent 79db053b38
commit a85a11984b
7 changed files with 1049 additions and 21 deletions

View File

@@ -1,4 +1,4 @@
# Matrix Bridge DAGI — Phase M1
# Matrix Bridge DAGI — Phase M2.1 (multi-room + mixed routing)
# Include into the main NODA1 stack or run standalone:
# docker compose -f docker-compose.node1.yml -f docker-compose.matrix-bridge-node1.yml up -d matrix-bridge-dagi
@@ -40,12 +40,26 @@ services:
- SOFIIA_CONSOLE_URL=http://dagi-sofiia-console-node1:8002
- SOFIIA_INTERNAL_TOKEN=${SOFIIA_INTERNAL_TOKEN:-}
# ── H2: Backpressure queue ───────────────────────────────────────────
- QUEUE_MAX_EVENTS=100
- WORKER_CONCURRENCY=2
- QUEUE_DRAIN_TIMEOUT_S=5
# ── Policy ───────────────────────────────────────────────────────────
- BRIDGE_ALLOWED_AGENTS=sofiia
# M2.0+: multiple agents separated by comma
- BRIDGE_ALLOWED_AGENTS=${BRIDGE_ALLOWED_AGENTS:-sofiia}
# M2.0: "sofiia:!room1:server,helion:!room2:server" (1 room → 1 agent)
- BRIDGE_ROOM_MAP=${BRIDGE_ROOM_MAP:-}
- RATE_LIMIT_ROOM_RPM=20
- RATE_LIMIT_SENDER_RPM=10
# ── M2.1: Mixed rooms (1 room → N agents) ───────────────────────────
# Format: "!roomX:server=sofiia,helion;!roomY:server=druid"
- BRIDGE_MIXED_ROOM_MAP=${BRIDGE_MIXED_ROOM_MAP:-}
# Override default agent per mixed room (optional):
# "!roomX:server=helion;!roomY:server=druid"
- BRIDGE_MIXED_DEFAULTS=${BRIDGE_MIXED_DEFAULTS:-}
healthcheck:
test:
- "CMD"