Skip to content

Commit ac1e2bf

Browse files
authored
bump copilot plugin, give better error message for copilot (#4678)
1 parent b9b071c commit ac1e2bf

File tree

4 files changed

+13
-3
lines changed

4 files changed

+13
-3
lines changed

packages/opencode/src/global/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ await Promise.all([
3030
fs.mkdir(Global.Path.bin, { recursive: true }),
3131
])
3232

33-
const CACHE_VERSION = "10"
33+
const CACHE_VERSION = "11"
3434

3535
const version = await Bun.file(path.join(Global.Path.cache, "version"))
3636
.text()

packages/opencode/src/plugin/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export namespace Plugin {
2828
}
2929
const plugins = [...(config.plugin ?? [])]
3030
if (!Flag.OPENCODE_DISABLE_DEFAULT_PLUGINS) {
31-
plugins.push("opencode-copilot-auth@0.0.5")
31+
plugins.push("opencode-copilot-auth@0.0.7")
3232
plugins.push("opencode-anthropic-auth@0.0.2")
3333
}
3434
for (let plugin of plugins) {

packages/opencode/src/provider/transform.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,4 +272,12 @@ export namespace ProviderTransform {
272272

273273
return schema
274274
}
275+
276+
export function error(providerID: string, message: string) {
277+
if (providerID === "github-copilot" && message.includes("The requested model is not supported")) {
278+
message +=
279+
"\n\nMake sure the model is enabled in your copilot settings: https://github.com/settings/copilot/features"
280+
}
281+
return message
282+
}
275283
}

packages/opencode/src/session/message-v2.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { LSP } from "../lsp"
88
import { Snapshot } from "@/snapshot"
99
import { fn } from "@/util/fn"
1010
import { Storage } from "@/storage/storage"
11+
import { ProviderTransform } from "@/provider/transform"
1112

1213
export namespace MessageV2 {
1314
export const OutputLengthError = NamedError.create("MessageOutputLengthError", z.object({}))
@@ -737,9 +738,10 @@ export namespace MessageV2 {
737738
{ cause: e },
738739
).toObject()
739740
case APICallError.isInstance(e):
741+
const message = ProviderTransform.error(ctx.providerID, e.message)
740742
return new MessageV2.APIError(
741743
{
742-
message: e.message,
744+
message,
743745
statusCode: e.statusCode,
744746
isRetryable: e.isRetryable,
745747
responseHeaders: e.responseHeaders,

0 commit comments

Comments
 (0)