Skip to content

cursor-acp fails to load: @opencode-ai/plugin ESM import missing .js extension #82

@AidenGeunGeun

Description

@AidenGeunGeun

Summary

cursor-acp fails to load in OpenCode on macOS because the installed @opencode-ai/plugin dependency emits extensionless relative ESM imports.

This prevents the local Cursor ACP proxy from starting on 127.0.0.1:32124, which then causes ECONNREFUSED when selecting cursor-acp/* models.

Environment

  • macOS arm64
  • OpenCode: 1.15.11
  • @rama_nigg/open-cursor: 2.4.6
  • Installed via the one-line installer / global npm package
  • Cursor Agent: installed and cursor-agent models works

Error

OpenCode desktop logs repeatedly showed plugin load failures like:

Cannot find module '/opt/homebrew/lib/node_modules/@rama_nigg/open-cursor/node_modules/@opencode-ai/plugin/dist/tool' imported from /opt/homebrew/lib/node_modules/@rama_nigg/open-cursor/node_modules/@opencode-ai/plugin/dist/index.js
failed to load plugin

Direct reproduction:

node -e "import('/opt/homebrew/lib/node_modules/@rama_nigg/open-cursor/dist/plugin-entry.js').then(()=>console.log('import ok')).catch(e=>{console.error(e.message); process.exit(1)})"

Before patch, that prints the same Cannot find module .../dist/tool error.

Root cause

The package is ESM ("type": "module"), but the bundled dependency file contains extensionless relative imports:

// node_modules/@opencode-ai/plugin/dist/index.js
export * from "./tool";

The file exists as tool.js, but Node/Electron ESM resolution does not add .js for relative imports.

example.js has the same pattern:

import { tool } from "./tool";

Local workaround that fixed it

Patching the installed dependency to include .js fixed plugin import and Cursor ACP runtime:

// node_modules/@opencode-ai/plugin/dist/index.js
-export * from "./tool";
+export * from "./tool.js";

// node_modules/@opencode-ai/plugin/dist/example.js
-import { tool } from "./tool";
+import { tool } from "./tool.js";

After patch:

node -e "import('/opt/homebrew/lib/node_modules/@rama_nigg/open-cursor/dist/plugin-entry.js').then(()=>console.log('import ok')).catch(e=>{console.error(e.stack||e.message); process.exit(1)})"

prints:

import ok

Then:

opencode models cursor-acp
opencode run "Reply exactly: CURSOR_ACP_FIXED" -m cursor-acp/composer-2.5-fast

both work. The run returned the expected CURSOR_ACP_FIXED response.

Impact

  • Repeated OpenCode desktop/sidebar error notifications during project/dashboard initialization.
  • Cursor ACP proxy does not start.
  • Selecting cursor-acp/* models fails with connection refused to 127.0.0.1:32124.

Suggested fix

Either:

  1. publish/fix @opencode-ai/plugin so its ESM output uses explicit .js extensions for relative imports, or
  2. make open-cursor avoid shipping/depending on a broken ESM runtime import path, or
  3. bundle the required plugin helper code so the dependency import cannot fail at runtime.

The local patch above is not durable because npm update -g @rama_nigg/open-cursor or reinstalling can overwrite it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions