Skip to content

About

No description, website, or topics provided.

Resources

Stars

8 stars

Watchers

1 watching

Forks

 
 

Repository files navigation

OpenCode Web Panel

OpenCode Web Panel on JetBrains Marketplace
OpenCode Web Panel on JetBrains Marketplace
Embed OpenCode inside JetBrains IDEs.

JetBrains Marketplace version JetBrains Marketplace downloads JetBrains Marketplace rating

OpenCode Web Panel running inside a JetBrains IDE

OpenCode Web Panel brings the official OpenCode web UI into JetBrains IDEs. Use it in a right-side tool window or move the live panel into an editor tab. It stays focused on the project you are working on and adds small IDE conveniences on top of the normal OpenCode experience. Host CLI and Docker Sandbox work with OpenCode 1.x (1.18+) and CLI 2.x; sandboxes use Docker's published OpenCode kits.

Note: This is an unofficial community plugin for OpenCode and is not affiliated with OpenCode.

Why use it

  • OpenCode where you code - Use OpenCode beside your editor instead of switching to the terminal, desktop app, or standalone web app.
  • Official web UI - The embedded panel loads OpenCode's own web app, so the core experience stays familiar.
  • Project-aware sessions - OpenCode starts on the directory configured for the current IDE project.
  • Optional Docker Sandboxes - Run OpenCode inside a per-project Docker Sandbox (sbx) instead of a host opencode serve. Native CLI remains the default.
  • IDE file navigation - Click local file links and code references from chat to open them in the IDE.
  • Chat file drop and paste - Drag or paste project files into chat as @relative/path references, or attach dropped files.
  • Send code to chat - Add files or the current selection to the OpenCode chat from the editor and project view context menus.
  • External links stay outside - HTTP links open in your system browser instead of taking over the panel.
  • IDE notifications - OpenCode browser notifications can appear as JetBrains IDE notifications, including Allow/Deny actions for agent permission requests.
  • Agent status at a glance - The tool window icon shows when the agent is working or waiting for your input.
  • Optional workspace warning - Opt in to an IDE warning when a selected conversation belongs to a different directory than this project.
  • Tool window or editor tab - Move the same live panel between hosts without reloading or losing an unsent draft. Zoom, restart, and other controls are available in both.
  • Recovery built in - Failed or crashed servers surface a clear error panel with recent logs, retry, and settings shortcuts, and the panel recovers automatically where possible.
  • Configurable safeguards - Browser-side convenience features can be disabled if an OpenCode update conflicts with them.

Requirements

  • A JetBrains IDE compatible with this plugin.
  • The OpenCode CLI installed on your machine (Host runtime, the default): 1.x (1.18+) or CLI 2.x.
  • The opencode command available on PATH, or configured manually in the plugin settings.
  • Optional: Docker Sandboxes (sbx 0.51.0 or later) and a Docker account when Runtime is set to Docker Sandbox.

Installation

Getting Started

  1. Install the OpenCode CLI.
  2. Open a project in your JetBrains IDE.
  3. Click the OpenCode tool window on the right sidebar.
  4. Start using OpenCode in the embedded panel.

The plugin starts a local OpenCode server when needed, authenticates the embedded web UI automatically, and opens the configured project directory.

Panel Controls

The tool window title bar and editor toolbar offer quick controls (also available in their gear menus on narrow panels):

  • Zoom out / Zoom in - Scale the embedded OpenCode UI in 10% steps without reloading. Cmd/Ctrl with +, -, and 0 work inside the panel too.
  • Reload Page - Reload the embedded OpenCode UI. The server stays running.
  • Move to Editor / Move to Tool Window - Move the live panel without reloading. The current session, draft, and browser state stay intact.
  • Restart Server - Stop and restart this project's OpenCode server, and recreate the embedded browser in its current host. Recovers a stuck or crashed panel. Also on OpenCode Web Panel | This Project, where it reads Start Server while the server is stopped.
  • The gear menu additionally offers Reset Zoom, View Server Log, and OpenCode Web Panel Settings.

OpenCode in the Editor

Choose Move to Editor from the panel title bar or gear menu. The editor tab can move between splits and IDE windows like other tabs; each project keeps one live OpenCode panel. Closing the tab returns that panel to the tool window without stopping the server. Choose Move to Tool Window to return and show it immediately.

Closing a project window also leaves its server running until it is explicitly stopped or the IDE exits. Server ownership is application-wide, so reopening the project can reuse it.

Use Find Action → Move OpenCode Panel to toggle between the two hosts. To assign a keyboard shortcut, open Settings/Preferences → Keymap and search for Move OpenCode Panel. No shortcut is assigned by default.

While the panel is in an editor, clicking the OpenCode tool window icon returns to that editor instead of opening the side panel; use Move to Tool Window in the editor toolbar to bring the panel back. Chat context actions and Show in OpenCode notifications activate the current host.

Context Menu Actions

  • Add to OpenCode Chat (project view, editor tabs) - Insert @path references for the selected project files into the chat.
  • Add Selection to OpenCode Chat (editor) - Insert the file reference plus the selected lines as a code snippet.

Both actions activate the panel wherever it is currently placed and deliver the input once OpenCode has finished loading. They follow the Drop and paste files into chat setting.

Settings

Open Settings/Preferences > Tools > OpenCode Web Panel. It has three tabs; the settings of the open project are one level below, under This Project.

Server

  • OpenCode Executable: Auto detect or a Custom path. The setting shows the executable a start would use and its version, or what is wrong.
  • Authentication: edit, generate, show, or copy the local server password stored in IntelliJ Password Safe.
  • HTTP Proxy: how the Host CLI reaches the network: the IDE HTTP Proxy, environment variables, or no proxy.
  • Startup and Logs: wait briefly for the IntelliJ MCP server before starting OpenCode; write server logs to disk.
  • Updates: an optional lightning-bolt action indicates a newer same-major OpenCode release. Click it to upgrade a sandbox or view a copyable Host CLI upgrade command. For a 2.x sandbox it also checks Docker's OpenCode image and offers Reset Sandbox when that image is newer.
  • Changing the password, an executable, or the proxy restarts the OpenCode servers that are running or starting; Apply asks first. A stopped server uses the new settings at its next start.

Panel

Most of these options change OpenCode's page in the panel. If one clashes with an OpenCode update, turn it off: the page reloads without it. Restore defaults resets this tab.

  • Appearance: zoom; keep the compact (mobile) layout at any panel width, with a full-width Home session list in OpenCode 2.x; show agent and model on responses in the compact layout, which OpenCode 2 otherwise omits; hide OpenCode's floating website button; show path previews faster; match OpenCode's color scheme to the IDE theme; show the page's mouse cursors.
  • Navigation and Input: open file links in the IDE, optionally also file, class, and code references in chat; open diffs in the IDE with Ctrl/Cmd+Click or Alt+Click; open web links in the system browser; drop and paste files into chat, using @relative/path for project files.
  • Notifications and Status: show OpenCode notifications in the IDE, optionally with Allow and Deny buttons on permission requests; show agent status on the tool window icon; hide prompts to switch to another session or project; warn when a conversation belongs to another folder or workspace (off by default).
  • Recovery: continue interrupted conversations after a restart; reconnect after sleep or a network change (OpenCode 1.x); reload the page when part of it fails to load; reload the panel when the embedded browser stops responding.

Docker Sandboxes

  • sbx Executable: Auto detect or a Custom path, with the version found. Docker Sandboxes need sbx 0.51.0 or later.
  • Sign-In: sign in once with sbx login in a terminal.
  • Network Policy: shows whether this computer has a sandbox network policy, checked live, and sets up Docker's balanced default when asked. The plugin never changes an existing policy.

This Project

Settings for the open project, stored with it. Apply asks before it recreates the sandbox, restarts or starts OpenCode, or gives the sandbox new access; other changes apply without a prompt.

  • OpenCode directory: Auto detect opens the IDE project root; Custom directory points OpenCode at another directory, such as a monorepo root or a subproject.
  • Runtime: Host CLI or Docker Sandbox, stored in opencode-sbx/opencode-sbx.yaml (source of truth; the panel hydrates from it). Choosing Docker Sandbox shows whether this computer has a recent enough sbx and a network policy. Apply also writes opencode-sbx/opencode-sbx.sh: run it with no arguments for the TUI, --web for the published browser server, or acp for ACP stdio, without the plugin. On Windows, run the .sh from Git Bash.
  • Server: this project's status, Start Server / Restart Server, View Server Log, and for sandboxes Upgrade OpenCode and Reset Sandbox…. Let OpenCode select a port automatically, or set a fixed port. Host CLI binds that loopback port; Docker Sandbox republishes VM 4096 to it without recreating the sandbox.
  • During startup/restart, the waiting view explains the current step and streams recent command output. Image downloads and kit installation can take several minutes. Elapsed time belongs to the current attempt, and a quiet step offers log/cancel guidance rather than an estimated countdown. Recent activity is available even with file logging disabled.

Docker Sandbox

  • For monorepos, keep the project directory on the repository root and set Working directory to a relative subdirectory, for example workingDirectory: ./app in the project YAML. The whole repository stays mounted; OpenCode starts in that subdirectory. Changing it restarts OpenCode without recreating the sandbox or deleting its conversations. The foreign-session warning maps Windows sandbox paths back to the host and treats folders in one Git worktree as the same project; a separate linked worktree stays distinct.
  • Share your OpenCode config with the sandbox (read-only) mounts the host config directory, including JSON/JSONC, skills, agents, commands, and plugins. The sandbox can read any credentials embedded in those files, but cannot change them. Host auth.json and the host credential database are not shared. Sandbox sessions and browser preferences remain separate.
  • Provider authentication is independent of IntelliJ: use Docker's sbx secret for API keys or sign in separately through OpenCode inside the sandbox. The plugin and standalone launcher never copy host OpenCode credentials or run an OAuth proxy. See Sandbox credentials and standalone use.
  • Check Sandbox Setup checks guest access to models.opencode.ai (model catalog). It uses saved settings and an owned, running VM. A healthy local server does not prove provider authentication or other outbound connections work.
  • OpenCode version is stored per project as openCodeVersion: 1.x or 2.x (default 1.x). Both come from Docker's published docker.io/sbx/opencode kits and need sbx 0.51.0 or later; an older sbx stops with an update message.
    • 1.x uses the sbx/opencode:1.18.31 kit. Upgrade OpenCode (project settings, gear menu, or the update indicator) runs opencode upgrade inside the VM and keeps it.
    • 2.x uses the opencode agent, Docker's latest OpenCode 2 kit. Docker's image can trail OpenCode's releases. Upgrade OpenCode installs the newest release inside the VM with OpenCode's own installer and keeps it across Stop/Start; the TUI, ACP, and --web of the standalone launcher use it too. Reset Sandbox (or the launcher's --recreate) returns to Docker's latest image. If a new Docker image breaks the sandbox, pin an earlier one under OpenCode version → Docker image (openCodeImage: 2.2.7 or a sha256: digest in opencode-sbx.yaml); Docker keeps only recent tags, so switch back to latest once it is fixed.
    • Each version is a separate image, so switching versions needs a new VM; Apply asks before recreating. A start or launcher run that finds the other version stops with Recreate Sandbox (launcher: --recreate). Select 2.x before the first start when sharing an OpenCode 2 host configuration.
  • 2.x sandboxes that still run the OpenCode 2 copy installed by earlier plugin releases stop with a Recreate Sandbox action; recreating also deletes that copy. 1.x sandboxes never launched it and keep running.
  • Docker's 2.x kit configures OpenCode to run tools without approval prompts, because the sandbox is the isolation boundary. The plugin keeps each kit's configuration and only merges its MCP entries over it.
  • Apply/start writes one shell launcher, opencode-sbx.sh. The IDE and launcher leave provider/model configuration to OpenCode. Apply/start removes the older helper scripts and provider-compatibility JSON.
  • Protect sandbox files overlays the opencode-sbx/ folder (spec, launchers, extra-network kit) and other local kit directories read-only on top of the writable project mount (on by default). Reset the sandbox to apply to an existing VM.
  • Persist sandbox sessions and sign-ins across Reset Sandbox keeps this sandbox's OpenCode data, including conversations and sandbox-owned logins, on the host in a plugin data directory (not Host CLI's opencode.db). Reset recreates the VM and remounts the same store.
  • Resources, Mounts and Kits (collapsed while all are defaults): memory and CPUs apply at the next Reset Sandbox.
    • Kits must use schemaVersion: "3": both of Docker's OpenCode kits are v3, and sbx refuses to combine them with v1/v2 kits. Create Extra-Network Kit Template writes a v3 mixin; regenerate a template created by an earlier release. A kit that requests new permissions, such as network hosts, cannot be added to an existing sandbox without a terminal prompt, so OpenCode offers Recreate Sandbox instead.
    • Mounts can be marked Read-only (readOnly: true, or sbx's host:ro). Mount paths that do not exist on this machine are skipped.
    • Extra-mount host paths support a leading ${NAME} or ${NAME:-fallback}, resolved from the host environment. For example, host: '${GRADLE_USER_HOME:-~/.gradle}' with readOnly: true shares each developer's existing Gradle configuration without copying it. The fallback applies when the variable is unset or empty; ~ expands to the host home. Expansion is literal (no shell evaluation) and applies only to host mount paths, not guest environment variables. The entire directory is mounted, so its credentials and other contents are readable in the sandbox. Keep writable guest caches separate. An existing VM needs Recreate Sandbox to apply changed mounts.
  • A project without opencode-sbx/opencode-sbx.yaml runs the Host CLI. Creating a sandbox from a spec requires a trusted project; a spec that mounts host paths outside the project, shares the host config, or adds kits asks once per distinct set of grants (settings Apply counts as consent).
  • Starting never deletes the VM. When the spec asks for kits removed or reordered, config sharing toggled, or mounts added, removed, or switched to read-only, OpenCode stops with the differences and a Recreate Sandbox action; Apply asks before recreating.
  • The spec is parsed strictly by the plugin and the launcher alike: unknown structure, yes/no flags or values such as 8GB make it invalid instead of being ignored. Apply keeps comments and unknown keys.

Sandbox credentials and standalone use

The sandbox can run without IntelliJ or this plugin. Docker Sandboxes owns its credential proxy; OpenCode owns accounts created inside the sandbox.

  1. Keep the generated opencode-sbx/ directory with the project, including the YAML, launcher, and any network kit. Install Docker Sandboxes and set up its network policy on each machine. Use sbx ls to find the local sandbox name.
  2. For an API key, run sbx secret set openai --sandbox <name> in a terminal and enter the key at its prompt. Replace openai with a supported service such as anthropic, mistral, or xai. Sandbox-scoped changes apply immediately. Global secrets (sbx secret set openai) apply when a sandbox is created.
  3. For an independent OpenCode 2 account, launch ./opencode-sbx/opencode-sbx.sh, enter /connect, and select the provider and authentication method. ChatGPT headless and SuperGrok device login avoid callbacks to a port inside the VM. Alternatively, run ./opencode-sbx/opencode-sbx.sh auth login. Complete sign-in yourself in the browser. Do not combine this with an sbx secret for the same provider: Docker's proxy can replace the account's header. With sbx 0.39.0, removing a secret did not clear its injected value even after a VM Stop/Start. Remove the secret and recreate the sandbox when switching from native key injection to a sandbox-owned account; keep Persist sandbox sessions and sign-ins across Reset Sandbox enabled to retain OpenCode data.
  4. Run ./opencode-sbx/opencode-sbx.sh to open a TUI in the same sandbox, even while the IDE-managed server is running. The launcher attaches with sbx exec and keeps the configured project working directory; it never creates another sandbox for that project. OpenCode flags and commands pass through, for example ./opencode-sbx/opencode-sbx.sh --continue or ./opencode-sbx/opencode-sbx.sh run "Summarize this change". A positional project path is resolved against the caller's directory and mapped into the VM. Use --sbx-directory DIR to select another project's sandbox and --sbx-help for launcher-only options. Stop the IDE-managed server before starting another server with --web; use acp for another editor. Export OPENCODE_SERVER_PASSWORD yourself for standalone web authentication; the launcher does not read IntelliJ Password Safe. Reuse the same sandbox and persisted data to continue conversations.

Launcher options must precede OpenCode arguments. For example:

./opencode-sbx/opencode-sbx.sh                              # TUI alongside the IDE
./opencode-sbx/opencode-sbx.sh --continue                    # resume in the TUI
./opencode-sbx/opencode-sbx.sh --model provider/model ./app  # native project argument
./opencode-sbx/opencode-sbx.sh session list                  # native CLI command
./opencode-sbx/opencode-sbx.sh --print-logs acp              # ACP, including piped initialize
./opencode-sbx/opencode-sbx.sh --sbx-directory ../other --version
./opencode-sbx/opencode-sbx.sh --web                         # published browser server
./opencode-sbx/opencode-sbx.sh --sbx-help                    # launcher help

--help and --version show the selected guest OpenCode's output. The older --cli, --acp, and --oc-args forms still work. For scripts using the old positional sandbox directory, replace that argument with --sbx-directory DIR. Setup diagnostics go to stderr; piped stdin and command stdout belong to OpenCode. TTY allocation requires both stdin and stdout to be terminals; ACP never gets a TTY. --web reserves guest 0.0.0.0:4096; set YAML hostPort for its host port. Native serve/web commands forward their own flags, with ports inside the VM.

Launcher regression smoke checks: bash scripts/check-sbx-launcher.sh. They use a fake sbx, including pipe and argument checks, plus PTY checks when util-linux script is available; no sandbox or provider call is made.

Network permission is separate from credentials. Docker's OpenCode kits already allow their providers' hosts (OpenAI including auth.openai.com and chatgpt.com, Anthropic, Google, Groq, OpenRouter, api.x.ai, GitHub Copilot) plus opencode.ai, *.opencode.ai and registry.npmjs.org. Other hosts, such as auth.x.ai for SuperGrok login or Mistral, need an extra-network kit or an explicit sbx policy allow network --sandbox <name> <host>. The browser opens the provider's own authorization page.

Docker's 2.x kit also accepts sbx secret set openai --oauth (ChatGPT subscription) and seeds OpenCode's GitHub Copilot provider from a github secret; the real tokens stay with Docker's proxy.

Existing installations that relied on automatic host authentication need to set up sandbox credentials once. Previously copied accounts can remain in persisted sandbox data; manage them with OpenCode's /connect or auth logout, rather than editing either credential database. Closing or uninstalling the plugin does not delete the generated launcher, sandbox, or persisted data. IntelliJ MCP tools remain available only while the IDE is running.

See Docker credentials and OpenCode provider accounts.

Troubleshooting

OpenCode does not start

  • Check that the OpenCode CLI is installed.
  • Run opencode --version in a terminal.
  • The panel shows an error view with recent server output plus Retry, Open Settings, and View Full Log actions.
  • Open the plugin settings: the OpenCode executable setting shows which executable a start uses and its version, or what is wrong. Choose Custom path to set it manually.

The panel shows a failed server state

  • Click Retry in the tool-window status strip or on the error view.
  • If it still fails, review the server output shown on the error view.
  • With a fixed port, the error view detects port conflicts and offers Use Automatic Port.
  • Verify the configured OpenCode project directory exists.

Provider API calls fail behind a proxy

  • Open Settings > Tools > OpenCode Web Panel and set HTTP Proxy.
  • Use IDE HTTP Proxy forwards the IDE proxy (Settings > Appearance & Behavior > System Settings > HTTP Proxy), including auto-detect and PAC. PAC is resolved for a generic HTTPS target, because OpenCode accepts only a single HTTP_PROXY value.
  • Use environment variables keeps HTTP_PROXY / HTTPS_PROXY from the environment the IDE was started with.
  • No proxy removes proxy variables from the OpenCode process.
  • Restart the OpenCode server after changing proxy settings.

The panel is stuck, blank, or frozen on “Opening the OpenCode page…”

  • Use Restart Server in the tool window title bar, gear menu, or OpenCode Web Panel | This Project settings (Start Server there while the server is stopped). Host CLI and Docker Sandbox restarts are this project only.
  • Reload Page reloads the UI without restarting the server; use Restart if that is not enough.

The embedded UI behaves unexpectedly after an OpenCode update

  • Turn off the affected option on the Panel tab of the settings.
  • Reload or reopen the tool window.
  • Report the issue with the OpenCode version and plugin version.

Reporting exceptions and freezes

  • The plugin opts in to the JetBrains Marketplace error handler, so exception and freeze reports attributed to it can go to the plugin author.
  • The IDE's error dialog shows the technical details before you send. Automatic reporting only happens if Send error reports to JetBrains automatically is enabled in the IDE settings.
  • Reports appear under the Exceptions and Freezes tabs of the plugin page on JetBrains Marketplace.

Development

Useful development commands:

./gradlew ktfmtFormat
./gradlew check
./gradlew test
./gradlew runIde
./gradlew runIdeForUiTests
  • ktfmtFormat formats Kotlin sources, tests, and root Gradle Kotlin scripts with ktfmt, using KotlinLang style (four spaces, 100-column width).
  • check runs Kotlin formatting checks, JVM and IntelliJ Platform tests, and the other build checks. CI uses the same task and rejects unformatted Kotlin. Use ./gradlew ktfmtCheck for formatting only.
  • test runs JVM and IntelliJ Platform tests.
  • runIde launches a sandbox IDE with the plugin installed.
  • runIdeForUiTests launches the sandbox IDE with the JetBrains Robot Server enabled.

Run ktfmtFormat before committing Kotlin changes. For IDE formatting, install the ktfmt IntelliJ plugin and select KotlinLang style. The Gradle formatter is authoritative; .editorconfig aligns basic editor indentation and line width.

The OpenCode compatibility GitHub Actions workflow runs every Monday and supports manual runs. It installs the latest stable OpenCode 1.x and 2.x releases and checks DOM markers, API contracts, browser behavior, real JCEF callbacks, browser replacement, editor transfers, and IDE clipboard delivery. Installed versions are logged on each run; skipped JCEF tests fail the workflow. Push and pull-request builds also check DOM, API, and browser behavior against both latest releases and a pinned 1.18 baseline. Ordinary check stays headless; run ./gradlew test -Pjcef locally with a display and OpenCode installed. Use -PlocalIdePath="/path/to/IntelliJ IDEA" to test an installed IDE/JCEF version.

The Docker Sandboxes compatibility workflow checks sbx 0.51.0 (the minimum, the first release with Docker's v3 OpenCode kits) and the latest stable Docker release on pushes, pull requests, Mondays, and manual runs. It verifies the version gate and 12 consumed CLI command surfaces against the plugin's actual command builders, runs JSON-parser regressions (legacy envelopes and current arrays), and tests the standalone launcher. Release versions and CLI output are retained in the run artifacts.

./gradlew checkSbxContract                         # commands/flags, no Docker login needed
./gradlew checkSbxContract -PsbxLive=true          # also validate real JSON using production parsers
./gradlew checkSbxContract -PsbxExecutable=/path/to/sbx
bash scripts/check-sbx-launcher.sh

The live gate needs an existing Docker sign-in. It reads sandbox inventory, each sandbox's ports, policy, and diagnostics; sbx may start its daemon, but the gate does not create/start/remove VMs or change policy. Reports go to build/sbx-contract. Hosted CI checks CLI surface and recorded JSON fixtures, not authenticated runtime behavior. Empty inventories cannot verify populated row fields; repeat the live check with existing sandboxes after sbx updates. Last live JSON validation: sbx 0.53.0 with Docker's OpenCode kits (1.18.31 and 2.3.0), macOS, 2026-11-13.

Repository: https://github.com/moritzfl/intellij-opencode-web-panel

Acknowledgements

This project started as a fork of an early draft by xausky: https://github.com/xausky/intellij-opencode-web-ui/

License

This project is licensed under the MIT License.

Disclaimer

This plugin is an unofficial community plugin for OpenCode and is not affiliated with OpenCode. Please report plugin issues through GitHub Issues.


If you find this plugin useful, please consider giving it a star.

About

No description, website, or topics provided.

Resources

Stars

8 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages