mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-21 05:02:14 +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
|
|
@ -2,6 +2,10 @@
|
|||
|
||||
## [Unreleased]
|
||||
|
||||
### Added
|
||||
|
||||
- Added `PI_AI_ANTIGRAVITY_VERSION` environment variable to override the Antigravity User-Agent version when Google updates their version requirements ([#1129](https://github.com/badlogic/pi-mono/issues/1129))
|
||||
|
||||
## [0.50.8] - 2026-02-01
|
||||
|
||||
### Added
|
||||
|
|
|
|||
|
|
@ -911,6 +911,14 @@ const response = await complete(model, context, {
|
|||
});
|
||||
```
|
||||
|
||||
#### Antigravity Version Override
|
||||
|
||||
Set `PI_AI_ANTIGRAVITY_VERSION` to override the Antigravity User-Agent version when Google updates their requirements:
|
||||
|
||||
```bash
|
||||
export PI_AI_ANTIGRAVITY_VERSION="1.23.0"
|
||||
```
|
||||
|
||||
#### Cache Retention
|
||||
|
||||
Set `PI_CACHE_RETENTION=long` to extend prompt cache retention:
|
||||
|
|
|
|||
|
|
@ -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