Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions packages/types/src/provider-settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export const providerNames = [
"zai",
"fireworks",
"io-intelligence",
"copilot",
"roo",
] as const

Expand Down Expand Up @@ -289,6 +290,10 @@ const ioIntelligenceSchema = apiModelIdProviderModelSchema.extend({
ioIntelligenceApiKey: z.string().optional(),
})

const copilotSchema = baseProviderSettingsSchema.extend({
copilotModelId: z.string().optional(),
})

const rooSchema = apiModelIdProviderModelSchema.extend({
// No additional fields needed - uses cloud authentication
})
Expand Down Expand Up @@ -329,6 +334,7 @@ export const providerSettingsSchemaDiscriminated = z.discriminatedUnion("apiProv
zaiSchema.merge(z.object({ apiProvider: z.literal("zai") })),
fireworksSchema.merge(z.object({ apiProvider: z.literal("fireworks") })),
ioIntelligenceSchema.merge(z.object({ apiProvider: z.literal("io-intelligence") })),
copilotSchema.merge(z.object({ apiProvider: z.literal("copilot") })),
rooSchema.merge(z.object({ apiProvider: z.literal("roo") })),
defaultSchema,
])
Expand Down Expand Up @@ -366,6 +372,7 @@ export const providerSettingsSchema = z.object({
...zaiSchema.shape,
...fireworksSchema.shape,
...ioIntelligenceSchema.shape,
...copilotSchema.shape,
...rooSchema.shape,
...codebaseIndexProviderSchema.shape,
})
Expand Down Expand Up @@ -393,6 +400,7 @@ export const MODEL_ID_KEYS: Partial<keyof ProviderSettings>[] = [
"litellmModelId",
"huggingFaceModelId",
"ioIntelligenceModelId",
"copilotModelId",
]

export const getModelId = (settings: ProviderSettings): string | undefined => {
Expand Down
16 changes: 16 additions & 0 deletions packages/types/src/providers/copilot.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
export const copilotDefaultModelId = "gpt-4.1"

export const GITHUB_CLIENT_ID = "Iv1.b507a08c87ecfe98"
export const GITHUB_DEVICE_CODE_URL = "https://github.com/login/device/code"
export const GITHUB_ACCESS_TOKEN_URL = "https://github.com/login/oauth/access_token"
export const GITHUB_API_KEY_URL = "https://api.github.com/copilot_internal/v2/token"
export const GITHUB_COPILOT_API_BASE = "https://api.githubcopilot.com/"

export const COPILOT_DEFAULT_HEADER = {
accept: "application/json",
"content-type": "application/json",
"editor-version": "vscode/1.85.1",
"editor-plugin-version": "copilot/1.155.0",
"user-agent": "GithubCopilot/1.155.0",
"accept-encoding": "gzip,deflate,br",
}
1 change: 1 addition & 0 deletions packages/types/src/providers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,5 @@ export * from "./xai.js"
export * from "./doubao.js"
export * from "./zai.js"
export * from "./fireworks.js"
export * from "./copilot.js"
export * from "./roo.js"
3 changes: 3 additions & 0 deletions src/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import {
DoubaoHandler,
ZAiHandler,
FireworksHandler,
CopilotHandler,
RooHandler,
} from "./providers"
import { NativeOllamaHandler } from "./providers/native-ollama"
Expand Down Expand Up @@ -141,6 +142,8 @@ export function buildApiHandler(configuration: ProviderSettings): ApiHandler {
return new FireworksHandler(options)
case "io-intelligence":
return new IOIntelligenceHandler(options)
case "copilot":
return new CopilotHandler(options)
case "roo":
return new RooHandler(options)
default:
Expand Down
Loading
Loading