bridges: standalone third-party API bridges; isolate the command gateway

Split messaging UX (invite links, read, send) out of the command gateway into a
new `semif_agent.bridges` layer. Each bridge is its own process (`cli bridge`)
against its own service daemon/profile; the SimpleX bridge owns a second
simplex-chat daemon and buffers every inbound DM, so a message sent to the
connect-link address shows up in `simplex.next_message`.

- new: bridges/{base,inbox,registry,simplex}.py + neutral semif_agent/simplex_ws.py
- gateway: delete bridge.py; drop address/observer/pull-mode from the command path
- codegen: inject the bridge catalog (describe_bridges) into body + elicitation prompts
- seeds: repoint simplex.next_message/connect_link to top-level `simplex_bridge_url`
- config/bootstrap: new top-level `bridges` block + `simplex_bridge_url`; render
  semif-simplex-forward + semif-bridge units; gateway config loses bridge/inbox
- docs: AGENTS.md gateway isolation is non-negotiable
This commit is contained in:
Denton Social committed 2026-09-28 15:24:44 -05:00
1 parent d46fbdca19
commit ddc5cb66c8
31 files changed
+1702 -1088

No files matched your search

+1 -15
View File
@@ -59,13 +59,6 @@ class GatewayService:
self.home_channel = str(cfg.get("home_channel", "") or "")
self.reply_prefix = str(cfg.get("reply_prefix", "") or "")
self.poll_interval = float(poll_interval)
inbox_cfg = cfg.get("inbox", {}) or {}
#: When false the gateway only buffers inbound messages (for a read
#: skill to pull) instead of dispatching them as scheduler requests.
self.inbox_dispatch = bool(inbox_cfg.get("dispatch", True))
#: Optional callback invoked for every authorized inbound message,
#: before routing. The bridge uses it to fill its inbox.
self.observer = None
self.outbound: "queue.Queue[OutboundMessage | None]" = queue.Queue()
self._owners: dict[str, str] = {}
self._parents: dict[str, str] = {}
@@ -111,15 +104,8 @@ class GatewayService:
return None
def handle_inbound(self, msg: InboundMessage) -> None:
"""Handle one authorized inbound message. Called by the adapter."""
"""Handle one authorized inbound command. Called by the adapter."""
with self._route_lock:
if self.observer is not None:
self.observer(msg)
if not self.inbox_dispatch:
# Pull mode: buffer only (the observer recorded it); a read
# skill will consume it later. No scheduler request, no reply.
self.drain()
return
reply_to = msg.chat_id
pending = self.scheduler.pending
if pending is not None and self._pending_owner is None: