| 242 | } |
| 243 | |
| 244 | function showHelp() { |
| 245 | console.log(` |
| 246 | Combined static file server + reverse proxy. |
| 247 | |
| 248 | USAGE: |
| 249 | node scripts/static-server.mjs [options] |
| 250 | |
| 251 | OPTIONS: |
| 252 | -p, --port <port> Port to bind (default: 3001) |
| 253 | -H, --host <host> Hostname to bind (default: 127.0.0.1 loopback). |
| 254 | Use 0.0.0.0 or :: to expose on the LAN; the |
| 255 | session key is then not injected unless you also |
| 256 | pass --allow-lan-session-key. |
| 257 | -d, --dir <dir> Directory to serve (default: build) |
| 258 | -r, --route <prefix=url> Proxy <prefix> (and subpaths) to <url>; |
| 259 | may be repeated. WebSockets supported. |
| 260 | --session-api-key <key> Inject session API key into index.html so the |
| 261 | pre-built frontend authenticates to agent-server |
| 262 | without needing VITE_SESSION_API_KEY baked in. |
| 263 | Alternatively set SESSION_API_KEY env var (not |
| 264 | shown in process listings), which is preferred on |
| 265 | shared hosts. |
| 266 | --auth-required Inject authRequired flag into index.html so the |
| 267 | pre-built frontend shows the API key entry screen |
| 268 | (public mode) without VITE_AUTH_REQUIRED baked in. |
| 269 | --allow-lan-session-key Permit --session-api-key when --host is not |
| 270 | loopback (Docker/container entrypoints only). |
| 271 | --runtime-services-info <json> |
| 272 | Inject a JSON description of the local runtime |
| 273 | services into index.html so the pre-built |
| 274 | frontend can populate the agent's |
| 275 | <RUNTIME_SERVICES> system-prompt block without |
| 276 | VITE_RUNTIME_SERVICES_INFO baked in. |
| 277 | --lock-to-cloud <cloud-url> Lock backend setup to a single OpenHands Cloud |
| 278 | URL. Hides manual/local backend setup and the |
| 279 | custom Cloud URL field in the pre-built frontend. |
| 280 | --disable-telemetry Disable all product telemetry (including the |
| 281 | anonymous install event) in the pre-built |
| 282 | frontend at runtime, without VITE_DO_NOT_TRACK |
| 283 | baked in. Injects |
| 284 | window.__AGENT_CANVAS_DO_NOT_TRACK__ = true. |
| 285 | Equivalent to AGENT_CANVAS_DISABLE_TELEMETRY=1. |
| 286 | --base-path <path> Mount the SPA under <path> (default: /). |
| 287 | For example, --base-path /canvas serves |
| 288 | index.html and assets under /canvas. |
| 289 | --vscode-base-path <path> Advertise to the frontend that this origin |
| 290 | serves the editor under <path>, so the editor |
| 291 | control renders here. Requires a matching |
| 292 | --route; the server refuses to start otherwise, |
| 293 | since advertising a prefix it does not route |
| 294 | produces a control that opens the SPA. Omit on |
| 295 | any origin without the editor route. |
| 296 | --reject-prefix <prefix> Return 503 for requests matching <prefix> |
| 297 | --no-referrer-prefix <p> Send "Referrer-Policy: no-referrer" on proxied |
| 298 | responses under <p>. For upstreams whose URL |
| 299 | carries a credential in the query string. |
| 300 | instead of SPA-fallbacking to index.html; |
| 301 | may be repeated. Useful in --frontend-only |