feat(web): add OPENCODE_APP_DIST for remote/offline access #6218
+318
−7
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Adds
OPENCODE_APP_DISTenv var to serve the web UI locally instead of proxying to app.opencode.ai.Fixes blank page when accessing
opencode webremotely (Tailscale, LAN, mobile) - the proxied JS tries to connect tolocalhost:4096which doesn't exist on the remote device.Also enables full offline capability.
Why it works
The default proxy to app.opencode.ai keeps the CLI lean and allows UI updates without CLI releases. But the hosted JS assumes localhost access, which breaks remote use and requires internet connectivity.
When serving locally via
OPENCODE_APP_DIST:location.hostname= your actual host (e.g.,192.168.1.xor Tailscale hostname)window.location.originopencode web, so it just worksUsage
Port 7625 is arbitrary - use any available port. Access via
http://<tailscale-hostname>:<port>orhttp://<lan-ip>:<port>.Default behavior unchanged - still proxies unless env var is set.
Changes
server.ts- local SPA serving whenOPENCODE_APP_DISTis set.gitignore- ignore.hive/directorytest/server/- tests for health endpoints and app-dist serving