Scaffold SimpleX Orchestrate: supervisor over official binaries

A standalone control-plane app that spawns and drives the official SimpleX
binaries (never modifies simplex source). Validated against simplex-chat
built from source (stable v6.5.4, GHC 9.6.3).

- CLAUDE.md: architecture notes mined from the upstream docs (WebSocket bot API,
  per-profile DBs, directory/broadcast bot config)
- supervisor/: process registry + port allocation (supervisor.py), corrId/cmd<->resp
  WebSocket client (ws_client.py), binary locator (binaries.py), FastAPI front with
  REST control + /events stream (server.py)
- smoke_test.py: Pattern-1 handshake (spawn simplex-chat -p, create+read user) — PASS
- group_test.py: two accounts, invitation connect + group invite/join, verified
  membership over the real SMP network — PASS
- build_chat.sh / install_ghc.sh: reproducible toolchain + from-source build

Key finding: fresh DB prompts for a display name on stdin; spawn with
--create-bot-display-name to start the WebSocket server non-interactively.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Jon
2026-06-04 12:31:37 +01:00
commit 38ff96c576
12 changed files with 704 additions and 0 deletions

24
supervisor/binaries.py Normal file
View File

@@ -0,0 +1,24 @@
"""Locate the official SimpleX binaries — never built/modified here, only invoked.
Resolution order: $SIMPLEX_BIN dir, then ./bin/, then PATH. Place prebuilt
binaries (simplex-chat, simplex-directory-service, simplex-broadcast-bot) in ./bin/
or install via the upstream install script. We never compile or alter them.
"""
import os
import shutil
from pathlib import Path
BIN_DIR = Path(os.environ.get("SIMPLEX_BIN", Path(__file__).resolve().parent.parent / "bin"))
KNOWN = ("simplex-chat", "simplex-directory-service", "simplex-broadcast-bot")
def binary_path(name: str) -> str:
local = BIN_DIR / name
if local.exists():
return str(local)
found = shutil.which(name)
if found:
return found
raise FileNotFoundError(f"{name!r} not found in {BIN_DIR} or PATH")