mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-17 03:03:44 +00:00
feat(ai): add PI_AI_ANTIGRAVITY_VERSION env var override
Allows users to override the Antigravity User-Agent version when Google updates their version requirements, avoiding the need to wait for a package release. Fixes #1129
This commit is contained in:
parent
71d7a14b18
commit
e9ca0be769
5 changed files with 29 additions and 10 deletions
|
|
@ -72,15 +72,20 @@ const GEMINI_CLI_HEADERS = {
|
|||
};
|
||||
|
||||
// Headers for Antigravity (sandbox endpoint) - requires specific User-Agent
|
||||
const ANTIGRAVITY_HEADERS = {
|
||||
"User-Agent": "antigravity/1.15.8 darwin/arm64",
|
||||
"X-Goog-Api-Client": "google-cloud-sdk vscode_cloudshelleditor/0.1",
|
||||
"Client-Metadata": JSON.stringify({
|
||||
ideType: "IDE_UNSPECIFIED",
|
||||
platform: "PLATFORM_UNSPECIFIED",
|
||||
pluginType: "GEMINI",
|
||||
}),
|
||||
};
|
||||
const DEFAULT_ANTIGRAVITY_VERSION = "1.15.8";
|
||||
|
||||
function getAntigravityHeaders() {
|
||||
const version = process.env.PI_AI_ANTIGRAVITY_VERSION || DEFAULT_ANTIGRAVITY_VERSION;
|
||||
return {
|
||||
"User-Agent": `antigravity/${version} darwin/arm64`,
|
||||
"X-Goog-Api-Client": "google-cloud-sdk vscode_cloudshelleditor/0.1",
|
||||
"Client-Metadata": JSON.stringify({
|
||||
ideType: "IDE_UNSPECIFIED",
|
||||
platform: "PLATFORM_UNSPECIFIED",
|
||||
pluginType: "GEMINI",
|
||||
}),
|
||||
};
|
||||
}
|
||||
|
||||
// Antigravity system instruction (ported from CLIProxyAPI v6.6.89).
|
||||
const ANTIGRAVITY_SYSTEM_INSTRUCTION = `<identity>
|
||||
|
|
@ -430,7 +435,7 @@ export const streamGoogleGeminiCli: StreamFunction<"google-gemini-cli", GoogleGe
|
|||
|
||||
const requestBody = buildRequest(model, context, projectId, options, isAntigravity);
|
||||
options?.onPayload?.(requestBody);
|
||||
const headers = isAntigravity ? ANTIGRAVITY_HEADERS : GEMINI_CLI_HEADERS;
|
||||
const headers = isAntigravity ? getAntigravityHeaders() : GEMINI_CLI_HEADERS;
|
||||
|
||||
const requestHeaders = {
|
||||
Authorization: `Bearer ${accessToken}`,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue