diff --git a/README.md b/README.md index 6421144..8595f4a 100644 --- a/README.md +++ b/README.md @@ -103,6 +103,8 @@ chmod +x install.sh && ./install.sh ## πŸ“‹ Prerequisites +### Linux/macOS + | Tool | Required? | Install | |------|-----------|---------| | Python 3.10+ | βœ… Required | Linux/macOS: install from your package manager or `python.org`. Windows: install from `python.org` and select **Add Python to PATH**. Verify with `python --version` or `py -3 --version`. | @@ -111,6 +113,16 @@ chmod +x install.sh && ./install.sh | Hermes Agent | ⚠ For memory/scheduling | `curl -fsSL https://raw.githubusercontent.com/NousResearch/hermes-agent/main/scripts/install.sh \| bash` | | Gemini CLI | ⚠ For Google AI | `npm install -g @google/gemini-cli` | +### Windows + +| Tool | Required? | Install | Verify / Next Step | +|------|-----------|---------|--------------------| +| Python 3.10+ | βœ… Required | Install from [python.org/downloads/windows](https://www.python.org/downloads/windows/) and enable **β€œAdd python.exe to PATH”** during setup. | `python --version` | +| Node.js 18+ | ⚠ For opencode and Gemini CLI | Install from [nodejs.org](https://nodejs.org/). | `node --version` and `npm --version` | +| opencode | ⚠ For code tasks | `npm install -g @opencode/cli` | Confirm the CLI is available in a new terminal session. | +| Gemini CLI | ⚠ For Google AI | `npm install -g @google/gemini-cli` | Run `gemini auth login` and complete OAuth in the browser. | +| Hermes Agent | ⚠ For memory/scheduling | Windows support must be verified separately if the upstream installer remains Bash-only. | Check the upstream Hermes Agent install docs before relying on native Windows support. | + > ⚠ = Optional β€” the dashboard works with any subset of installed agents. ### Windows Quick Start @@ -124,6 +136,7 @@ cd agentic-os ``` The PowerShell launchers resolve Python in this order: `py -3.10`, `py -3`, then `python`. For manual commands, prefer `python -m pip install -r requirements.txt` and `python server.py --port 8080` so the same interpreter runs both dependency installation and the server. +> **PowerShell execution policy:** if you use PowerShell scripts, allow local scripts for your user with `Set-ExecutionPolicy -Scope CurrentUser RemoteSigned`, or run a single installer invocation with `powershell -ExecutionPolicy Bypass -File .\install.ps1`. --- diff --git a/server.py b/server.py index ca97124..839da22 100644 --- a/server.py +++ b/server.py @@ -21,6 +21,8 @@ from fastapi.responses import HTMLResponse, JSONResponse, Response from fastapi.staticfiles import StaticFiles from pydantic import BaseModel +BASE_DIR = Path(__file__).parent.resolve() + app = FastAPI(title="Agentic OS", version="1.1.0") # Load OpenRouter API key from Hermes .env @@ -33,16 +35,44 @@ if HERMES_ENV.exists(): if k == "OPENROUTER_API_KEY": os.environ[k] = v # last value wins (matches shell sourcing) +def get_cors_origins() -> list[str]: + """Return local dashboard origins allowed to call the API.""" + port = 8080 + settings_file = BASE_DIR / "data" / "settings.json" + + if settings_file.exists(): + try: + settings = json.loads(settings_file.read_text(encoding="utf-8")) + port = int(settings.get("dashboard", {}).get("port", port)) + except (json.JSONDecodeError, OSError, TypeError, ValueError): + port = 8080 + + origins = { + "http://127.0.0.1:8080", + "http://localhost:8080", + f"http://127.0.0.1:{port}", + f"http://localhost:{port}", + } + + extra_origins = os.environ.get("AGENTIC_OS_CORS_ORIGINS", "") + origins.update( + origin.strip() + for origin in extra_origins.split(",") + if origin.strip() + ) + + return sorted(origins) + + # CORS for local dev app.add_middleware( CORSMiddleware, - allow_origins=["http://127.0.0.1:8080", "http://localhost:8080"], + allow_origins=get_cors_origins(), allow_credentials=True, allow_methods=["*"], allow_headers=["*"], ) -BASE_DIR = Path(__file__).parent.resolve() # ─── Models ───────────────────────────────────────────────────────