Research: verified opencode v2 plugin API #2
Notifications
Due Date
No due date set.
Blocks
#5 Grilling: config surface for endpoint and token
haylan/fastcrw-opencode-websearch
#6 Grilling: packaging and distribution
haylan/fastcrw-opencode-websearch
Reference: haylan/fastcrw-opencode-websearch#2
Reference in new issue
Block a user
Map: #1
Question
What is the real opencode v2 plugin API per https://opencode.ai/v2/docs/plugins? Specifically: plugin entry/definition shape, how a plugin is registered and loaded in config (local path vs npm package), how plugin options are passed, whether and how a plugin can provide or replace the websearch provider, how
websearch.provideris selected, and what a search result must look like. Record where the user's sketch (Plugin.define,ctx.websearch.transform,plugins[].package/options) is right or wrong.Research resolved (not closing): findings in docs/research/opencode-v2-plugin-api.md (uncommitted). Sketch is essentially correct: Plugin.define({id, setup(ctx)}) from @opencode/plugin, ctx.websearch.transform(editor => editor.add({id,name,execute({query},{signal}) -> [{url,title,content,time}]}); editor.default.set(id)), config key is plural 'plugins' with {package, options} (options read via ctx.options), websearch.provider selects by id. Gaps: id is required; exact TS types, 'time' shape and precedence of config provider vs editor.default.set are unverified (opencode source not inspected).