Conversation
- 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
Made-with: Cursor
|
Hey! Your PR title Please update it to start with one of:
Where See CONTRIBUTING.md for details. |
|
This PR doesn't fully meet our contributing guidelines and PR template. What needs to be fixed:
Please edit this PR description to address the above within 2 hours, or it will be automatically closed. If you believe this was flagged incorrectly, please let a maintainer know. |
|
The following comment was made by an LLM, it may be inaccurate: Based on my search, I found 2 potentially related PRs that address similar functionality: Potential Duplicates:
These PRs should be reviewed to ensure PR #18508 doesn't duplicate work or conflicts with existing approaches. |
Issue for this PR
Closes #ISSUE_NUMBER
Type of change
What does this PR do?
Problem:
opencode webserves the browser UI by proxying tohttps://app.opencode.aiwhen no API route matches. On machines without outbound access to that host, the UI never loads.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.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.Why it works: The Vite production bundle is static files. Serving them from the same process that hosts the API avoids any dependency on
app.opencode.aifor HTML/JS/CSS. The API routes are unchanged and still registered before the catch-all.How did you verify your code works?
bun run buildinpackages/appsodist/index.htmlexists.OPENCODE_APP_DISTset to thatdistpath (or rely on default path frompackages/opencode), thenbun run --conditions=browser ./src/index.ts webfrompackages/opencode.http://127.0.0.1:4096and the server logsserving web UI from local distonce.distremoved or renamed, confirmed fallback still proxies (when network allows) so default behavior is preserved.Screenshots / recordings
Optional: browser showing the app loaded from localhost while offline (no change to core UI layout intended).
Checklist