Plugin bun-pty cannot find librust_pty.so when installed in .opencode/ - missing search path #7552

Open
opened 2026-02-16 18:07:33 -05:00 by yindo · 10 comments
Owner

Originally created by @MBanucu on GitHub (Jan 25, 2026).

Originally assigned to: @thdxr on GitHub.

Bug Report

Description

When using the bun-pty dependency in a local OpenCode plugin (installed via .opencode/package.json), the native librust_pty.so library cannot be found even though it exists at .opencode/node_modules/bun-pty/rust-pty/target/release/librust_pty.so. The bun-pty library only checks hardcoded paths that don't include .opencode/node_modules/.

Environment

  • OpenCode Version: 1.1.35-0bc4a43
  • Operating System: NixOS
  • GLIBC Version: 2.42
  • bun-pty Version: 0.4.8
  • Architecture: x86-64

Steps to Reproduce

  1. Create a new test workspace:

    mkdir test-workspace
    cd test-workspace
    mkdir -p .opencode/plugins
    
  2. Add bun-pty dependency to .opencode/package.json:

    {
      "dependencies": {
        "bun-pty": "^0.4.8"
      }
    }
    
  3. Install dependencies:

    cd .opencode && bun install
    
  4. Verify the library exists:

    ls .opencode/node_modules/bun-pty/rust-pty/target/release/librust_pty.so
    # File exists and is valid ELF 64-bit LSB shared object
    
  5. Start OpenCode:

    opencode debug wait
    

Expected Behavior

OpenCode should start successfully and find the librust_pty.so library in the .opencode/node_modules/ directory where bun-pty was installed.

Actual Behavior

OpenCode fails with:

Error: Unexpected error, check log file at /home/michi/.local/share/opencode/log/dev.log for more details

librust_pty shared library not found.
Checked:
  - BUN_PTY_LIB=<unset>
  - /home/michi/dev/opencode-pty-branches/web-ui/test-workspace/.opencode/plugins/rust-pty/target/release/librust_pty.so
  - /home/michi/dev/opencode-pty-branches/web-ui/test-workspace/.opencode/bun-pty/rust-pty/target/release/librust_pty.so
  - /home/michi/dev/opencode-pty-branches/web-ui/test-workspace/node_modules/bun-pty/rust-pty/target/release/librust_pty.so

Root Cause Analysis

The bun-pty library searches for librust_pty.so in these paths:

  1. .opencode/plugins/rust-pty/target/release/librust_pty.so
  2. .opencode/bun-pty/rust-pty/target/release/librust_pty.so
  3. node_modules/bun-pty/rust-pty/target/release/librust_pty.so

However, when bun-pty is installed as a dependency via .opencode/package.json, it gets installed to .opencode/node_modules/bun-pty/rust-pty/target/release/librust_pty.so, which is not in the search paths.

Directory Structure

test-workspace/
├── .opencode/
│   ├── package.json
│   ├── bun.lock
│   ├── node_modules/
│   │   └── bun-pty/
│   │       ├── rust-pty/
│   │       │   └── target/
│   │       │       └── release/
│   │       │           ├── librust_pty.so  ← FILE EXISTS HERE
│   │       │           ├── librust_pty_arm64.so
│   │       │           └── ...
│   │       └── package.json
│   └── plugins/
│       └── opencode-pty.js

Temporary Workarounds

  1. Set BUN_PTY_LIB environment variable:

    export BUN_PTY_LIB=.opencode/node_modules/bun-pty/rust-pty/target/release/librust_pty.so
    opencode debug wait
    
  2. Create symbolic link:

    mkdir -p .opencode/bun-pty/rust-pty/target/release
    ln -s .opencode/node_modules/bun-pty/rust-pty/target/release/librust_pty.so .opencode/bun-pty/rust-pty/target/release/
    
  3. Copy the library:

    mkdir -p .opencode/bun-pty/rust-pty/target/release
    cp .opencode/node_modules/bun-pty/rust-pty/target/release/librust_pty.so .opencode/bun-pty/rust-pty/target/release/
    

Suggested Fix

The bun-pty library should be updated to include .opencode/node_modules/bun-pty/rust-pty/target/release/librust_pty.so in its search paths when resolving the native library.

Alternatively, OpenCode could provide a standardized way for plugins to resolve native dependencies installed via .opencode/package.json.

Related Issues

This appears to be similar to other path resolution issues in the plugin system:

  • #4324: Cannot load custom providers from local file paths
  • #3001: "@opencode-ai/plugin" error when creating custom tools
  • Issues with plugin dependency resolution during local dev

Additional Context

This is particularly problematic for PTY/terminal functionality which relies on native libraries. The current workaround requires manual intervention that breaks the "just work" experience that OpenCode aims to provide with local plugins.

The issue affects the opencode-pty plugin development workflow, making it difficult to test local changes without manual setup steps.

Originally created by @MBanucu on GitHub (Jan 25, 2026). Originally assigned to: @thdxr on GitHub. ## Bug Report ### Description When using the bun-pty dependency in a local OpenCode plugin (installed via `.opencode/package.json`), the native `librust_pty.so` library cannot be found even though it exists at `.opencode/node_modules/bun-pty/rust-pty/target/release/librust_pty.so`. The bun-pty library only checks hardcoded paths that don't include `.opencode/node_modules/`. ### Environment - **OpenCode Version**: 1.1.35-0bc4a43 - **Operating System**: NixOS - **GLIBC Version**: 2.42 - **bun-pty Version**: 0.4.8 - **Architecture**: x86-64 ### Steps to Reproduce 1. Create a new test workspace: ```bash mkdir test-workspace cd test-workspace mkdir -p .opencode/plugins ``` 2. Add bun-pty dependency to `.opencode/package.json`: ```json { "dependencies": { "bun-pty": "^0.4.8" } } ``` 3. Install dependencies: ```bash cd .opencode && bun install ``` 4. Verify the library exists: ```bash ls .opencode/node_modules/bun-pty/rust-pty/target/release/librust_pty.so # File exists and is valid ELF 64-bit LSB shared object ``` 5. Start OpenCode: ```bash opencode debug wait ``` ### Expected Behavior OpenCode should start successfully and find the `librust_pty.so` library in the `.opencode/node_modules/` directory where bun-pty was installed. ### Actual Behavior OpenCode fails with: ``` Error: Unexpected error, check log file at /home/michi/.local/share/opencode/log/dev.log for more details librust_pty shared library not found. Checked: - BUN_PTY_LIB=<unset> - /home/michi/dev/opencode-pty-branches/web-ui/test-workspace/.opencode/plugins/rust-pty/target/release/librust_pty.so - /home/michi/dev/opencode-pty-branches/web-ui/test-workspace/.opencode/bun-pty/rust-pty/target/release/librust_pty.so - /home/michi/dev/opencode-pty-branches/web-ui/test-workspace/node_modules/bun-pty/rust-pty/target/release/librust_pty.so ``` ### Root Cause Analysis The bun-pty library searches for `librust_pty.so` in these paths: 1. `.opencode/plugins/rust-pty/target/release/librust_pty.so` 2. `.opencode/bun-pty/rust-pty/target/release/librust_pty.so` 3. `node_modules/bun-pty/rust-pty/target/release/librust_pty.so` However, when bun-pty is installed as a dependency via `.opencode/package.json`, it gets installed to `.opencode/node_modules/bun-pty/rust-pty/target/release/librust_pty.so`, which is **not** in the search paths. ### Directory Structure ``` test-workspace/ ├── .opencode/ │ ├── package.json │ ├── bun.lock │ ├── node_modules/ │ │ └── bun-pty/ │ │ ├── rust-pty/ │ │ │ └── target/ │ │ │ └── release/ │ │ │ ├── librust_pty.so ← FILE EXISTS HERE │ │ │ ├── librust_pty_arm64.so │ │ │ └── ... │ │ └── package.json │ └── plugins/ │ └── opencode-pty.js ``` ### Temporary Workarounds 1. **Set BUN_PTY_LIB environment variable**: ```bash export BUN_PTY_LIB=.opencode/node_modules/bun-pty/rust-pty/target/release/librust_pty.so opencode debug wait ``` 2. **Create symbolic link**: ```bash mkdir -p .opencode/bun-pty/rust-pty/target/release ln -s .opencode/node_modules/bun-pty/rust-pty/target/release/librust_pty.so .opencode/bun-pty/rust-pty/target/release/ ``` 3. **Copy the library**: ```bash mkdir -p .opencode/bun-pty/rust-pty/target/release cp .opencode/node_modules/bun-pty/rust-pty/target/release/librust_pty.so .opencode/bun-pty/rust-pty/target/release/ ``` ### Suggested Fix The bun-pty library should be updated to include `.opencode/node_modules/bun-pty/rust-pty/target/release/librust_pty.so` in its search paths when resolving the native library. Alternatively, OpenCode could provide a standardized way for plugins to resolve native dependencies installed via `.opencode/package.json`. ### Related Issues This appears to be similar to other path resolution issues in the plugin system: - #4324: Cannot load custom providers from local file paths - #3001: "@opencode-ai/plugin" error when creating custom tools - Issues with plugin dependency resolution during local dev ### Additional Context This is particularly problematic for PTY/terminal functionality which relies on native libraries. The current workaround requires manual intervention that breaks the "just work" experience that OpenCode aims to provide with local plugins. The issue affects the opencode-pty plugin development workflow, making it difficult to test local changes without manual setup steps.
yindo added the nix label 2026-02-16 18:07:33 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Jan 25, 2026):

This issue appears to be related to plugin dependency path resolution, similar in nature to other plugin-related issues, but it is distinct in that it specifically addresses the missing search path for native libraries (librust_pty.so) when bun-pty is installed as a dependency in .opencode/node_modules/.

You may want to check the following related issues for additional context on plugin system limitations:

  • #8006: @opencode-ai/plugin: ESM imports missing .js extension breaks plugin loading
  • #5914: NixOS: custom tools fail because they cannot find imported modules

These don't directly solve your issue but represent ongoing challenges with the plugin dependency resolution system.

@github-actions[bot] commented on GitHub (Jan 25, 2026): This issue appears to be related to plugin dependency path resolution, similar in nature to other plugin-related issues, but it is distinct in that it specifically addresses the missing search path for native libraries (librust_pty.so) when bun-pty is installed as a dependency in .opencode/node_modules/. You may want to check the following related issues for additional context on plugin system limitations: - #8006: @opencode-ai/plugin: ESM imports missing .js extension breaks plugin loading - #5914: NixOS: custom tools fail because they cannot find imported modules These don't directly solve your issue but represent ongoing challenges with the plugin dependency resolution system.
Author
Owner

@MBanucu commented on GitHub (Jan 25, 2026):

🐛 Plugin Dependency Path Resolution: Mixed Results

Plugin Loading is Functional

The plugin system successfully loads plugins with npm dependencies. JavaScript/TypeScript imports work perfectly, and plugins can register hooks and execute normally.

What's Working

  • Plugin loads and initializes correctly
  • bun-pty JavaScript/TypeScript imports work perfectly
  • Dependencies install to .opencode/node_modules/ as expected
  • Plugin hooks register and execute normally

🔍 Native Library Resolution: Inconsistent

  • Native library librust_pty.so IS present at:
    .opencode/node_modules/bun-pty/rust-pty/target/release/librust_pty.so
    
  • OpenCode searches hardcoded paths excluding .opencode/node_modules/
  • PTY spawning succeeds in some workspaces, fails in others (unexpected inconsistency)

📊 Test Results from Different Workspaces

Workspace A (test-workspace-bun-pty/):

🐚 BunPtyPlugin loaded - testing bun-pty integration
✅ Successfully imported spawn from bun-pty  
🔧 Attempting to spawn PTY process...
✅ PTY spawned successfully!

Workspace B (test-workspace/ with opencode-pty):

librust_pty shared library not found.
Checked: [paths excluding .opencode/node_modules/]
Error: Unexpected error

🤔 This Suggests

  1. Plugin system works for JavaScript dependencies
  2. Native library path issue exists but not always critical 🔍
  3. Inconsistent resolution - some configurations work, others don't
  4. Path resolution logic should include .opencode/node_modules/ for consistency

📁 Test Workspaces Available

Created workspaces demonstrating both working and failing PTY scenarios for testing fixes.

Impact: Creates unpredictable behavior for plugins requiring native libraries.

@MBanucu commented on GitHub (Jan 25, 2026): ## 🐛 **Plugin Dependency Path Resolution: Mixed Results** ### **Plugin Loading is Functional** ✅ The plugin system successfully loads plugins with npm dependencies. JavaScript/TypeScript imports work perfectly, and plugins can register hooks and execute normally. ### **✅ What's Working** - Plugin loads and initializes correctly - `bun-pty` JavaScript/TypeScript imports work perfectly - Dependencies install to `.opencode/node_modules/` as expected - Plugin hooks register and execute normally ### **🔍 Native Library Resolution: Inconsistent** - Native library `librust_pty.so` **IS present** at: ``` .opencode/node_modules/bun-pty/rust-pty/target/release/librust_pty.so ``` - OpenCode searches hardcoded paths excluding `.opencode/node_modules/` - **PTY spawning succeeds in some workspaces, fails in others** (unexpected inconsistency) ### **📊 Test Results from Different Workspaces** **Workspace A (test-workspace-bun-pty/):** ``` 🐚 BunPtyPlugin loaded - testing bun-pty integration ✅ Successfully imported spawn from bun-pty 🔧 Attempting to spawn PTY process... ✅ PTY spawned successfully! ``` **Workspace B (test-workspace/ with opencode-pty):** ``` librust_pty shared library not found. Checked: [paths excluding .opencode/node_modules/] Error: Unexpected error ``` ### **🤔 This Suggests** 1. **Plugin system works** for JavaScript dependencies ✅ 2. **Native library path issue exists** but **not always critical** 🔍 3. **Inconsistent resolution** - some configurations work, others don't 4. **Path resolution logic** should include `.opencode/node_modules/` for consistency ### **📁 Test Workspaces Available** Created workspaces demonstrating both working and failing PTY scenarios for testing fixes. **Impact**: Creates unpredictable behavior for plugins requiring native libraries.
Author
Owner

@MBanucu commented on GitHub (Jan 25, 2026):

Investigation findings: The native library path resolution bug occurs when plugins are bundled with bun build --target bun. The bun-pty library checks specific paths that exclude .opencode/node_modules/, where dependencies are installed for OpenCode plugins. This triggers immediate library loading at module import time in bundled plugins, unlike unbundled scripts. MWE created and confirms the issue. Potential fixes: update bun-pty paths, set NODE_PATH/BUN_PTY_LIB in OpenCode, or modify test scripts to set BUN_PTY_LIB.

@MBanucu commented on GitHub (Jan 25, 2026): Investigation findings: The native library path resolution bug occurs when plugins are bundled with `bun build --target bun`. The bun-pty library checks specific paths that exclude `.opencode/node_modules/`, where dependencies are installed for OpenCode plugins. This triggers immediate library loading at module import time in bundled plugins, unlike unbundled scripts. MWE created and confirms the issue. Potential fixes: update bun-pty paths, set NODE_PATH/BUN_PTY_LIB in OpenCode, or modify test scripts to set BUN_PTY_LIB.
Author
Owner

@MBanucu commented on GitHub (Jan 25, 2026):

test-bun-pty-path-resolution.sh

#!/usr/bin/env bash

# Test script to reproduce bun-pty library path resolution bug
# Sets up a minimal test workspace and checks if the issue occurs

set -e

ROOT_DIR="$(pwd)"
TEST_DIR="$ROOT_DIR/test-workspace-bug"
LOG_FILE="$TEST_DIR/test-results.log"

echo "🏗️ Building test workspace in: $TEST_DIR"

# Clean up
rm -rf "$TEST_DIR" "$LOG_FILE"

# Create workspace
mkdir -p "$TEST_DIR/.opencode/plugins"

# Create package.json for bun-pty dependency
cat > "$TEST_DIR/.opencode/package.json" << 'EOF'
{
  "dependencies": {
    "bun-pty": "^0.4.8"
  }
}
EOF

echo "📦 Installing bun-pty dependency..."
cd "$TEST_DIR/.opencode"
bun install > /dev/null 2>&1
cd ../..

# Create a simple plugin that uses bun-pty
cat > "$TEST_DIR/.opencode/index.ts" << 'EOF'
import { spawn } from 'bun-pty'

// Force library loading at module load time
const test = spawn('echo', ['hello'])

export const TestPlugin = async ({ client }) => {
  return {
    tool: {
      test_pty: async () => {
        return 'PTY test completed'
      }
    }
  }
}
EOF

echo "🔨 Building test plugin..."
cd "$TEST_DIR/.opencode"
bun build --target bun --outfile plugins/test-pty.js index.ts > /dev/null 2>&1
cd ../..


echo "📁 Initial workspace structure:"
cd "$TEST_DIR"
tree -a -L 3 --dirsfirst

echo "🧪 Running automated test..."
cd "$TEST_DIR"
opencode debug wait > test-results.log 2>&1 &
OPENCODE_PID=$!
echo "OpenCode PID: $OPENCODE_PID"
cd ..

echo "⏳ Waiting 5 seconds for plugin initialization..."
sleep 5

echo "🛑 Stopping OpenCode..."
kill "$OPENCODE_PID" 2>/dev/null || true

echo "📊 Analyzing test results..."

passed=true
# Check for the specific error
if grep -q "librust_pty shared library not found" "$TEST_DIR/test-results.log"; then
    echo "🐛 BUG CONFIRMED: Native library path resolution failure"
    
    echo "Checked paths:"
    grep -A 10 "librust_pty shared library not found" "$TEST_DIR/test-results.log" | tail -n +2 | head -n 10 || echo "Log not accessible"
    
    echo ""
    echo "But the library IS present at:"
    find "$TEST_DIR/.opencode" -name "librust_pty.so" 2>/dev/null || echo "Library not found in workspace"
    
    echo ""
    echo "📄 Complete log output:"
    echo "======================"
    cat "$TEST_DIR/test-results.log"
    passed=false
else
    echo "✅ No bug detected - library loaded successfully"
fi

echo "📁 Final workspace structure:"
cd "$TEST_DIR"
tree -a -L 3 --dirsfirst

if [ "$passed" = true ]; then
    echo "🎉 Test passed successfully!"
else
    echo "❌ Test failed due to bug."
fi

output


[michi@nixos:~/dev/opencode-pty-branches/web-ui]$ ./test-bun-pty-path-resolution.sh 
🏗️ Building test workspace in: /home/michi/dev/opencode-pty-branches/web-ui/test-workspace-bug
📦 Installing bun-pty dependency...
🔨 Building test plugin...
📁 Initial workspace structure:
.
└── .opencode
    ├── node_modules
    │   └── bun-pty
    ├── plugins
    │   └── test-pty.js
    ├── bun.lock
    ├── index.ts
    └── package.json

5 directories, 4 files
🧪 Running automated test...
OpenCode PID: 230084
⏳ Waiting 5 seconds for plugin initialization...
🛑 Stopping OpenCode...
📊 Analyzing test results...
🐛 BUG CONFIRMED: Native library path resolution failure
Checked paths:
Checked:
  - BUN_PTY_LIB=<unset>
  - /home/michi/dev/opencode-pty-branches/web-ui/test-workspace-bug/.opencode/plugins/rust-pty/target/release/librust_pty.so
  - /home/michi/dev/opencode-pty-branches/web-ui/test-workspace-bug/.opencode/bun-pty/rust-pty/target/release/librust_pty.so
  - /home/michi/dev/opencode-pty-branches/web-ui/test-workspace-bug/node_modules/bun-pty/rust-pty/target/release/librust_pty.so

Set BUN_PTY_LIB or ensure one of these paths contains the file.
Error: Unexpected error, check log file at /home/michi/.local/share/opencode/log/dev.log for more details


But the library IS present at:
/home/michi/dev/opencode-pty-branches/web-ui/test-workspace-bug/.opencode/node_modules/bun-pty/rust-pty/target/release/librust_pty.so

📄 Complete log output:
======================
INFO  2026-01-25T17:22:58 +14ms service=models.dev file={} refreshing
librust_pty shared library not found.
Checked:
  - BUN_PTY_LIB=<unset>
  - /home/michi/dev/opencode-pty-branches/web-ui/test-workspace-bug/.opencode/plugins/rust-pty/target/release/librust_pty.so
  - /home/michi/dev/opencode-pty-branches/web-ui/test-workspace-bug/.opencode/bun-pty/rust-pty/target/release/librust_pty.so
  - /home/michi/dev/opencode-pty-branches/web-ui/test-workspace-bug/node_modules/bun-pty/rust-pty/target/release/librust_pty.so

Set BUN_PTY_LIB or ensure one of these paths contains the file.
Error: Unexpected error, check log file at /home/michi/.local/share/opencode/log/dev.log for more details

📁 Final workspace structure:
.
├── .opencode
│   ├── node_modules
│   │   ├── bun-pty
│   │   ├── @opencode-ai
│   │   └── zod
│   ├── plugins
│   │   └── test-pty.js
│   ├── bun.lock
│   ├── .gitignore
│   ├── index.ts
│   └── package.json
└── test-results.log

7 directories, 6 files
❌ Test failed due to bug.

[michi@nixos:~/dev/opencode-pty-branches/web-ui]$ 
@MBanucu commented on GitHub (Jan 25, 2026): ### `test-bun-pty-path-resolution.sh` ```bash #!/usr/bin/env bash # Test script to reproduce bun-pty library path resolution bug # Sets up a minimal test workspace and checks if the issue occurs set -e ROOT_DIR="$(pwd)" TEST_DIR="$ROOT_DIR/test-workspace-bug" LOG_FILE="$TEST_DIR/test-results.log" echo "🏗️ Building test workspace in: $TEST_DIR" # Clean up rm -rf "$TEST_DIR" "$LOG_FILE" # Create workspace mkdir -p "$TEST_DIR/.opencode/plugins" # Create package.json for bun-pty dependency cat > "$TEST_DIR/.opencode/package.json" << 'EOF' { "dependencies": { "bun-pty": "^0.4.8" } } EOF echo "📦 Installing bun-pty dependency..." cd "$TEST_DIR/.opencode" bun install > /dev/null 2>&1 cd ../.. # Create a simple plugin that uses bun-pty cat > "$TEST_DIR/.opencode/index.ts" << 'EOF' import { spawn } from 'bun-pty' // Force library loading at module load time const test = spawn('echo', ['hello']) export const TestPlugin = async ({ client }) => { return { tool: { test_pty: async () => { return 'PTY test completed' } } } } EOF echo "🔨 Building test plugin..." cd "$TEST_DIR/.opencode" bun build --target bun --outfile plugins/test-pty.js index.ts > /dev/null 2>&1 cd ../.. echo "📁 Initial workspace structure:" cd "$TEST_DIR" tree -a -L 3 --dirsfirst echo "🧪 Running automated test..." cd "$TEST_DIR" opencode debug wait > test-results.log 2>&1 & OPENCODE_PID=$! echo "OpenCode PID: $OPENCODE_PID" cd .. echo "⏳ Waiting 5 seconds for plugin initialization..." sleep 5 echo "🛑 Stopping OpenCode..." kill "$OPENCODE_PID" 2>/dev/null || true echo "📊 Analyzing test results..." passed=true # Check for the specific error if grep -q "librust_pty shared library not found" "$TEST_DIR/test-results.log"; then echo "🐛 BUG CONFIRMED: Native library path resolution failure" echo "Checked paths:" grep -A 10 "librust_pty shared library not found" "$TEST_DIR/test-results.log" | tail -n +2 | head -n 10 || echo "Log not accessible" echo "" echo "But the library IS present at:" find "$TEST_DIR/.opencode" -name "librust_pty.so" 2>/dev/null || echo "Library not found in workspace" echo "" echo "📄 Complete log output:" echo "======================" cat "$TEST_DIR/test-results.log" passed=false else echo "✅ No bug detected - library loaded successfully" fi echo "📁 Final workspace structure:" cd "$TEST_DIR" tree -a -L 3 --dirsfirst if [ "$passed" = true ]; then echo "🎉 Test passed successfully!" else echo "❌ Test failed due to bug." fi ``` ### output ```console [michi@nixos:~/dev/opencode-pty-branches/web-ui]$ ./test-bun-pty-path-resolution.sh 🏗️ Building test workspace in: /home/michi/dev/opencode-pty-branches/web-ui/test-workspace-bug 📦 Installing bun-pty dependency... 🔨 Building test plugin... 📁 Initial workspace structure: . └── .opencode ├── node_modules │ └── bun-pty ├── plugins │ └── test-pty.js ├── bun.lock ├── index.ts └── package.json 5 directories, 4 files 🧪 Running automated test... OpenCode PID: 230084 ⏳ Waiting 5 seconds for plugin initialization... 🛑 Stopping OpenCode... 📊 Analyzing test results... 🐛 BUG CONFIRMED: Native library path resolution failure Checked paths: Checked: - BUN_PTY_LIB=<unset> - /home/michi/dev/opencode-pty-branches/web-ui/test-workspace-bug/.opencode/plugins/rust-pty/target/release/librust_pty.so - /home/michi/dev/opencode-pty-branches/web-ui/test-workspace-bug/.opencode/bun-pty/rust-pty/target/release/librust_pty.so - /home/michi/dev/opencode-pty-branches/web-ui/test-workspace-bug/node_modules/bun-pty/rust-pty/target/release/librust_pty.so Set BUN_PTY_LIB or ensure one of these paths contains the file. Error: Unexpected error, check log file at /home/michi/.local/share/opencode/log/dev.log for more details But the library IS present at: /home/michi/dev/opencode-pty-branches/web-ui/test-workspace-bug/.opencode/node_modules/bun-pty/rust-pty/target/release/librust_pty.so 📄 Complete log output: ====================== INFO 2026-01-25T17:22:58 +14ms service=models.dev file={} refreshing librust_pty shared library not found. Checked: - BUN_PTY_LIB=<unset> - /home/michi/dev/opencode-pty-branches/web-ui/test-workspace-bug/.opencode/plugins/rust-pty/target/release/librust_pty.so - /home/michi/dev/opencode-pty-branches/web-ui/test-workspace-bug/.opencode/bun-pty/rust-pty/target/release/librust_pty.so - /home/michi/dev/opencode-pty-branches/web-ui/test-workspace-bug/node_modules/bun-pty/rust-pty/target/release/librust_pty.so Set BUN_PTY_LIB or ensure one of these paths contains the file. Error: Unexpected error, check log file at /home/michi/.local/share/opencode/log/dev.log for more details 📁 Final workspace structure: . ├── .opencode │ ├── node_modules │ │ ├── bun-pty │ │ ├── @opencode-ai │ │ └── zod │ ├── plugins │ │ └── test-pty.js │ ├── bun.lock │ ├── .gitignore │ ├── index.ts │ └── package.json └── test-results.log 7 directories, 6 files ❌ Test failed due to bug. [michi@nixos:~/dev/opencode-pty-branches/web-ui]$ ```
Author
Owner

@MBanucu commented on GitHub (Jan 25, 2026):

test-bun-pty-path-resolution-no-bundle.sh

#!/usr/bin/env bash

# Test script to reproduce bun-pty library path resolution bug
# Sets up a minimal test workspace and checks if the issue occurs

set -e

ROOT_DIR="$(pwd)"
TEST_DIR="$ROOT_DIR/test-workspace-bug"
LOG_FILE="$TEST_DIR/test-results.log"

echo "🏗️ Building test workspace in: $TEST_DIR"

# Clean up
rm -rf "$TEST_DIR" "$LOG_FILE"

# Create workspace
mkdir -p "$TEST_DIR/.opencode/plugins"

# Create package.json for bun-pty dependency
cat > "$TEST_DIR/.opencode/package.json" << 'EOF'
{
  "dependencies": {
    "bun-pty": "^0.4.8"
  }
}
EOF

echo "📦 Installing bun-pty dependency..."
cd "$TEST_DIR/.opencode"
bun install > /dev/null 2>&1
cd ../..

# Create a simple plugin that uses bun-pty
cat > "$TEST_DIR/.opencode/index.ts" << 'EOF'
import { spawn } from 'bun-pty'

// Force library loading at module load time
const test = spawn('echo', ['hello'])

// test plugin loaded by OpenCode
console.log("Test plugin loaded, bun-pty spawn executed at module load time");

export const TestPlugin = async ({ client }) => {
  return {
    tool: {
      test_pty: async () => {
        return 'PTY test completed'
      }
    }
  }
}
EOF

echo "🔨 Building test plugin..."
cd "$TEST_DIR/.opencode"
cp index.ts plugins/test-pty.ts


echo "📁 Initial workspace structure:"
cd "$TEST_DIR"
tree -a -L 3 --dirsfirst

echo "🧪 Running automated test..."
cd "$TEST_DIR"
opencode debug wait > test-results.log 2>&1 &
OPENCODE_PID=$!
echo "OpenCode PID: $OPENCODE_PID"
cd ..

echo "⏳ Waiting 5 seconds for plugin initialization..."
sleep 5

echo "🛑 Stopping OpenCode..."
kill "$OPENCODE_PID" 2>/dev/null || true

echo "📊 Analyzing test results..."

passed=true
# Check for the specific error
if grep -q "librust_pty shared library not found" "$TEST_DIR/test-results.log"; then
    echo "🐛 BUG CONFIRMED: Native library path resolution failure"
    
    echo "Checked paths:"
    grep -A 10 "librust_pty shared library not found" "$TEST_DIR/test-results.log" | tail -n +2 | head -n 10 || echo "Log not accessible"
    
    echo ""
    echo "But the library IS present at:"
    find "$TEST_DIR/.opencode" -name "librust_pty.so" 2>/dev/null || echo "Library not found in workspace"
    
    passed=false
else
    echo "✅ No bug detected - library loaded successfully"
fi

echo ""
echo "📄 Complete log output:"
echo "======================"
cat "$TEST_DIR/test-results.log"

echo ""
echo "📁 Final workspace structure:"
cd "$TEST_DIR"
tree -a -L 3 --dirsfirst

if [ "$passed" = true ]; then
    echo "🎉 Test passed successfully!"
else
    echo "❌ Test failed due to bug."
fi

output


[michi@nixos:~/dev/opencode-pty-branches/web-ui]$ ./test-bun-pty-path-resolution-no-bundle.sh
🏗️ Building test workspace in: /home/michi/dev/opencode-pty-branches/web-ui/test-workspace-bug
📦 Installing bun-pty dependency...
🔨 Building test plugin...
📁 Initial workspace structure:
.
└── .opencode
    ├── node_modules
    │   └── bun-pty
    ├── plugins
    │   └── test-pty.ts
    ├── bun.lock
    ├── index.ts
    └── package.json

5 directories, 4 files
🧪 Running automated test...
OpenCode PID: 234675
⏳ Waiting 5 seconds for plugin initialization...
🛑 Stopping OpenCode...
📊 Analyzing test results...
✅ No bug detected - library loaded successfully

📄 Complete log output:
======================
INFO  2026-01-25T17:30:18 +14ms service=models.dev file={} refreshing
Test plugin loaded, bun-pty spawn executed at module load time

📁 Final workspace structure:
.
├── .opencode
│   ├── node_modules
│   │   ├── bun-pty
│   │   ├── @opencode-ai
│   │   └── zod
│   ���── plugins
│   │   └── test-pty.ts
│   ├── bun.lock
│   ├── .gitignore
│   ├── index.ts
│   └── package.json
└── test-results.log

7 directories, 6 files
🎉 Test passed successfully!

[michi@nixos:~/dev/opencode-pty-branches/web-ui]$ 
@MBanucu commented on GitHub (Jan 25, 2026): ### `test-bun-pty-path-resolution-no-bundle.sh` ```bash #!/usr/bin/env bash # Test script to reproduce bun-pty library path resolution bug # Sets up a minimal test workspace and checks if the issue occurs set -e ROOT_DIR="$(pwd)" TEST_DIR="$ROOT_DIR/test-workspace-bug" LOG_FILE="$TEST_DIR/test-results.log" echo "🏗️ Building test workspace in: $TEST_DIR" # Clean up rm -rf "$TEST_DIR" "$LOG_FILE" # Create workspace mkdir -p "$TEST_DIR/.opencode/plugins" # Create package.json for bun-pty dependency cat > "$TEST_DIR/.opencode/package.json" << 'EOF' { "dependencies": { "bun-pty": "^0.4.8" } } EOF echo "📦 Installing bun-pty dependency..." cd "$TEST_DIR/.opencode" bun install > /dev/null 2>&1 cd ../.. # Create a simple plugin that uses bun-pty cat > "$TEST_DIR/.opencode/index.ts" << 'EOF' import { spawn } from 'bun-pty' // Force library loading at module load time const test = spawn('echo', ['hello']) // test plugin loaded by OpenCode console.log("Test plugin loaded, bun-pty spawn executed at module load time"); export const TestPlugin = async ({ client }) => { return { tool: { test_pty: async () => { return 'PTY test completed' } } } } EOF echo "🔨 Building test plugin..." cd "$TEST_DIR/.opencode" cp index.ts plugins/test-pty.ts echo "📁 Initial workspace structure:" cd "$TEST_DIR" tree -a -L 3 --dirsfirst echo "🧪 Running automated test..." cd "$TEST_DIR" opencode debug wait > test-results.log 2>&1 & OPENCODE_PID=$! echo "OpenCode PID: $OPENCODE_PID" cd .. echo "⏳ Waiting 5 seconds for plugin initialization..." sleep 5 echo "🛑 Stopping OpenCode..." kill "$OPENCODE_PID" 2>/dev/null || true echo "📊 Analyzing test results..." passed=true # Check for the specific error if grep -q "librust_pty shared library not found" "$TEST_DIR/test-results.log"; then echo "🐛 BUG CONFIRMED: Native library path resolution failure" echo "Checked paths:" grep -A 10 "librust_pty shared library not found" "$TEST_DIR/test-results.log" | tail -n +2 | head -n 10 || echo "Log not accessible" echo "" echo "But the library IS present at:" find "$TEST_DIR/.opencode" -name "librust_pty.so" 2>/dev/null || echo "Library not found in workspace" passed=false else echo "✅ No bug detected - library loaded successfully" fi echo "" echo "📄 Complete log output:" echo "======================" cat "$TEST_DIR/test-results.log" echo "" echo "📁 Final workspace structure:" cd "$TEST_DIR" tree -a -L 3 --dirsfirst if [ "$passed" = true ]; then echo "🎉 Test passed successfully!" else echo "❌ Test failed due to bug." fi ``` ### output ```console [michi@nixos:~/dev/opencode-pty-branches/web-ui]$ ./test-bun-pty-path-resolution-no-bundle.sh 🏗️ Building test workspace in: /home/michi/dev/opencode-pty-branches/web-ui/test-workspace-bug 📦 Installing bun-pty dependency... 🔨 Building test plugin... 📁 Initial workspace structure: . └── .opencode ├── node_modules │ └── bun-pty ├── plugins │ └── test-pty.ts ├── bun.lock ├── index.ts └── package.json 5 directories, 4 files 🧪 Running automated test... OpenCode PID: 234675 ⏳ Waiting 5 seconds for plugin initialization... 🛑 Stopping OpenCode... 📊 Analyzing test results... ✅ No bug detected - library loaded successfully 📄 Complete log output: ====================== INFO 2026-01-25T17:30:18 +14ms service=models.dev file={} refreshing Test plugin loaded, bun-pty spawn executed at module load time 📁 Final workspace structure: . ├── .opencode │ ├── node_modules │ │ ├── bun-pty │ │ ├── @opencode-ai │ │ └── zod │ ���── plugins │ │ └── test-pty.ts │ ├── bun.lock │ ├── .gitignore │ ├── index.ts │ └── package.json └── test-results.log 7 directories, 6 files 🎉 Test passed successfully! [michi@nixos:~/dev/opencode-pty-branches/web-ui]$ ```
Author
Owner

@MBanucu commented on GitHub (Jan 25, 2026):

So without bundling with bun it works.

@MBanucu commented on GitHub (Jan 25, 2026): So without bundling with bun it works.
Author
Owner

@MBanucu commented on GitHub (Jan 25, 2026):

Conclusion: bun-pty has a path resolution bug

Based on comprehensive testing of multiple Rust-based Node.js libraries:

Confirmed Bug:

  • bun-pty fails to load its native librust_pty.so library when bundled
  • Path resolution logic in resolveLibPath() doesn't handle plugin subdirectories or bundled environments correctly
  • Works in non-bundled scenarios but breaks when plugins are built with bun build

Other Libraries Work Fine:

  • @swc/core, nodejs-polars, and bun-webgpu all bundle successfully
  • Their native libraries load properly after bundling
  • They handle path resolution correctly in all scenarios

Root Cause:

The issue is specifically in bun-pty's resolveLibPath() function. It calculates incorrect paths when import.meta.url changes after bundling, and doesn't check the local node_modules directory where the library is actually installed.

Required Fix:

The bun-pty library needs to update its path resolution logic to:

  1. Properly handle bundled plugin scenarios where import.meta.url points to the output directory
  2. Check local node_modules paths relative to the plugin location
  3. Match the successful pattern used by other Rust libraries

This is not a Bun bundling issue - it's a bun-pty library bug that affects plugin developers using bundled PTY functionality.

@MBanucu commented on GitHub (Jan 25, 2026): ## Conclusion: **bun-pty has a path resolution bug** Based on comprehensive testing of multiple Rust-based Node.js libraries: ### **Confirmed Bug:** - **bun-pty** fails to load its native `librust_pty.so` library when bundled - Path resolution logic in `resolveLibPath()` doesn't handle plugin subdirectories or bundled environments correctly - Works in non-bundled scenarios but breaks when plugins are built with `bun build` ### **Other Libraries Work Fine:** - **@swc/core**, **nodejs-polars**, and **bun-webgpu** all bundle successfully - Their native libraries load properly after bundling - They handle path resolution correctly in all scenarios ### **Root Cause:** The issue is specifically in **bun-pty's `resolveLibPath()` function**. It calculates incorrect paths when `import.meta.url` changes after bundling, and doesn't check the local `node_modules` directory where the library is actually installed. ### **Required Fix:** The bun-pty library needs to update its path resolution logic to: 1. Properly handle bundled plugin scenarios where `import.meta.url` points to the output directory 2. Check local `node_modules` paths relative to the plugin location 3. Match the successful pattern used by other Rust libraries This is **not a Bun bundling issue** - it's a **bun-pty library bug** that affects plugin developers using bundled PTY functionality.
Author
Owner

@MBanucu commented on GitHub (Jan 25, 2026):

test-opencode-plugin-structure.sh


[michi@nixos:~/dev/opencode-pty-branches/web-ui/test-path-resolution]$ ./test-opencode-plugin-structure.sh
🏗️ Creating test with accurate OpenCode plugin directory structure...
📦 Installing all test libraries in .opencode directory...
bun install v1.3.6 (d530ed99)

+ @swc/core@1.15.10
+ @swc/wasm@1.15.10
+ bun-pty@0.4.8
+ bun-webgpu@0.1.4
+ nodejs-polars@0.23.5

13 packages installed [812.00ms]

Blocked 1 postinstall. Run `bun pm untrusted` for details.
📝 Creating plugin files...
🔨 Bundling all plugins to .opencode/plugins/...
Bundled 50 modules in 325ms

  pty-plugin.js                               7.42 KB    (entry point)
  swc-plugin.js                               57.29 KB   (entry point)
  polars-plugin.js                            191.38 KB  (entry point)
  webgpu-plugin.js                            141.76 KB  (entry point)
  swc.linux-x64-musl-6pgn0whf.node            33.36 MB   (asset)
  swc.linux-x64-gnu-sahd8y4e.node             28.53 MB   (asset)
  nodejs-polars.linux-x64-musl-mvjn9sc3.node  92.46 MB   (asset)
  nodejs-polars.linux-x64-gnu-wxjcjb86.node   92.64 MB   (asset)

📁 Plugin structure (mimicking OpenCode):
.
└── .opencode
    ├── node_modules
    │   ├── bun-pty
    │   ├── bun-webgpu
    │   ├── bun-webgpu-linux-x64
    │   ├── nodejs-polars
    │   ├── nodejs-polars-linux-x64-gnu
    │   ├── nodejs-polars-linux-x64-musl
    │   ├── @swc
    │   └── @webgpu
    ├── plugins
    │   ├── nodejs-polars.linux-x64-gnu-wxjcjb86.node
    │   ├── nodejs-polars.linux-x64-musl-mvjn9sc3.node
    │   ├── polars-plugin.js
    │   ├── pty-plugin.js
    │   ├── swc.linux-x64-gnu-sahd8y4e.node
    │   ├── swc.linux-x64-musl-6pgn0whf.node
    │   ├── swc-plugin.js
    │   └── webgpu-plugin.js
    ├── bun.lock
    ├── package.json
    ├── polars-plugin.js
    ├── pty-plugin.js
    ├── swc-plugin.js
    └── webgpu-plugin.js

12 directories, 14 files
🧪 Testing bundled plugins (like OpenCode would load them)...

Testing PtyPlugin from pty-plugin.js...
Loading bundled plugin...
❌ PtyPlugin failed to load: librust_pty shared library not found.
Checked:
  - BUN_PTY_LIB=<unset>
  - /home/michi/dev/opencode-pty-branches/web-ui/test-path-resolution/test-opencode-plugin-structure/.opencode/plugins/rust-pty/target/release/librust_pty.so
  - /home/michi/dev/opencode-pty-branches/web-ui/test-path-resolution/test-opencode-plugin-structure/.opencode/bun-pty/rust-pty/target/release/librust_pty.so
  - /home/michi/dev/opencode-pty-branches/web-ui/test-path-resolution/test-opencode-plugin-structure/node_modules/bun-pty/rust-pty/target/release/librust_pty.so

Set BUN_PTY_LIB or ensure one of these paths contains the file.
Full error: 84 |     }
85 |   }
86 |   for (const path of fallbackPaths) {
87 |     if (existsSync(path))
88 |       return path;
89 |   throw new Error(`librust_pty shared library not found.
             ^
error: librust_pty shared library not found.
Checked:
  - BUN_PTY_LIB=<unset>
  - /home/michi/dev/opencode-pty-branches/web-ui/test-path-resolution/test-opencode-plugin-structure/.opencode/plugins/rust-pty/target/release/librust_pty.so
  - /home/michi/dev/opencode-pty-branches/web-ui/test-path-resolution/test-opencode-plugin-structure/.opencode/bun-pty/rust-pty/target/release/librust_pty.so
  - /home/michi/dev/opencode-pty-branches/web-ui/test-path-resolution/test-opencode-plugin-structure/node_modules/bun-pty/rust-pty/target/release/librust_pty.so

Set BUN_PTY_LIB or ensure one of these paths contains the file.
      at resolveLibPath (/home/michi/dev/opencode-pty-branches/web-ui/test-path-resolution/test-opencode-plugin-structure/.opencode/plugins/pty-plugin.js:89:9)
      at /home/michi/dev/opencode-pty-branches/web-ui/test-path-resolution/test-opencode-plugin-structure/.opencode/plugins/pty-plugin.js:97:29
      at requestImportModule (2:1)


Testing SwcPlugin from swc-plugin.js...
Loading bundled plugin...
✅ SwcPlugin loaded successfully
Plugin tools: [ "test_swc" ]

Testing PolarsPlugin from polars-plugin.js...
Loading bundled plugin...
✅ PolarsPlugin loaded successfully
Plugin tools: [ "test_polars" ]

Testing WebGPUPlugin from webgpu-plugin.js...
Loading bundled plugin...
✅ WebGPUPlugin loaded successfully
Plugin tools: [ "test_webgpu" ]

📊 Results Summary:
This test accurately reproduces the OpenCode plugin loading scenario
If bun-pty fails while others succeed, it confirms the issue is isolated to bun-pty's path resolution in plugin subdirectory scenarios

[michi@nixos:~/dev/opencode-pty-branches/web-ui/test-path-resolution]$ 
@MBanucu commented on GitHub (Jan 25, 2026): [test-opencode-plugin-structure.sh](https://github.com/user-attachments/files/24848367/test-opencode-plugin-structure.sh) ```console [michi@nixos:~/dev/opencode-pty-branches/web-ui/test-path-resolution]$ ./test-opencode-plugin-structure.sh 🏗️ Creating test with accurate OpenCode plugin directory structure... 📦 Installing all test libraries in .opencode directory... bun install v1.3.6 (d530ed99) + @swc/core@1.15.10 + @swc/wasm@1.15.10 + bun-pty@0.4.8 + bun-webgpu@0.1.4 + nodejs-polars@0.23.5 13 packages installed [812.00ms] Blocked 1 postinstall. Run `bun pm untrusted` for details. 📝 Creating plugin files... 🔨 Bundling all plugins to .opencode/plugins/... Bundled 50 modules in 325ms pty-plugin.js 7.42 KB (entry point) swc-plugin.js 57.29 KB (entry point) polars-plugin.js 191.38 KB (entry point) webgpu-plugin.js 141.76 KB (entry point) swc.linux-x64-musl-6pgn0whf.node 33.36 MB (asset) swc.linux-x64-gnu-sahd8y4e.node 28.53 MB (asset) nodejs-polars.linux-x64-musl-mvjn9sc3.node 92.46 MB (asset) nodejs-polars.linux-x64-gnu-wxjcjb86.node 92.64 MB (asset) 📁 Plugin structure (mimicking OpenCode): . └── .opencode ├── node_modules │ ├── bun-pty │ ├── bun-webgpu │ ├── bun-webgpu-linux-x64 │ ├── nodejs-polars │ ├── nodejs-polars-linux-x64-gnu │ ├── nodejs-polars-linux-x64-musl │ ├── @swc │ └── @webgpu ├── plugins │ ├── nodejs-polars.linux-x64-gnu-wxjcjb86.node │ ├── nodejs-polars.linux-x64-musl-mvjn9sc3.node │ ├── polars-plugin.js │ ├── pty-plugin.js │ ├── swc.linux-x64-gnu-sahd8y4e.node │ ├── swc.linux-x64-musl-6pgn0whf.node │ ├── swc-plugin.js │ └── webgpu-plugin.js ├── bun.lock ├── package.json ├── polars-plugin.js ├── pty-plugin.js ├── swc-plugin.js └── webgpu-plugin.js 12 directories, 14 files 🧪 Testing bundled plugins (like OpenCode would load them)... Testing PtyPlugin from pty-plugin.js... Loading bundled plugin... ❌ PtyPlugin failed to load: librust_pty shared library not found. Checked: - BUN_PTY_LIB=<unset> - /home/michi/dev/opencode-pty-branches/web-ui/test-path-resolution/test-opencode-plugin-structure/.opencode/plugins/rust-pty/target/release/librust_pty.so - /home/michi/dev/opencode-pty-branches/web-ui/test-path-resolution/test-opencode-plugin-structure/.opencode/bun-pty/rust-pty/target/release/librust_pty.so - /home/michi/dev/opencode-pty-branches/web-ui/test-path-resolution/test-opencode-plugin-structure/node_modules/bun-pty/rust-pty/target/release/librust_pty.so Set BUN_PTY_LIB or ensure one of these paths contains the file. Full error: 84 | } 85 | } 86 | for (const path of fallbackPaths) { 87 | if (existsSync(path)) 88 | return path; 89 | throw new Error(`librust_pty shared library not found. ^ error: librust_pty shared library not found. Checked: - BUN_PTY_LIB=<unset> - /home/michi/dev/opencode-pty-branches/web-ui/test-path-resolution/test-opencode-plugin-structure/.opencode/plugins/rust-pty/target/release/librust_pty.so - /home/michi/dev/opencode-pty-branches/web-ui/test-path-resolution/test-opencode-plugin-structure/.opencode/bun-pty/rust-pty/target/release/librust_pty.so - /home/michi/dev/opencode-pty-branches/web-ui/test-path-resolution/test-opencode-plugin-structure/node_modules/bun-pty/rust-pty/target/release/librust_pty.so Set BUN_PTY_LIB or ensure one of these paths contains the file. at resolveLibPath (/home/michi/dev/opencode-pty-branches/web-ui/test-path-resolution/test-opencode-plugin-structure/.opencode/plugins/pty-plugin.js:89:9) at /home/michi/dev/opencode-pty-branches/web-ui/test-path-resolution/test-opencode-plugin-structure/.opencode/plugins/pty-plugin.js:97:29 at requestImportModule (2:1) Testing SwcPlugin from swc-plugin.js... Loading bundled plugin... ✅ SwcPlugin loaded successfully Plugin tools: [ "test_swc" ] Testing PolarsPlugin from polars-plugin.js... Loading bundled plugin... ✅ PolarsPlugin loaded successfully Plugin tools: [ "test_polars" ] Testing WebGPUPlugin from webgpu-plugin.js... Loading bundled plugin... ✅ WebGPUPlugin loaded successfully Plugin tools: [ "test_webgpu" ] 📊 Results Summary: This test accurately reproduces the OpenCode plugin loading scenario If bun-pty fails while others succeed, it confirms the issue is isolated to bun-pty's path resolution in plugin subdirectory scenarios [michi@nixos:~/dev/opencode-pty-branches/web-ui/test-path-resolution]$ ```
Author
Owner

@MBanucu commented on GitHub (Jan 26, 2026):

added this line

# [...]
bun install
bun pm untrusted # <-----

# Create source plugin files for each library
# [...]

additional output

bun pm untrusted v1.3.6 (d530ed99)

./node_modules/@swc/core @1.15.10
 » [postinstall]: node postinstall.js

These dependencies had their lifecycle scripts blocked during install.

If you trust them and wish to run their scripts, use `bun pm trust`.
@MBanucu commented on GitHub (Jan 26, 2026): added this line ```bash # [...] bun install bun pm untrusted # <----- # Create source plugin files for each library # [...] ``` additional output ```console bun pm untrusted v1.3.6 (d530ed99) ./node_modules/@swc/core @1.15.10 » [postinstall]: node postinstall.js These dependencies had their lifecycle scripts blocked during install. If you trust them and wish to run their scripts, use `bun pm trust`. ```
Author
Owner

@MBanucu commented on GitHub (Jan 26, 2026):

So in the end who is the bad guy? opencode or sursaone/bun-pty?

@MBanucu commented on GitHub (Jan 26, 2026): So in the end who is the bad guy? opencode or [sursaone/bun-pty](https://github.com/sursaone/bun-pty)?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#7552