OpenCode plug-in adaptation of the pi extension pi-studio.
It provides a local browser-based Studio workspace for OpenCode, with an editor on the left and response/preview on the right.
If you use pi itself, use the original pi-studio. This repo is for OpenCode.
Usable and actively improving.
The main goal is a good OpenCode version of Studio rather than full feature parity with pi-studio.
- Launch Studio from an active OpenCode session with
/studio - Attach Studio to the same session you are already using
- Two-pane editor + response/preview workspace
- Run, queue steering, stop, and browse response history
- Raw response, rendered response preview, and editor preview
- Load and save local files
- Markdown / QMD / LaTeX preview with practical support for:
- math fallback
- Quarto-style callouts
- preview page-break markers
- local PDF figure preview via
pdf.js
- PDF export of the right-pane preview via
pandoc+xelatex - Theme-aware Studio UI based on the active OpenCode theme
- Footer/status info, pane focus controls, and response highlighting inspired by
pi-studio
Recommended installation:
bunx pi-studio-opencode@latest installThat updates your OpenCode config to add:
- the
pi-studio-opencode@latestplugin entry - the
/studiocommand entry
For a project-local install instead of a user-wide one:
bunx pi-studio-opencode@latest install --projectThen restart OpenCode and run:
/studio
If you prefer to edit config yourself, add this to either:
.opencode/opencode.jsonc~/.config/opencode/opencode.json~/.config/opencode/opencode.jsonc
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["pi-studio-opencode@latest"],
"command": {
"studio": {
"template": "Open π Studio for this active opencode session.",
"description": "Open π Studio attached to the current opencode session"
}
}
}/studioopens a browser-based Studio linked to the current OpenCode session.- If
/studiogets sent to the model as ordinary text, the plug-in probably did not load. Rebuild or reinstall the package, then fully restart OpenCode. - If you use
--no-open, open the full tokenized URL shown by Studio, not just the bare port root. --base-url,--session, and--directoryare taken from the active OpenCode session during/studio.- The Studio UI is external to OpenCode; it is not an embedded pane.
- Preview and PDF quality depend on local tooling:
pandocfor preview/PDF workflowsxelatexfor PDF export
You can also launch the browser surface directly:
pi-studio-opencode --directory "/path/to/project"or:
npx pi-studio-opencode --directory "/path/to/project"To attach manually to an existing OpenCode server/session:
pi-studio-opencode --base-url "http://127.0.0.1:4096" --session "<session-id>" --directory "/path/to/project"