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

This commit is contained in:
Aiden Cline 2025-11-23 22:40:15 -08:00 committed by GitHub
parent b9b071c744
commit ac1e2bfd49
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 13 additions and 3 deletions

View file

@ -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()

View file

@ -28,7 +28,7 @@ export namespace Plugin {
}
const plugins = [...(config.plugin ?? [])]
if (!Flag.OPENCODE_DISABLE_DEFAULT_PLUGINS) {
plugins.push("opencode-copilot-auth@0.0.5")
plugins.push("opencode-copilot-auth@0.0.7")
plugins.push("opencode-anthropic-auth@0.0.2")
}
for (let plugin of plugins) {

View file

@ -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
}
}

View file

@ -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,