Environment
- OpenCode: stable 2.0.x (config
plugin[])
- Plugin:
opencode-chrome-devtools@1.0.4 (npm)
Problem
Adding "opencode-chrome-devtools" to plugin[] fails at load time:
level=WARN msg="failed to load plugin" id=opencode-chrome-devtools
cause="PluginModule.LoadError: Plugin must export a default definition with an id and an effect or setup function.
(cause: SchemaError(Expected object at [\"default\"]))"
The default export is the legacy async factory const plugin: Plugin = async () => ({ tool: {...} }) (src/plugin.ts:33). The v2 loader requires an object: { id, setup } (or { id, effect }).
Reproduction
bun add opencode-chrome-devtools
opencode.json: "plugin": ["opencode-chrome-devtools"]
- Restart the OpenCode service
- Plugin load warning in the log; no
browser_* tools registered
Suggested fix
Export a v2-shaped plugin while keeping the legacy factory available for older hosts:
export default {
id: "opencode-chrome-devtools",
setup: async (ctx) => { /* register tools via ctx.tool.transform */ },
};
Assignment
I have a working fix locally and would like to open a PR for this — please assign it to me (@ebysofyan). Thanks!
Environment
plugin[])opencode-chrome-devtools@1.0.4(npm)Problem
Adding
"opencode-chrome-devtools"toplugin[]fails at load time:The default export is the legacy async factory
const plugin: Plugin = async () => ({ tool: {...} })(src/plugin.ts:33). The v2 loader requires an object:{ id, setup }(or{ id, effect }).Reproduction
bun add opencode-chrome-devtoolsopencode.json:"plugin": ["opencode-chrome-devtools"]browser_*tools registeredSuggested fix
Export a v2-shaped plugin while keeping the legacy factory available for older hosts:
Assignment
I have a working fix locally and would like to open a PR for this — please assign it to me (@ebysofyan). Thanks!