Browse Source

core: improve plugin loading to handle builtin plugin failures gracefully (#6739)

Aiden Cline 1 month ago
parent
commit
b9b0e3475c
1 changed files with 2 additions and 1 deletions
  1. 2 1
      packages/opencode/src/plugin/index.ts

+ 2 - 1
packages/opencode/src/plugin/index.ts

@@ -39,8 +39,9 @@ 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"
+        const builtin = BUILTIN.some((x) => x.startsWith(pkg + "@"))
         plugin = await BunProc.install(pkg, version).catch((err) => {
-          if (BUILTIN.includes(pkg)) return ""
+          if (builtin) return ""
           throw err
         })
         if (!plugin) continue