Skip to content

fix: resolve node-pty reliably in web terminal plugin#7

Open
LimLLL wants to merge 1 commit intocloudcli-ai:mainfrom
LimLLL:main
Open

fix: resolve node-pty reliably in web terminal plugin#7
LimLLL wants to merge 1 commit intocloudcli-ai:mainfrom
LimLLL:main

Conversation

@LimLLL
Copy link
Copy Markdown

@LimLLL LimLLL commented May 8, 2026

Summary

Fixes runtime startup failures for the Web Terminal plugin when node-pty is not resolved from the plugin's dist directory or when CloudCLI is installed globally.

What changed

  • Pin node-pty to 1.2.0-beta.12 for better Node 22 compatibility.
  • Improve module resolution for node-pty and ws.
  • Add fallback lookup paths for:
    • plugin dist/node_modules
    • plugin root node_modules
    • globally installed CloudCLI dependencies
  • Stop swallowing non-MODULE_NOT_FOUND errors, so native module load failures are surfaced correctly.
  • Add runtime self-healing for macOS node-pty spawn-helper execute permissions.

Why

In Docker/self-hosted CloudCLI environments, the plugin can fail to start with:

[web-terminal] Cannot find module 'node-pty' - run npm install in .../plugins/cloudcli-plugin-terminal/dist

Installing dependencies in the plugin root may not always help because the plugin server is launched from dist/server.js, and the old resolver could hide the real failure reason.

Verification

Tested locally with:

npm install --include=dev
npm run build
timeout 3s node dist/server.js

The plugin server starts successfully and prints:

{"ready":true,"port":45067}

Notes

This also includes the macOS spawn-helper permission self-healing behavior from the existing open PR, but the main motivation here is Linux Docker / Node 22 module resolution reliability.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant