opencode/packages/plugin
Ryan Vogel 83f6623dc7 feat(tui): expose plugin-owned composer ghost text
Add ui.prompt.suggest so CLI plugins can offer a complete next-message draft without private prompt access. Temporarily replace the empty composer placeholder with a wrapped suggestion; configurable Tab acceptance inserts text without submitting, and Escape, typing, navigation, and plugin cleanup discard the offer.

Keep suggestion disposal identity-bound so stale callbacks cannot clear a newer offer. Re-measure native placeholder layout when suggestions change. Document the API and keyboard commands.

Verified: root bun run check; full TUI suite (1462 pass, 2 skip); final focused TUI checks (64 pass); website typecheck, generated-contract check and build; live dev:live/termctrl checks for acceptance, draft preservation, dismissal, typing, stale disposal, plugin reload, narrow wrapping, light/dark themes and custom bindings. Session history remained empty after acceptance.
2026-10-09 16:33:02 -04:00
..
script refactor(packages): migrate to the opencode npm scope (#47852) 2026-09-07 17:19:33 -04:00
src feat(tui): expose plugin-owned composer ghost text 2026-10-09 16:33:02 -04:00
test fix(cli): give plugins the host's Effect (#53422) 2026-10-07 16:57:24 -07:00
.gitignore wip: plugins 2025-08-02 18:50:19 -04:00
AGENTS.md refactor(packages): migrate to the opencode npm scope (#47852) 2026-09-07 17:19:33 -04:00
package.json sync release versions for v2.0.26 [skip ci] 2026-10-08 19:45:51 +00:00
README.md fix(cli): give plugins the host's Effect (#53422) 2026-10-07 16:57:24 -07:00
sst-env.d.ts zen: update sst version 2026-02-18 13:54:23 -05:00
tsconfig.build.json fix(plugin): restore package publishing 2026-07-09 22:18:58 -04:00
tsconfig.json chore: enable noUnusedLocals in already-clean packages (#52849) 2026-10-02 15:23:50 -07:00

@opencode/plugin

Authoring interfaces and runtime loader support for OpenCode V2 plugins:

  • @opencode/plugin — Promise plugin API
  • @opencode/plugin/effect — Effect plugin API
  • @opencode/plugin/rpc — portable RPC contract definitions
  • @opencode/plugin/tui — terminal UI plugin API

Packaging And Runtime effect

When the OpenCode CLI loads server or TUI plugins, it resolves imports of effect, exported effect/* subpaths, and @opencode/plugin entrypoints (including imports from dependencies inside a plugin's node_modules) to the host's runtime module instances so fibers, loggers, and Schema parsers share one copy.

  • Declare effect as a peerDependency (and devDependency for local type-checking and testing) rather than a bundled runtime dependency.
  • Do not bundle effect into published plugin files; if you build with a bundler, keep effect and effect/* external. Two copies of effect do not share fiber, logger, or Schema internals.
  • Plugins and their node_modules dependencies always receive OpenCode's host effect instance. Use effect APIs and module paths compatible with the OpenCode release you target; dependencies built on another effect major (such as Effect 3) are not supported.
  • Only public effect subpaths are provided. A plugin that imports one of Effect's private internal modules fails to load with an error naming the path.
  • The compiled OpenCode binary does not include the Scalar and Swagger UI assets used by Effect's HTTP API docs pages; serving those pages from a plugin shows a notice instead.