Skip to content
This repository was archived by the owner on Feb 28, 2026. It is now read-only.

Commit ca9dad5

Browse files
authored
fix: bump user-agent to 1.15.8 and detect OS/arch dynamically (#34)
1 parent 53511c9 commit ca9dad5

1 file changed

Lines changed: 23 additions & 1 deletion

File tree

src/constants.ts

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { platform, arch } from "node:os";
2+
13
export const ANTIGRAVITY_CLIENT_ID = "1071006060591-tmhssin2h21lcre235vtolojh4g403ep.apps.googleusercontent.com";
24
export const ANTIGRAVITY_CLIENT_SECRET = "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";
35
export const ANTIGRAVITY_CALLBACK_PORT = 36742;
@@ -11,7 +13,27 @@ export const ANTIGRAVITY_SCOPES: readonly string[] = [
1113
"https://www.googleapis.com/auth/experimentsandconfigs",
1214
];
1315

14-
export const ANTIGRAVITY_USER_AGENT = "antigravity/1.11.5 windows/amd64";
16+
/**
17+
* Map Node.js os values to Antigravity's expected platform/arch format.
18+
* Falls back to "linux/amd64" if the platform or arch is unrecognized.
19+
*/
20+
function getAntigravityPlatform(): string {
21+
const platformMap: Record<string, string> = {
22+
darwin: "darwin",
23+
linux: "linux",
24+
win32: "windows",
25+
};
26+
const archMap: Record<string, string> = {
27+
arm64: "arm64",
28+
x64: "amd64",
29+
ia32: "386",
30+
};
31+
const p = platformMap[platform()] ?? "linux";
32+
const a = archMap[arch()] ?? "amd64";
33+
return `${p}/${a}`;
34+
}
35+
36+
export const ANTIGRAVITY_USER_AGENT = `antigravity/1.15.8 ${getAntigravityPlatform()}`;
1537
export const ANTIGRAVITY_API_CLIENT = "google-cloud-sdk vscode_cloudshelleditor/0.1";
1638
export const ANTIGRAVITY_CLIENT_METADATA = '{"ideType":"IDE_UNSPECIFIED","platform":"PLATFORM_UNSPECIFIED","pluginType":"GEMINI"}';
1739

0 commit comments

Comments
 (0)