opencode/packages/plugin
Filip Hejmowski 8cb6a54870 chore(ci): pack the npm libraries while the CLI builds
A new pack-npm job applies the release version rewrite and runs the 14
library publish scripts in a pack-only mode (OPENCODE_NPM_PACK_DIR), with
their typecheck, ui tests and codemode smoke install, and uploads the
tarballs. It has only contents: read and no secrets.

publish downloads them and sets OPENCODE_NPM_TARBALLS. script/publish.ts
checks that every tarball exists and holds the expected name and version
before it publishes anything, and each library script keeps its npm view
check and then publishes its carried tarball instead of building again.
Without either variable the scripts behave as before.

The version rewrite moves to script/release-files.ts so publish and
pack-npm share it.
2026-10-16 18:19:09 +02:00
..
script chore(ci): pack the npm libraries while the CLI builds 2026-10-16 18:19:09 +02:00
src feat(plugin): let plugins assert permissions (#54930) 2026-10-13 20:28:24 -05: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.31 [skip ci] 2026-10-16 12:37:41 +00:00
README.md chore: upgrade Effect to 4.0.1 (#54198) 2026-10-10 00:55: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": "^4.0.0" 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.