Selaa lähdekoodia

bump copilot plugin, give better error message for copilot (#4678)

Aiden Cline 2 kuukautta sitten
vanhempi
sitoutus
ac1e2bfd49

+ 1 - 1
packages/opencode/src/global/index.ts

@@ -30,7 +30,7 @@ await Promise.all([
   fs.mkdir(Global.Path.bin, { recursive: true }),
 ])
 
-const CACHE_VERSION = "10"
+const CACHE_VERSION = "11"
 
 const version = await Bun.file(path.join(Global.Path.cache, "version"))
   .text()

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

@@ -28,7 +28,7 @@ export namespace Plugin {
     }
     const plugins = [...(config.plugin ?? [])]
     if (!Flag.OPENCODE_DISABLE_DEFAULT_PLUGINS) {
-      plugins.push("[email protected].5")
+      plugins.push("[email protected].7")
       plugins.push("[email protected]")
     }
     for (let plugin of plugins) {

+ 8 - 0
packages/opencode/src/provider/transform.ts

@@ -272,4 +272,12 @@ export namespace ProviderTransform {
 
     return schema
   }
+
+  export function error(providerID: string, message: string) {
+    if (providerID === "github-copilot" && message.includes("The requested model is not supported")) {
+      message +=
+        "\n\nMake sure the model is enabled in your copilot settings: https://github.com/settings/copilot/features"
+    }
+    return message
+  }
 }

+ 3 - 1
packages/opencode/src/session/message-v2.ts

@@ -8,6 +8,7 @@ import { LSP } from "../lsp"
 import { Snapshot } from "@/snapshot"
 import { fn } from "@/util/fn"
 import { Storage } from "@/storage/storage"
+import { ProviderTransform } from "@/provider/transform"
 
 export namespace MessageV2 {
   export const OutputLengthError = NamedError.create("MessageOutputLengthError", z.object({}))
@@ -737,9 +738,10 @@ export namespace MessageV2 {
           { cause: e },
         ).toObject()
       case APICallError.isInstance(e):
+        const message = ProviderTransform.error(ctx.providerID, e.message)
         return new MessageV2.APIError(
           {
-            message: e.message,
+            message,
             statusCode: e.statusCode,
             isRetryable: e.isRetryable,
             responseHeaders: e.responseHeaders,