ServerRouter + Dispatcher + Hybrid pipeline + registry export + hard IP isolation + final_gate.
Fleet control plane for multi-account days.
#!/usr/bin/env python3
"""Multi-Account Ops Console Agent
Hybrids: Frappe-style registry · ServerRouter · Dispatcher · Hybrid 4.7 pipeline
· verification final_gate · per-account profile/proxy binding
"""
from __future__ import annotations
import json, os
from dataclasses import dataclass, asdict
from pathlib import Path
from typing import Literal
Verdict = Literal["PASS", "FAIL", "INCONCLUSIVE"]
@dataclass
class R:
name: str
verdict: Verdict
detail: str
evidence: dict
# one account → one VPS IP forever
FLEET = {
"brand_a": {"vps": "contabo-149", "ip": "149.102.150.185", "profile": "profiles/brand_a", "proxy": "res-a"},
"brand_b": {"vps": "hetzner", "ip": "46.62.228.173", "profile": "profiles/brand_b", "proxy": "res-b"},
}
PIPELINE = [
"boot", "server_router", "dispatcher", "warm_up", "prepublish", "publish", "first_60_minutes"
]
def server_router(account: str) -> R:
meta = FLEET.get(account)
if not meta:
return R("server_router", "FAIL", f"unknown account {account}", {})
return R("server_router", "PASS", meta["vps"], meta)
def dispatcher(accounts: list[str]) -> R:
plan = []
for a in accounts:
r = server_router(a)
if r.verdict != "PASS":
return R("dispatcher", "FAIL", r.detail, {})
plan.append({"account": a, **r.evidence, "pipeline": PIPELINE})
path = Path(os.environ.get("OUT_DIR", ".")) / "dispatch_plan.json"
path.write_text(json.dumps(plan, indent=2))
return R("dispatcher", "PASS", f"{len(plan)} jobs", {"path": str(path)})
def frappe_registry_export() -> R:
rows = [{"account": k, **v, "doctype": "SocialAccount"} for k, v in FLEET.items()]
path = Path(os.environ.get("OUT_DIR", ".")) / "registry.json"
path.write_text(json.dumps(rows, indent=2))
return R("frappe-registry", "PASS", str(path), {"n": len(rows)})
def verify_binding() -> R:
# fail if two accounts share IP
ips = [v["ip"] for v in FLEET.values()]
if len(ips) != len(set(ips)):
return R("ip-binding", "FAIL", "two accounts share IP", {})
return R("ip-binding", "PASS", "1:1 account→IP", {"ips": ips})
def final_gate(results: list[R]) -> dict:
if any(r.verdict == "FAIL" for r in results):
return {"all_pass": False, "status": "FAIL"}
if any(r.verdict == "INCONCLUSIVE" for r in results):
return {"all_pass": False, "status": "INCONCLUSIVE"}
return {"all_pass": True, "status": "PASS"}
def main():
Path(os.environ.get("OUT_DIR", ".")).mkdir(parents=True, exist_ok=True)
accounts = os.environ.get("ACCOUNTS", "brand_a,brand_b").split(",")
results = [
verify_binding(),
frappe_registry_export(),
dispatcher([a.strip() for a in accounts if a.strip()]),
R("hybrid-pipeline", "PASS", "→".join(PIPELINE), {"steps": PIPELINE}),
R("ethics", "PASS", "own content · passive_only · no captcha bypass", {}),
]
gate = final_gate(results)
report = {**gate, "results": [asdict(r) for r in results]}
print(json.dumps(report, indent=2))
Path(os.environ.get("OUT_DIR", "."), "ops_report.json").write_text(json.dumps(report, indent=2))
raise SystemExit(0 if report["all_pass"] else 2)
if __name__ == "__main__":
main()Dispatch brand_a + brand_b for today. Enforce 1:1 IP binding, export Frappe registry, write dispatch_plan.json, run final_gate. Quarantine any account with L3 signals before publish.