merge: critical Antigravity fixes — Client-Metadata, Electron UA, endpoint reorder

This commit is contained in:
Roman | RyzenAdvanced
2026-05-27 12:03:00 +04:00
Unverified
parent abb030d579
commit f9ba3b6e1c
2 changed files with 12 additions and 6 deletions

View File

@@ -5783,13 +5783,21 @@ class Handler(http.server.BaseHTTPRequestHandler):
_os_arch = _plat.machine().lower().replace("x86_64", "x64").replace("aarch64", "arm64")
_fetched_ver = _ensure_antigravity_version()
_ag_ua = f"antigravity/{_fetched_ver} {_os_name}/{_os_arch}"
# Get platform for Client-Metadata header (repo4/opencode-antigravity-auth)
_client_meta_platform = "WINDOWS" if _os_name == "windows" else "MACOS"
headers = {
"Content-Type": "application/json",
"Authorization": f"Bearer {access_token}",
"User-Agent": _ag_ua,
"User-Agent": f"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Antigravity/{_fetched_ver} Chrome/138.0.7204.235 Electron/37.3.1 Safari/537.36",
"X-Client-Name": "antigravity",
"X-Client-Version": _ensure_antigravity_client_version(),
"x-goog-api-client": "gl-node/18.18.2 fire/0.8.6 grpc/1.10.x",
"x-goog-api-client": "google-cloud-sdk vscode_cloudshelleditor/0.1",
"Client-Metadata": json.dumps({
"ideType": "ANTIGRAVITY",
"platform": _client_meta_platform,
"pluginType": "GEMINI"
}),
}
wrapped = {
@@ -5802,14 +5810,12 @@ class Handler(http.server.BaseHTTPRequestHandler):
}
wrapped["request"]["sessionId"] = f"{uuid.uuid4().hex}{int(time.time()*1000)}"
_allow_staging = os.environ.get("ALLOW_ANTIGRAVITY_STAGING", "0") == "1"
# Use endpoint order from repo4/opencode-antigravity-auth: daily sandbox → autopush sandbox → prod
_antigravity_endpoints = [
"https://daily-cloudcode-pa.googleapis.com",
"https://daily-cloudcode-pa.sandbox.googleapis.com",
"https://autopush-cloudcode-pa.sandbox.googleapis.com",
"https://cloudcode-pa.googleapis.com",
]
if _allow_staging:
_antigravity_endpoints.append("https://autopush-cloudcode-pa.sandbox.googleapis.com")
body_b = json.dumps(wrapped).encode()
print(f"[{self._session_id}] [antigravity-v2] model={model} stream={stream} contents={len(contents)} tools={bool(gemini_tools)} project={project_id} ver={_fetched_ver}", file=sys.stderr)