Skip to content

Commit 7d84220

Browse files
committed
feat: vision flag
1 parent e9afe01 commit 7d84220

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

src/lib/api-config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ export const copilotHeaders = (state: State) => ({
2626
"x-github-api-version": API_VERSION,
2727
"x-request-id": randomUUID(),
2828
"x-vscode-user-agent-library-version": "electron-fetch",
29+
"copilot-vision-request": state.visionEnabled ? "true" : "false",
2930
})
3031

3132
export const GITHUB_API_BASE_URL = "https://api.github.com"

src/lib/state.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export interface State {
1010

1111
manualApprove: boolean
1212
rateLimitWait: boolean
13+
visionEnabled: boolean
1314

1415
// Rate limiting configuration
1516
rateLimitSeconds?: number
@@ -20,4 +21,5 @@ export const state: State = {
2021
accountType: "individual",
2122
manualApprove: false,
2223
rateLimitWait: false,
24+
visionEnabled: false,
2325
}

src/main.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,10 @@ interface RunServerOptions {
1717
verbose: boolean
1818
business: boolean
1919
manual: boolean
20-
rateLimit: number | undefined
20+
rateLimit?: number
2121
rateLimitWait: boolean
2222
githubToken?: string
23+
visionEnabled: boolean
2324
}
2425

2526
export async function runServer(options: RunServerOptions): Promise<void> {
@@ -36,6 +37,11 @@ export async function runServer(options: RunServerOptions): Promise<void> {
3637
state.manualApprove = options.manual
3738
state.rateLimitSeconds = options.rateLimit
3839
state.rateLimitWait = options.rateLimitWait
40+
state.visionEnabled = options.visionEnabled
41+
42+
if (options.visionEnabled) {
43+
consola.info("Vision capability enabled")
44+
}
3945

4046
await ensurePaths()
4147
await cacheVSCodeVersion()
@@ -105,6 +111,12 @@ const start = defineCommand({
105111
description:
106112
"Provide GitHub token directly instead of using stored token",
107113
},
114+
vision: {
115+
type: "boolean",
116+
default: false,
117+
description: "Enable vision capabilities",
118+
required: false,
119+
},
108120
},
109121
run({ args }) {
110122
const rateLimitRaw = args["rate-limit"]
@@ -122,6 +134,7 @@ const start = defineCommand({
122134
rateLimit,
123135
rateLimitWait: Boolean(args.wait),
124136
githubToken: args["github-token"],
137+
visionEnabled: args.vision,
125138
})
126139
},
127140
})

0 commit comments

Comments
 (0)