Skip to content

refactor(plugin): centralize host resolution - #46901

Merged
thdxr merged 1 commit into
v2from
plugin-host
Sep 2, 2026
Merged

thdxr merged 1 commit into
v2from
plugin-host

Conversation

@thdxr

@thdxr thdxr commented Sep 2, 2026

Copy link
Copy Markdown
Member

Issue for this PR

No linked issue.

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Adds @opencode-ai/plugin/host with shared resolve and load functions. Server, TUI, and CLI consumers use it instead of selecting plugin entrypoints independently. TUI-only plugins no longer need an index/server entrypoint.

Resolution uses Bun's native resolver or Node ESM resolution with existence checks and Node-only extension fallback. It neither installs packages nor executes plugin code. Npm now returns package metadata only; provider loaders resolve their own modules. Reuses staged installation metadata and removes resolve.exports.

Adds host-resolution tests for packages with exports, without exports, and without a manifest; removes two low-value tests.

Known follow-ups left unchanged: Node can treat an uncached unnamed Git spec as a module URL, and its existence check can accept a directory rather than a file.

How did you verify your code works?

  • bun typecheck in plugin, util, core, tui, and cli.
  • Host suite: 9 tests pass under Bun and Node.
  • Targeted core suites: 74 tests pass.
  • Affected TUI suites: 47 tests pass.
  • git diff --check.

Screenshots / recordings

Not applicable; no visual changes.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

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