opencode/packages/plugin
Luke Parker 08623d032b fix(core): list the browser on the step that follows a restart or an idle unload
A step lists the browser tools only if its session holds the desktop's
grant when the step selects its tools. After the server restarts or
unloads a location, the desktop attaches again only once it sees the
session run, about 100 ms after that step selected its tools, so the
step ran without the browser and the model was told it was gone.

- core: the experimental.step.before session hook runs before a step
  selects its agent, tools and instructions, as the MCP startup grace
  does for servers that are still connecting.
- plugin-browser: a session whose attachment ended is expected. Its next
  step waits for the desktop, 2 s at most and once; a step also waits
  for an attach that is in flight.
2026-11-25 09:11:08 +10:00
..
script feat(plugin): let GUI plugins declare their own icons (#64577) 2026-11-18 03:27:56 -06:00
src fix(core): list the browser on the step that follows a restart or an idle unload 2026-11-25 09:11:08 +10:00
test feat(plugin): let GUI plugins declare their own icons (#64577) 2026-11-18 03:27:56 -06:00
.gitignore wip: plugins 2025-08-02 18:50:19 -04:00
AGENTS.md feat(plugin): add OpenCode Desktop GUI plugins (#55246) 2026-10-27 10:54:50 +10:00
package.json release: v2.4.1 (#65848) 2026-11-23 11:33:25 -06:00
README.md feat(desktop): signed-in browser pane with extensions, previews, prompts and agent safeguards (#63002) 2026-11-19 20:18:12 -06:00
tsconfig.build.json feat(plugin): add OpenCode Desktop GUI plugins (#55246) 2026-10-27 10:54:50 +10:00
tsconfig.json chore: upgrade typecheck to TypeScript 7.0.2 (#56300) 2026-10-17 13:26:46 -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
  • @opencode/plugin/gui/browser - desktop pane contract, including experimental scoped tab handles

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.