summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAiden Cline <[email protected]>2026-03-16 17:05:14 -0500
committerGitHub <[email protected]>2026-03-16 17:05:14 -0500
commit68809365dfe32dd13ad9b3a8c2f555b2e8fa049b (patch)
treef28828688645eeb819704db2e0f018018c5d645b
parent8da511dfa825fdfbdac08b2738ce38b64f0af46b (diff)
downloadopencode-68809365dfe32dd13ad9b3a8c2f555b2e8fa049b.tar.gz
opencode-68809365dfe32dd13ad9b3a8c2f555b2e8fa049b.zip
fix: github copilot enterprise integration (#17847)
-rw-r--r--packages/opencode/src/plugin/copilot.ts5
-rw-r--r--packages/opencode/src/provider/provider.ts56
-rw-r--r--packages/opencode/src/provider/schema.ts1
3 files changed, 2 insertions, 60 deletions
diff --git a/packages/opencode/src/plugin/copilot.ts b/packages/opencode/src/plugin/copilot.ts
index ddb4d9046..31d84532c 100644
--- a/packages/opencode/src/plugin/copilot.ts
+++ b/packages/opencode/src/plugin/copilot.ts
@@ -185,12 +185,10 @@ export async function CopilotAuthPlugin(input: PluginInput): Promise<Hooks> {
const deploymentType = inputs.deploymentType || "github.com"
let domain = "github.com"
- let actualProvider = "github-copilot"
if (deploymentType === "enterprise") {
const enterpriseUrl = inputs.enterpriseUrl
domain = normalizeDomain(enterpriseUrl!)
- actualProvider = "github-copilot-enterprise"
}
const urls = getUrls(domain)
@@ -262,8 +260,7 @@ export async function CopilotAuthPlugin(input: PluginInput): Promise<Hooks> {
expires: 0,
}
- if (actualProvider === "github-copilot-enterprise") {
- result.provider = "github-copilot-enterprise"
+ if (deploymentType === "enterprise") {
result.enterpriseUrl = domain
}
diff --git a/packages/opencode/src/provider/provider.ts b/packages/opencode/src/provider/provider.ts
index 349073197..2537f8949 100644
--- a/packages/opencode/src/provider/provider.ts
+++ b/packages/opencode/src/provider/provider.ts
@@ -197,16 +197,6 @@ export namespace Provider {
options: {},
}
},
- "github-copilot-enterprise": async () => {
- return {
- autoload: false,
- async getModel(sdk: any, modelID: string, _options?: Record<string, any>) {
- if (useLanguageModel(sdk)) return sdk.languageModel(modelID)
- return shouldUseCopilotResponsesApi(modelID) ? sdk.responses(modelID) : sdk.chat(modelID)
- },
- options: {},
- }
- },
azure: async (provider) => {
const resource = iife(() => {
const name = provider.options?.resourceName
@@ -863,20 +853,6 @@ export namespace Provider {
const configProviders = Object.entries(config.provider ?? {})
- // Add GitHub Copilot Enterprise provider that inherits from GitHub Copilot
- if (database["github-copilot"]) {
- const githubCopilot = database["github-copilot"]
- database["github-copilot-enterprise"] = {
- ...githubCopilot,
- id: ProviderID.githubCopilotEnterprise,
- name: "GitHub Copilot Enterprise",
- models: mapValues(githubCopilot.models, (model) => ({
- ...model,
- providerID: ProviderID.githubCopilotEnterprise,
- })),
- }
- }
-
function mergeProvider(providerID: ProviderID, provider: Partial<Info>) {
const existing = providers[providerID]
if (existing) {
@@ -1003,46 +979,16 @@ export namespace Provider {
const providerID = ProviderID.make(plugin.auth.provider)
if (disabled.has(providerID)) continue
- // For github-copilot plugin, check if auth exists for either github-copilot or github-copilot-enterprise
- let hasAuth = false
const auth = await Auth.get(providerID)
- if (auth) hasAuth = true
-
- // Special handling for github-copilot: also check for enterprise auth
- if (providerID === ProviderID.githubCopilot && !hasAuth) {
- const enterpriseAuth = await Auth.get("github-copilot-enterprise")
- if (enterpriseAuth) hasAuth = true
- }
-
- if (!hasAuth) continue
+ if (!auth) continue
if (!plugin.auth.loader) continue
- // Load for the main provider if auth exists
if (auth) {
const options = await plugin.auth.loader(() => Auth.get(providerID) as any, database[plugin.auth.provider])
const opts = options ?? {}
const patch: Partial<Info> = providers[providerID] ? { options: opts } : { source: "custom", options: opts }
mergeProvider(providerID, patch)
}
-
- // If this is github-copilot plugin, also register for github-copilot-enterprise if auth exists
- if (providerID === ProviderID.githubCopilot) {
- const enterpriseProviderID = ProviderID.githubCopilotEnterprise
- if (!disabled.has(enterpriseProviderID)) {
- const enterpriseAuth = await Auth.get(enterpriseProviderID)
- if (enterpriseAuth) {
- const enterpriseOptions = await plugin.auth.loader(
- () => Auth.get(enterpriseProviderID) as any,
- database[enterpriseProviderID],
- )
- const opts = enterpriseOptions ?? {}
- const patch: Partial<Info> = providers[enterpriseProviderID]
- ? { options: opts }
- : { source: "custom", options: opts }
- mergeProvider(enterpriseProviderID, patch)
- }
- }
- }
}
for (const [id, fn] of Object.entries(CUSTOM_LOADERS)) {
diff --git a/packages/opencode/src/provider/schema.ts b/packages/opencode/src/provider/schema.ts
index 9eac235ce..15a919d8e 100644
--- a/packages/opencode/src/provider/schema.ts
+++ b/packages/opencode/src/provider/schema.ts
@@ -18,7 +18,6 @@ export const ProviderID = providerIdSchema.pipe(
google: schema.makeUnsafe("google"),
googleVertex: schema.makeUnsafe("google-vertex"),
githubCopilot: schema.makeUnsafe("github-copilot"),
- githubCopilotEnterprise: schema.makeUnsafe("github-copilot-enterprise"),
amazonBedrock: schema.makeUnsafe("amazon-bedrock"),
azure: schema.makeUnsafe("azure"),
openrouter: schema.makeUnsafe("openrouter"),