INNER CODE UNIT · Python
_write_discovery
AIScientists-Dev/WorldSeed · src/worldseed/server/app.py:24
def _write_discovery(port: int) -> None:
"""Write server.json so the OpenClaw plugin can auto-discover us."""
from worldseed.server.routes._shared import DEFAULT_GATEWAY_TOKEN
df = discovery_file()
df.parent.mkdir(parents=True, exist_ok=True)
df.write_text(
json.dumps(
{
"url": f"ws://localhost:{port}/ws",
"token": DEFAULT_GATEWAY_TOKEN,
"pid": os.getpid(),
}
)
)
def _remove_discovery() -> None: