diff --git a/docs/README.md b/docs/README.md index bbefb68..4902f6e 100644 --- a/docs/README.md +++ b/docs/README.md @@ -36,9 +36,9 @@ cd ~/agentic-os ``` **URLs:** -- Dashboard: `http://127.0.0.1:8081` +- Dashboard: `http://127.0.0.1:8080` - Web Terminal: `http://127.0.0.1:8082` (WebSocket) -- API Base: `http://127.0.0.1:8081/api/` +- API Base: `http://127.0.0.1:8080/api/` --- @@ -170,7 +170,7 @@ Via the dashboard: **Agent Health** → **+ Add Agent** Or via API: ```bash -curl -X POST http://127.0.0.1:8081/api/agents/register \ +curl -X POST http://127.0.0.1:8080/api/agents/register \ -H "Content-Type: application/json" \ -d '{ "name": "my-llm", @@ -191,7 +191,7 @@ Via the dashboard: **Agent Health** → click **Remove** on any custom agent. Or via API: ```bash -curl -X DELETE http://127.0.0.1:8081/api/agents/my-llm +curl -X DELETE http://127.0.0.1:8080/api/agents/my-llm ``` Built-in agents cannot be removed. @@ -572,7 +572,7 @@ cp -r skills/_template skills/my-skill ```python # In server.py, add to BUILTIN_AGENTS dict, or use the API: -curl -X POST http://127.0.0.1:8081/api/agents/register \ +curl -X POST http://127.0.0.1:8080/api/agents/register \ -H "Content-Type: application/json" \ -d '{"name":"my-agent","binary":"my-binary","type":"cli"}' ``` @@ -595,7 +595,7 @@ curl -X POST http://127.0.0.1:8081/api/agents/register \ ### Server Lifecycle ```bash -./start.sh # Start (port 8081 + terminal on 8082) +./start.sh # Start (dashboard port from data/settings.json, default 8080) ./start.sh --open # Start + open browser ./start.sh --stop # Stop ./start.sh --status # Check if running diff --git a/scheduler/scheduler.py b/scheduler/scheduler.py index d7ca2b5..da68582 100644 --- a/scheduler/scheduler.py +++ b/scheduler/scheduler.py @@ -31,7 +31,14 @@ import urllib.error BASE_DIR = Path(__file__).parent.resolve() JOBS_DIR = BASE_DIR / "jobs" # Server URL — same host, main API port. Override with AGENTIC_OS_URL env. -SERVER_URL = "http://127.0.0.1:8080" +# Server URL — read the canonical port from settings.json so there is a +# single source of truth (launchers + server + scheduler all agree). +try: + _SET = json.loads(Path(__file__).parent.parent.joinpath("data", "settings.json").read_text(encoding="utf-8")) + _PORT = int(_SET.get("dashboard", {}).get("port", 8080)) +except Exception: + _PORT = 8080 +SERVER_URL = f"http://127.0.0.1:{_PORT}" RUN_TIMEOUT = 300 # seconds per skill run diff --git a/server.py b/server.py index 6f36946..f606b3f 100644 --- a/server.py +++ b/server.py @@ -2810,14 +2810,24 @@ if __name__ == "__main__": import uvicorn + # Single source of truth: the dashboard port lives in data/settings.json. + # Read it here so `--port` defaults to it (launchers, scheduler, docs all agree). + _settings_port = 8080 + try: + _sf = BASE_DIR / "data" / "settings.json" + if _sf.exists(): + _settings_port = int(json.loads(_sf.read_text(encoding="utf-8")).get("dashboard", {}).get("port", 8080)) + except Exception: + _settings_port = 8080 + parser = argparse.ArgumentParser() - parser.add_argument("--port", type=int, default=8081) + parser.add_argument("--port", type=int, default=_settings_port) parser.add_argument("--host", type=str, default="0.0.0.0") args = parser.parse_args() # ── Double-launch guard ─────────────────────────────────────────── # Refuse to start if the API port is already bound by another process. - # Without this, two server.py instances collide on 8081 (and 8082), + # Without this, two server.py instances collide on the API port (default 8080), # producing phantom "register doesn't persist" bugs and bind crashes. probe = socket.socket(socket.AF_INET, socket.SOCK_STREAM) try: diff --git a/start-agentic-os.sh b/start-agentic-os.sh index 6274080..96f15bb 100755 --- a/start-agentic-os.sh +++ b/start-agentic-os.sh @@ -9,7 +9,7 @@ DIR="/home/austin/agentic-os" LOG="/tmp/agentic-os.log" PIDFILE="$DIR/.agentic-os.pid" HOST="0.0.0.0" -PORT="8080" +PORT="$(python3 -c "import json;print(json.load(open('data/settings.json')).get('dashboard',{}).get('port',8080))" 2>/dev/null || echo 8080)" # Already serving? Then do nothing (idempotent). if ss -ltn 2>/dev/null | grep -q ":$PORT "; then diff --git a/start.sh b/start.sh index e296845..1322646 100755 --- a/start.sh +++ b/start.sh @@ -7,7 +7,7 @@ set -euo pipefail -PORT="${PORT:-8081}" +PORT="${PORT:-$(python3 -c "import json;print(json.load(open('data/settings.json')).get('dashboard',{}).get('port',8080))" 2>/dev/null || echo 8080)}" PID_FILE=".agentic-os.pid" DASHBOARD_URL="http://127.0.0.1:${PORT}"