diff --git a/README.md b/README.md index 12a40a7..c7b5044 100644 --- a/README.md +++ b/README.md @@ -16,22 +16,20 @@ - The container runs a wrapper web server. - The wrapper protects `/setup` with `SETUP_PASSWORD`. -- During setup, the wrapper runs `openclaw onboard ...` inside the container, writes state to the volume, and then starts the gateway. API-key providers use non-interactive setup; ChatGPT/Codex and xAI/Grok device pairing use OpenClaw's interactive device-code flows so the login URL and code can be streamed to `/setup`. +- During setup, the wrapper runs `openclaw onboard ...` inside the container, writes state to the volume, and then starts the gateway. API-key providers use non-interactive setup. Interactive device-code logins (ChatGPT/Codex, xAI/Grok) can't run from the web wizard — complete those by running `openclaw wizard` in the Railway console. - After setup, **`/` is OpenClaw**. The wrapper reverse-proxies all traffic (including WebSockets) to the local gateway process. ## Getting chat tokens (so you don't have to scramble) -### ChatGPT / OpenAI Codex login +### ChatGPT / OpenAI Codex and Grok / xAI subscription login -In `/setup`, choose **OpenAI → OpenAI Codex device pairing**. Setup will stream a ChatGPT/Codex URL and a short device code; open the URL in your browser, enter the code, and keep the setup page open until OpenClaw finishes saving the OAuth profile. +These providers use an interactive device-code login that the web `/setup` wizard can't drive. Complete them from the Railway console instead: -This uses OpenClaw's `openai-codex-device-code` onboarding flow, so you do not need to paste an OpenAI API key. +1. Open your service in Railway and launch the **console** (a shell inside the running container). +2. Run `openclaw wizard` and follow the prompts. Choose the ChatGPT/Codex or xAI/Grok device login, open the URL it prints in your browser, and enter the short code. +3. Once the wizard finishes saving the OAuth profile, return to `/setup` — the instance will be configured and the gateway will start. -### Grok / xAI subscription login - -In `/setup`, choose **xAI (Grok) → xAI device code**. Setup will stream an xAI URL and a short device code; open the URL in your browser, enter the code, and keep the setup page open until OpenClaw finishes saving the OAuth profile. - -This uses OpenClaw's `xai-device-code` onboarding flow, so you can use an eligible SuperGrok or X Premium subscription without pasting an xAI API key. +This lets you use a ChatGPT/Codex account or an eligible SuperGrok / X Premium subscription without pasting an API key. ### Telegram bot token diff --git a/package.json b/package.json index ee7c6e1..1559bee 100644 --- a/package.json +++ b/package.json @@ -13,10 +13,6 @@ }, "dependencies": { "express": "^5.1.0", - "http-proxy": "^1.18.1", - "node-pty": "^1.0.0" - }, - "pnpm": { - "onlyBuiltDependencies": ["node-pty"] + "http-proxy": "^1.18.1" } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 2406e98..3b7417e 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -14,9 +14,6 @@ importers: http-proxy: specifier: ^1.18.1 version: 1.18.1 - node-pty: - specifier: ^1.0.0 - version: 1.1.0 packages: @@ -199,12 +196,6 @@ packages: resolution: {integrity: sha512-8Ofs/AUQh8MaEcrlq5xOX0CQ9ypTF5dl78mjlMNfOK08fzpgTHQRQPBxcPlEtIw0yRpws+Zo/3r+5WRby7u3Gg==} engines: {node: '>= 0.6'} - node-addon-api@7.1.1: - resolution: {integrity: sha512-5m3bsyrjFWE1xf7nz7YXdN4udnVtXK6/Yfgn5qnahL6bCkf2yKt4k3nuTKAtT4r3IG8JNR2ncsIMdZuAzJjHQQ==} - - node-pty@1.1.0: - resolution: {integrity: sha512-20JqtutY6JPXTUnL0ij1uad7Qe1baT46lyolh2sSENDd4sTzKZ4nmAFkeAARDKwmlLjPx6XKRlwRUxwjOy+lUg==} - object-inspect@1.13.4: resolution: {integrity: sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==} engines: {node: '>= 0.4'} @@ -490,12 +481,6 @@ snapshots: negotiator@1.0.0: {} - node-addon-api@7.1.1: {} - - node-pty@1.1.0: - dependencies: - node-addon-api: 7.1.1 - object-inspect@1.13.4: {} on-finished@2.4.1: diff --git a/src/public/setup.html b/src/public/setup.html index 9a8bef9..7d3c2df 100644 --- a/src/public/setup.html +++ b/src/public/setup.html @@ -29,9 +29,6 @@ slackAppToken: '', model: '', log: '', - loginUrl: '', - loginCode: '', - loginLabel: 'Device Login', setupError: '', setupStreamTail: '', loading: false, @@ -71,15 +68,17 @@ ].includes(this.selectedAuth); }, + get isDeviceCode() { + return [ + 'openai-codex', + 'openai-codex-device-code', + 'xai-device-code' + ].includes(this.selectedAuth); + }, + get authGuidance() { - if (this.selectedAuth === 'openai-codex-device-code') { - return 'Run setup, then open the ChatGPT/Codex URL and enter the device code shown in the log.'; - } - if (this.selectedAuth === 'xai-device-code') { - return 'Run setup, then open the xAI URL and enter the device code shown in the log. Use an eligible SuperGrok or X Premium account.'; - } - if (this.selectedAuth === 'openai-codex') { - return 'Browser login needs an interactive terminal to paste the redirect URL. Device pairing is recommended here.'; + if (this.isDeviceCode) { + return 'This login uses an interactive device-code flow that the web setup can\'t run. Open the Railway console and run `openclaw wizard` to complete it, then return here.'; } if (!this.authRequiresSecret) { return 'No API key is needed for this auth method.'; @@ -137,9 +136,10 @@ }, async runSetup() { - this.loginUrl = ''; - this.loginCode = ''; - this.loginLabel = this.loginLabelForAuth(this.selectedAuth); + if (this.isDeviceCode) { + this.setupError = 'This login must be completed from the Railway console with `openclaw wizard`.'; + return; + } this.setupError = ''; this.setupStreamTail = ''; const payload = { @@ -200,28 +200,9 @@ this.log += chunk; const scanText = this.setupStreamTail + chunk; this.setupStreamTail = scanText.slice(-1000); - this.extractLoginDetails(scanText); this.extractSetupFailure(scanText); }, - extractLoginDetails(text) { - const urlMatch = text.match(/https:\/\/auth\.openai\.com\/codex\/device[^\s)]*/) - || text.match(/\bURL:\s*(https:\/\/(?:auth|accounts)\.x\.ai\/[^\s)]*)/) - || text.match(/\bOpen(?: manually)?:\s*(https:\/\/(?:auth|accounts)\.x\.ai\/[^\s)]*)/); - if (urlMatch) this.loginUrl = urlMatch[0]; - if (urlMatch && urlMatch[1]) this.loginUrl = urlMatch[1]; - - const codeMatches = [...text.matchAll(/\bCode:\s*([A-Z0-9][A-Z0-9-]{3,})\b/g)]; - const visibleCode = codeMatches.map(m => m[1]).find(code => code !== 'shown'); - if (visibleCode) this.loginCode = visibleCode; - }, - - loginLabelForAuth(auth) { - if (auth === 'xai-device-code') return 'xAI Login'; - if (auth === 'openai-codex-device-code') return 'ChatGPT Login'; - return 'Device Login'; - }, - extractSetupFailure(text) { if (text.includes('[setup] Internal error')) { this.setupError = 'Setup hit an internal error. Review the log below.'; @@ -856,8 +837,14 @@ openclaw models set anthropic/claude-sonnet-4-20250514 +
openclaw wizard to
+ complete it, then return here. Pick a different auth method to continue in the wizard.
+