#18522 · @DroganC · opened Mar 21, 2026 at 12:56 PM UTC · last updated Mar 21, 2026 at 12:56 PM UTC
feat: offline web static serve
Score breakdown
Impact
Clarity
Urgency
Ease Of Review
Guidelines
Readiness
Size
Trust
Traction
Summary
This PR introduces a feature to allow the OpenCode web UI to be served offline from a local build, enabling use in air-gapped environments. It modifies the server to prioritize local dist files and updates UI asset paths to support offline functionality. A new OFFLINE_WEB.md document provides comprehensive setup and troubleshooting instructions.
Description
Issue for this PR
Closes #
Type of change
- [ ] Bug fix
- [X] New feature
- [ ] Refactor / code improvement
- [ ] Documentation
What does this PR do?
Provided a solution for building an open code web within an internal network; Opencode web serves the browser UI by proxying to https://app.opencode.ai when no API route matches. On machines without outbound access to that host, the UI never loads.
If you paste a large clearly AI generated description here your PR may be IGNORED or CLOSED!
How did you verify your code works?
Changes:
packages/opencode/src/server/server.ts— Ifpackages/app/dist/index.htmlexists (orOPENCODE_APP_DISTpoints at a directory that contains it), serve files from that directory with the same SPA fallback as before (unknown paths →index.html). Otherwise keep the existing proxy behavior.Flag.OPENCODE_APP_DISTinpackages/opencode/src/flag/flag.ts— Documents and centralizes the env var used for the absolute path override.- One log line when local dist is used (
serving web UI from local distwithroot) so operators can confirm the proxy is not in use. packages/app— Changelog fetch uses/changelog.json(frompublic/after build); notification and project avatar use same-origin favicon paths instead ofhttps://opencode.ai/..., so those requests stay on the server.docs/OFFLINE_WEB.md(English) — How to buildpackages/app, which env vars matter, and troubleshooting.CONTRIBUTING.md— Short subsection linking to that doc.
Screenshots / recordings
If this is a UI change, please include a screenshot or recording.
Checklist
- [X] I have tested my changes locally
- [X] I have not included unrelated changes in this PR
If you do not follow this template your PR will be automatically rejected.
Linked Issues
None.
Comments
No comments.
Changed Files
.gitignore
+3−0CONTRIBUTING.md
+4−0docs/OFFLINE_WEB.md
+82−0packages/app/public/changelog.json
+1−0packages/app/src/components/dialog-connect-provider.tsx
+1−1packages/app/src/components/dialog-custom-provider.tsx
+1−1packages/app/src/context/highlights.tsx
+1−1packages/app/src/entry.tsx
+1−1packages/app/src/pages/layout/sidebar-items.tsx
+1−1packages/opencode/src/cli/cmd/tui/component/dialog-provider.tsx
+1−1packages/opencode/src/flag/flag.ts
+2−0packages/opencode/src/server/server.ts
+40−6