Skip to content

feat: offline web static serve#18522

Open
DroganC wants to merge 5 commits intoanomalyco:devfrom
DroganC:dev
Open

feat: offline web static serve#18522
DroganC wants to merge 5 commits intoanomalyco:devfrom
DroganC:dev

Conversation

@DroganC
Copy link

@DroganC DroganC commented Mar 21, 2026

Issue for this PR

Closes #

Type of change

  • Bug fix
  • 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:

  1. packages/opencode/src/server/server.ts — If packages/app/dist/index.html exists (or OPENCODE_APP_DIST points 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.
  2. Flag.OPENCODE_APP_DIST in packages/opencode/src/flag/flag.ts — Documents and centralizes the env var used for the absolute path override.
  3. One log line when local dist is used (serving web UI from local dist with root) so operators can confirm the proxy is not in use.
  4. packages/app — Changelog fetch uses /changelog.json (from public/ after build); notification and project avatar use same-origin favicon paths instead of https://opencode.ai/..., so those requests stay on the server.
  5. docs/OFFLINE_WEB.md (English) — How to build packages/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

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

If you do not follow this template your PR will be automatically rejected.

chenlong added 5 commits March 21, 2026 17:24
- Add OPENCODE_APP_DIST and fallback to packages/app/dist when index.html exists
- Fall back to app.opencode.ai proxy when no local build
- Use same-origin changelog and favicon assets in the app
- Document env vars and workflow in docs/OFFLINE_WEB.md
- Ignore offline/ for local models-api.json mirrors

Made-with: Cursor
- Document OPENCODE_APP_DIST in Flag; log once when serving local dist
- Rewrite OFFLINE_WEB.md in English; note issue-first policy for PRs
- Link air-gapped web flow from CONTRIBUTING.md

Made-with: Cursor
Fixes @opencode-ai/app typecheck for dialog-connect-provider and dialog-custom-provider.

Add docs/PR_BODY_offline_web.md as PR description draft for offline web PR.

Made-with: Cursor
@DroganC DroganC requested a review from adamdotdevin as a code owner March 21, 2026 12:56
@github-actions
Copy link
Contributor

The following comment was made by an LLM, it may be inaccurate:

Potential Duplicate PRs Found

  1. feat(server): embed web UI assets in binary and serve locally #15721 - feat(server): embed web UI assets in binary and serve locally

    • Addresses a similar problem: serving web UI locally without external proxy dependency
    • May have already tackled the offline web serving pattern
  2. feat: add offline mode to disable non-essential outbound connections #18235 - feat: add offline mode to disable non-essential outbound connections

    • Related feature: offline mode support
    • Could overlap with the offline serving approach
  3. feat(server): support OPENCODE_WEB_URL for local frontend serving #17104 - feat(server): support OPENCODE_WEB_URL for local frontend serving

Recommendation: Review #15721, #17104, and #18235 for overlap before merging #18522. These PRs appear to address similar offline/local serving scenarios.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant