diff options
| -rw-r--r-- | packages/opencode/src/plugin/index.ts | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/packages/opencode/src/plugin/index.ts b/packages/opencode/src/plugin/index.ts index 18a621fbb..9b9d3266a 100644 --- a/packages/opencode/src/plugin/index.ts +++ b/packages/opencode/src/plugin/index.ts @@ -11,6 +11,8 @@ import { Flag } from "../flag/flag" export namespace Plugin { const log = Log.create({ service: "plugin" }) + const BUILTIN = ["[email protected]", "[email protected]"] + const state = Instance.state(async () => { const client = createOpencodeClient({ baseUrl: "http://localhost:4096", @@ -29,8 +31,7 @@ export namespace Plugin { } const plugins = [...(config.plugin ?? [])] if (!Flag.OPENCODE_DISABLE_DEFAULT_PLUGINS) { - plugins.push("[email protected]") - plugins.push("[email protected]") + plugins.push(...BUILTIN) } for (let plugin of plugins) { log.info("loading plugin", { path: plugin }) @@ -38,7 +39,11 @@ export namespace Plugin { const lastAtIndex = plugin.lastIndexOf("@") const pkg = lastAtIndex > 0 ? plugin.substring(0, lastAtIndex) : plugin const version = lastAtIndex > 0 ? plugin.substring(lastAtIndex + 1) : "latest" - plugin = await BunProc.install(pkg, version) + plugin = await BunProc.install(pkg, version).catch((err) => { + if (BUILTIN.includes(pkg)) return "" + throw err + }) + if (!plugin) continue } const mod = await import(plugin) for (const [_name, fn] of Object.entries<PluginInstance>(mod)) { |
