[Bug]: `bun:semver` and `bun-pty` imports break plugin loading on OpenCode 1.14.x (Node ESM plugin host)
Los mantenedores suelen responder en 1 día
@shekohex ya está trabajando en esto.
Desde el 5/5/2026.
Evaluación
Este issue todavía no se ha evaluado.
Descripción
Summary
[email protected] fails to load on OpenCode 1.14.x (and likely all OpenCode versions since ~1.4.x) because the compiled dist/src/plugin/pty/manager.js imports bun:semver and bun-pty/package.json. OpenCode's plugin host switched from Bun to Node ESM (anomalyco/opencode#18308, merged 2026-04-01), so these Bun-only imports now throw Cannot find package 'bun' at plugin load time.
This is related to but distinct from #7 (Windows + bun-pty GLIBC issue). On macOS the failure happens earlier — the plugin never gets past module resolution because bun:semver isn't a real npm package.
Error in OpenCode log
ERROR 2026-05-05T08:35:35 service=plugin path=opencode-pty@latest
target=file:///Users/.../.cache/opencode/packages/opencode-pty@latest/node_modules/opencode-pty/dist/index.js
error=Cannot find package 'bun' imported from
/Users/.../.cache/opencode/packages/opencode-pty@latest/node_modules/opencode-pty/dist/src/plugin/pty/manager.js
failed to load plugin
This fires on every workspace bootstrap — for users with multiple projects in the OpenCode sidebar, this means a stack of error toasts + chimes on every cold start.
Reproduction
npm pack [email protected]
tar -xzf opencode-pty-0.3.4.tgz
head -5 package/dist/src/plugin/pty/manager.js
# import { semver } from 'bun';
# import { Terminal } from 'bun-pty';
# import { version as bunPtyVersion } from 'bun-pty/package.json';
# import { NotificationManager } from "./notification-manager.js";
# ...
node -e "import('./package/dist/index.js').catch(e=>console.error(e.message))"
# Cannot find package 'bun' imported from /.../dist/src/plugin/pty/manager.js
Why this is now broken
OpenCode 1.4.x+ replaced the BunProc plugin runtime with @npmcli/arborist + native Node import() (anomalyco/opencode#18308). The Node loader doesn't ship bun:* virtual modules and doesn't have a bun-pty peer package available.
PR #27 ("Ship pre-compiled JS to avoid transpilation cost") helped reduce on-the-fly Bun work but the runtime imports still target Bun's standard library and bun-pty's native .node bindings.
Suggested fix (high-level — likely needs a real refactor)
Replace Bun-specific dependencies with Node-compatible alternatives:
bun:semver→semver(npm). One-line swap.bun-pty→@lydell/node-ptyor the upstreamnode-pty. OpenCode itself already ships@lydell/node-pty-darwin-arm64in its app bundle, so the Node ecosystem is the natural target.- Either:
- Maintain dual support (detect Bun vs Node at runtime and pick the impl), or
- Drop Bun support and target Node ESM only — which is what OpenCode has effectively already done.
Open question: is there demand to keep Bun-only operation, or can the plugin become Node-first now that OpenCode is Node-based?
Environment
- OpenCode: 1.14.37 (Electron 41 / Node 24, macOS arm64)
- Plugin:
[email protected](latest) - macOS 26.4.1 arm64
- Plugin declared globally in
~/.config/opencode/opencode.json"plugin"array; fails on every workspace bootstrap.
References
- Related: shekohex/opencode-pty#7 (Windows startup crash, also
bun-pty-driven) - Upstream loader change: anomalyco/opencode#18308 ("refactor: replace BunProc with Npm module using @npmcli/arborist")
- Related upstream issues mentioning Bun-only plugins breaking: anomalyco/opencode#22045, anomalyco/opencode#13282
- Lenguaje dominante
- TypeScript
- Estrellas
- 597
- Forks
- 65
- Merge medio
- 1 d 20 h
- PR fusionados (30 d)
- 3
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de shekohex/opencode-pty
-
[Bug]: exit notification delivery failures are silently swallowed — agent never wakes, no diagnosticAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
shekohex/opencode-pty#54 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
shekohex/opencode-pty#48 ·
Los mantenedores suelen responder en 1 día
-
PTY output pollutes OpenCode session with ANSI escape sequences, breaking keyboard input on resumePosiblemente ocupada @NAnD71 la tomó hace 4 días. Abierto
Dificultad 4/5 3-5 días Aptitud para principiantes 30/100
shekohex/opencode-pty#75 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 3/5 1-2 días Aptitud para principiantes 65/100
shekohex/opencode-pty#67 · 3 comentarios · 2 reacciones ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 4/5 3-5 días Aptitud para principiantes 56/100
shekohex/opencode-pty#66 ·
Los mantenedores suelen responder en 1 día
Todos los issues de shekohex/opencode-pty
Issues similares
-
[Bug]: [MCP/CLI] Bare loopback IP addresses (127.0.0.1:port) and hosts with ports fail to navigate due to erroneous scheme inferencePosiblemente ocupada @alok-108 la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
microsoft/playwright#43263 ·
Los mantenedores suelen responder en 1 día
-
bug priority:medium
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
Los mantenedores suelen responder en 1 día
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Dificultad 1/5 Menos de una hora Aptitud para principiantes 75/100
lingdojo/kana-dojo#32018 · 1 comentario · 5 reacciones ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
paperclipai/paperclip#15751 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
BuilderIO/agent-native#7275 ·
Los mantenedores suelen responder en 1 día