gateway: serve a local messaging bridge so skills can send/read SimpleX
The gateway now exposes a localhost stdlib HTTP API (bridge.py) that
buffers authorized inbound DMs and forwards outbound sends, so a skill
body never opens a WebSocket to the simplex-chat daemon. Endpoints:
GET /health, /contacts, /inbox (peek), /inbox/next (pop oldest unread),
POST /send (resolve id/display name onto the adapter's outbound queue).
GatewayService gains an observer hook and inbox.dispatch (pull-only mode).
Expose the capability to codegen (SKILL.md, BODY_DIRECTIVES, elicitation,
TESTGEN.md) and add the simplex.next_message seed (SemIf recipient
resolution) with its hermetic loopback test. Config: messaging_bridge_url
plus gateway.simplex.{inbox,bridge}; bootstrap keeps them in sync.
This commit is contained in:
1 parent
b348f19486
commit
08d6bb23e2
19 files changed
+1006
-29
No files matched your search
@@ -318,6 +318,19 @@ def run_gateway(
|
||||
scheduler.on_request_requeued = service.on_request_requeued
|
||||
service.start()
|
||||
|
||||
from .gateway.bridge import MessagingBridge
|
||||
|
||||
bridge_cfg = cfg.get("bridge", {}) or {}
|
||||
bridge = None
|
||||
if bridge_cfg.get("enabled", True):
|
||||
bridge = MessagingBridge(service.outbound, config=bridge_cfg)
|
||||
service.observer = bridge.record_inbound
|
||||
port = bridge.start()
|
||||
print(
|
||||
f"messaging bridge listening on http://{bridge.host}:{port} "
|
||||
"(skills use messaging_bridge_url)"
|
||||
)
|
||||
|
||||
if serve_dashboard:
|
||||
import threading
|
||||
|
||||
@@ -342,6 +355,8 @@ def run_gateway(
|
||||
finally:
|
||||
service.stop()
|
||||
adapter.close()
|
||||
if bridge is not None:
|
||||
bridge.stop()
|
||||
return 0
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user