You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
opencode-pty still fails under OpenCode Node plugin runtime after PR #38: bun-pty resolves to TypeScript source under node_modules
Summary
I am trying to use opencode-pty with OpenCode running as a systemd service on Ubuntu. The plugin appears to install / show in OpenCode status, but the PTY slash commands and tools do not appear in opencode attach.
After testing both the published npm package and the current GitHub main build, it looks like there are still Node-runtime compatibility problems.
The original npm package failed because it still imported Bun-specific modules such as bun. After building current main, that part appears improved, but the plugin still fails under Node because bun-pty resolves to a .ts entry inside node_modules, which Node refuses to type-strip.
PKG=/root/.cache/opencode/packages/opencode-pty@latest/node_modules/opencode-pty
grep -RInE "from ['\"]bun['\"]|bun:semver|from ['\"]bun-pty|bun-pty/package.json""$PKG/dist"| head -50
Output:
/root/.cache/opencode/packages/opencode-pty@latest/node_modules/opencode-pty/dist/src/plugin/pty/session-lifecycle.js:1:import { spawn } from 'bun-pty';
/root/.cache/opencode/packages/opencode-pty@latest/node_modules/opencode-pty/dist/src/plugin/pty/manager.js:1:import { semver } from 'bun';
/root/.cache/opencode/packages/opencode-pty@latest/node_modules/opencode-pty/dist/src/plugin/pty/manager.js:2:import { Terminal } from 'bun-pty';
/root/.cache/opencode/packages/opencode-pty@latest/node_modules/opencode-pty/dist/src/plugin/pty/manager.js:3:import { version as bunPtyVersion } from 'bun-pty/package.json';
NODE FAIL: Cannot find package 'bun' imported from /root/.cache/opencode/packages/opencode-pty@latest/node_modules/opencode-pty/dist/src/plugin/pty/manager.js
So npm 0.3.4 still appears to contain the old Bun-specific import.
Testing current GitHub main
I then cloned and built from source:
mkdir -p /root/src
rm -rf /root/src/opencode-pty
git clone https://github.com/shekohex/opencode-pty.git /root/src/opencode-pty
cd /root/src/opencode-pty
bun install
bun run build:prod
Initially this failed on Node 18 because Vite requires newer Node:
You are using Node.js 18.19.1. Vite requires Node.js version 20.19+ or 22.12+.
error during build:
[vite:build-html] crypto.hash is not a function
After upgrading Node, the build succeeded:
vite v7.3.1 building client environment for production...
✓ 40 modules transformed.
✓ built in 1.22s
NODE FAIL: Stripping types is currently unsupported for files under node_modules, for "file:///root/src/opencode-pty/node_modules/bun-pty/src/index.ts"
So current main no longer fails at import { semver } from 'bun', but still fails because bun-pty resolves to a TypeScript source entry inside node_modules.
I am not sure if that is directly caused by this plugin, but the plugin’s direct Node import failure is reproducible independently with the commands above.
What seems to be happening
It looks like there are two separate compatibility layers:
npm opencode-pty@0.3.4 still contains old Bun-specific imports:
import { semver } from 'bun'
import { Terminal } from 'bun-pty'
GitHub main appears to fix the direct bun import issue, but bun-pty itself still resolves to:
bun-pty/src/index.ts
Node then fails with:
Stripping types is currently unsupported for files under node_modules
Since OpenCode’s plugin host appears to load plugins through Node ESM, opencode-pty still cannot fully load unless bun-pty becomes Node-compatible or the plugin switches to a Node-compatible PTY dependency.
Request
Could you confirm whether opencode-pty is expected to work under OpenCode’s current Node-based plugin runtime?
mkdir -p /root/src
rm -rf /root/src/opencode-pty
git clone https://github.com/shekohex/opencode-pty.git /root/src/opencode-pty
cd /root/src/opencode-pty
bun install
bun run build:prod
node -e "import('file:///root/src/opencode-pty/dist/index.js').then(()=>console.log('NODE OK')).catch(e=>console.error('NODE FAIL:', e.message))"
Current result from GitHub main:
NODE FAIL: Stripping types is currently unsupported for files under node_modules, for "file:///root/src/opencode-pty/node_modules/bun-pty/src/index.ts"
opencode-ptystill fails under OpenCode Node plugin runtime after PR #38:bun-ptyresolves to TypeScript source undernode_modulesSummary
I am trying to use
opencode-ptywith OpenCode running as a systemd service on Ubuntu. The plugin appears to install / show in OpenCode status, but the PTY slash commands and tools do not appear inopencode attach.After testing both the published npm package and the current GitHub
mainbuild, it looks like there are still Node-runtime compatibility problems.The original npm package failed because it still imported Bun-specific modules such as
bun. After building currentmain, that part appears improved, but the plugin still fails under Node becausebun-ptyresolves to a.tsentry insidenode_modules, which Node refuses to type-strip.Environment
My systemd service includes:
Config used
Global config:
{ "$schema": "https://opencode.ai/config.json", "plugin": [ "oh-my-opencode-slim", "opencode-pty" ] }I also tested with project-level config including
opencode-pty.Behavior
Expected:
opencode-ptyshould load normally./pty-show-server-urlshould be available.pty_spawn,pty_read,pty_write,pty_list, etc. should be available.Actual:
opencode attach.Published npm package test
Installed package:
Package version:
{ "name": "opencode-pty", "version": "0.3.4", "main": "dist/index.js", "type": "module" }I checked the built output:
Output:
Node import test:
node -e "import('file:///root/.cache/opencode/packages/opencode-pty@latest/node_modules/opencode-pty/dist/index.js').then(()=>console.log('NODE OK')).catch(e=>console.error('NODE FAIL:', e.message))"Output:
So npm
0.3.4still appears to contain the old Bun-specific import.Testing current GitHub
mainI then cloned and built from source:
mkdir -p /root/src rm -rf /root/src/opencode-pty git clone https://github.com/shekohex/opencode-pty.git /root/src/opencode-pty cd /root/src/opencode-pty bun install bun run build:prodInitially this failed on Node 18 because Vite requires newer Node:
After upgrading Node, the build succeeded:
Then I tested the built plugin under Node:
node -e "import('file:///root/src/opencode-pty/dist/index.js').then(()=>console.log('NODE OK')).catch(e=>console.error('NODE FAIL:', e.message))"Output:
So current
mainno longer fails atimport { semver } from 'bun', but still fails becausebun-ptyresolves to a TypeScript source entry insidenode_modules.bun-ptypackage detailsInside:
The package.json shows:
{ "name": "bun-pty", "version": "0.4.8", "main": "./src/index.ts", "types": "./dist/index.d.ts", "type": "module", "engines": { "bun": ">=1.0.0" } }There is no compiled JS entry in
dist, only declarations:I tried building
bun-pty:but it failed because cargo was missing:
However, even if Rust/cargo is installed, the package’s JS entry still points to
./src/index.ts, which Node does not support insidenode_modules.I also tried temporarily patching
bun-pty’s package.json to point to./dist/index.js, but that failed because no such JS file exists:Related logs from OpenCode
OpenCode also repeatedly logged dependency install problems inside the project config directory:
I am not sure if that is directly caused by this plugin, but the plugin’s direct Node import failure is reproducible independently with the commands above.
What seems to be happening
It looks like there are two separate compatibility layers:
npm
opencode-pty@0.3.4still contains old Bun-specific imports:import { semver } from 'bun'import { Terminal } from 'bun-pty'GitHub
mainappears to fix the directbunimport issue, butbun-ptyitself still resolves to:bun-pty/src/index.tsNode then fails with:
Since OpenCode’s plugin host appears to load plugins through Node ESM,
opencode-ptystill cannot fully load unlessbun-ptybecomes Node-compatible or the plugin switches to a Node-compatible PTY dependency.Request
Could you confirm whether
opencode-ptyis expected to work under OpenCode’s current Node-based plugin runtime?If yes, would it be possible to either:
bun-ptywith a Node-compatible PTY package,bun-pty/src/index.tsdirectly,Reproduction commands
opencode --version node --version bun --version ldd --version | head -1For GitHub
main:Current result from GitHub
main: