feat(antigravity): initial steps for Antigravity anti-ban alignment
Cherry-picked from decolua/9router#141 (author: LinearSakana / zx <me@char.moe>) - Implement client identity spoofing with numeric enums (ideType: 9, pluginType: 2) - Add runtime platform detection for User-Agent and metadata - Implement per-connection session ID caching (binary-compatible format) - Add ANTIGRAVITY_HEADERS (X-Client-Name, X-Client-Version, x-goog-api-client) - Add X-Machine-Session-Id header injection - Align metadata/mode parameters across all Antigravity API calls - Implement double injection for system prompt (raw + [ignore] wrapped) - Rename internal anti-loop header to x-request-source for anonymity Skipped: commit 6 (signature side-channel caching) — kept DEFAULT_THINKING_GEMINI_SIGNATURE Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
9fbd6e619d
commit
a229d79158
11 files changed
+309
-121
No files matched your search
@@ -1,6 +1,20 @@
|
||||
/**
|
||||
* OAuth Configuration Constants
|
||||
*/
|
||||
import { platform, arch } from "os";
|
||||
|
||||
/**
|
||||
* Get the platform enum value based on the current OS.
|
||||
* Matches Antigravity binary's ClientMetadata.Platform enum.
|
||||
*/
|
||||
function getOAuthPlatformEnum() {
|
||||
const os = platform();
|
||||
const architecture = arch();
|
||||
if (os === "darwin") return architecture === "arm64" ? 2 : 1;
|
||||
if (os === "linux") return architecture === "arm64" ? 4 : 3;
|
||||
if (os === "win32") return 5;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Claude OAuth Configuration (Authorization Code Flow with PKCE)
|
||||
export const CLAUDE_CONFIG = {
|
||||
@@ -83,9 +97,17 @@ export const ANTIGRAVITY_CONFIG = {
|
||||
onboardUserEndpoint: "https://cloudcode-pa.googleapis.com/v1internal:onboardUser",
|
||||
loadCodeAssistUserAgent: "google-api-nodejs-client/9.15.1",
|
||||
loadCodeAssistApiClient: "google-cloud-sdk vscode_cloudshelleditor/0.1",
|
||||
loadCodeAssistClientMetadata: `{"ideType":"IDE_UNSPECIFIED","platform":"PLATFORM_UNSPECIFIED","pluginType":"GEMINI"}`,
|
||||
loadCodeAssistClientMetadata: JSON.stringify({ ideType: 9, platform: getOAuthPlatformEnum(), pluginType: 2 }),
|
||||
};
|
||||
|
||||
/**
|
||||
* Get client metadata using numeric enum values for API calls.
|
||||
* @returns {{ ideType: number, platform: number, pluginType: number }}
|
||||
*/
|
||||
export function getOAuthClientMetadata() {
|
||||
return { ideType: 9, platform: getOAuthPlatformEnum(), pluginType: 2 };
|
||||
}
|
||||
|
||||
// OpenAI OAuth Configuration (Authorization Code Flow with PKCE)
|
||||
export const OPENAI_CONFIG = {
|
||||
clientId: "app_EMoamEEZ73f0CkXaXp7hrann",
|
||||
|
||||
Reference in new issue
Block a user