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

+24 -19
View File
@@ -345,23 +345,6 @@ 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,
address_provider=adapter.request_address,
)
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
@@ -386,11 +369,22 @@ def run_gateway(
finally:
service.stop()
adapter.close()
if bridge is not None:
bridge.stop()
return 0
def run_bridge(scheduler: Scheduler, config: dict, name: str | None = None) -> int:
"""Run standalone third-party API bridges (SimpleX first).
Bridges are their own processes so generated skills never touch a system's
native protocol and the command gateway never grows read/send surface. See
`semif_agent.bridges`.
"""
from .bridges.registry import run_bridges
names = [name] if name else None
return run_bridges(config, names=names, trace=scheduler.trace)
def main(argv: list[str] | None = None) -> int:
argv = list(argv) if argv is not None else list(sys.argv[1:])
config = load_config(_extract_config_path(argv))
@@ -430,6 +424,15 @@ def main(argv: list[str] | None = None) -> int:
help="also serve the browser dashboard from the same process",
)
bridge_p = sub.add_parser(
"bridge", help="run standalone third-party API bridges (SimpleX first)"
)
bridge_p.add_argument(
"--name",
default=None,
help="bridge service to run (default: all enabled)",
)
args = parser.parse_args(argv)
scheduler, config = build_scheduler(config)
@@ -461,6 +464,8 @@ def main(argv: list[str] | None = None) -> int:
platform=args.platform,
serve_dashboard=args.dashboard,
)
elif args.command == "bridge":
return run_bridge(scheduler, config, name=args.name)
else:
parser.print_help()
return 0