mirror of
https://github.com/Heretek-AI/opencode.git
synced 2026-11-10 02:11:36 -10: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
OpenCode resolves imports of effect, every exported effect/* subpath, and @opencode/plugin entrypoints (including transitive imports from dependencies inside a plugin's node_modules) to the host's runtime module instances.
- Declare
effectas apeerDependency(anddevDependencyfor local type-checking/testing) rather than bundling it. - Do not bundle
effectinto published plugin files; if you build with a bundler, keepeffectandeffect/*external. OpenCode detects and rejects Effect plugins whose returnedEffectcomes from a bundled copy. - At runtime, plugins execute against the host OpenCode release's
effectversion, so plugins must useeffectAPIs and module paths compatible with the OpenCode release they target.