opencode/packages/plugin
James Long e5d1a00fc4 fix(desktop): harden the browser pill and Linux lock detection
Keep the top-center Disconnected pill, but make it one lazy auxiliary window per main window instead of one per page. Mark overlays so privileged IPC, storage broadcasts, appearance, menu and lifecycle skip them, and resolve the pill's label, font and colors from the browser catalog and app tokens. Destroy the pill before profiling cleanup.

Release records with the window-scoped live key, keep Linux login1/elogind and screensaver hints separate from the idle fallback, and remember sessions woken while the screen is locked so unlock connects them after a cold start.

User decisions:
- Keep the top-center Disconnected pill over the live page
- Keep pages, tabs and state across lock and reconnect
- Use the app's own theme and language for the pill
- Use Linux login1/elogind when available, with screensaver and idle probes as fallback
2026-11-09 20:52:29 +00:00
..
script feat(plugin): add OpenCode Desktop GUI plugins (#55246) 2026-10-27 10:54:50 +10:00
src fix(desktop): harden the browser pill and Linux lock detection 2026-11-09 20:52:29 +00:00
test feat(plugin): add OpenCode Desktop GUI plugins (#55246) 2026-10-27 10:54:50 +10: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 chore(tui): bump OpenTUI to 0.8.1 (#60913) 2026-10-31 18:10:07 +01: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 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

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.