From 39ddda477e3cb96b57c691bd16326dbeae2ab5fe Mon Sep 17 00:00:00 2001 From: Zac Gaetano Date: Tue, 18 Aug 2026 18:07:43 -0400 Subject: [PATCH] fix(antigravity): route chat traffic to prod endpoint and dereference in JSON schemas --- open-sse/providers/registry/antigravity.js | 2 +- open-sse/providers/shared.js | 2 +- open-sse/translator/formats/gemini.js | 20 ++++++++++++++++++++ 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/open-sse/providers/registry/antigravity.js b/open-sse/providers/registry/antigravity.js index 2666552b..eb744413 100644 --- a/open-sse/providers/registry/antigravity.js +++ b/open-sse/providers/registry/antigravity.js @@ -75,7 +75,7 @@ export default { "https://www.googleapis.com/auth/cclog", "https://www.googleapis.com/auth/experimentsandconfigs", ], - apiEndpoint: "https://daily-cloudcode-pa.googleapis.com", + apiEndpoint: "https://cloudcode-pa.googleapis.com", apiVersion: "v1internal", loadCodeAssistEndpoint: "https://cloudcode-pa.googleapis.com/v1internal:loadCodeAssist", onboardUserEndpoint: "https://cloudcode-pa.googleapis.com/v1internal:onboardUser", diff --git a/open-sse/providers/shared.js b/open-sse/providers/shared.js index fdd76c40..16f44f85 100644 --- a/open-sse/providers/shared.js +++ b/open-sse/providers/shared.js @@ -78,7 +78,7 @@ export const ANTHROPIC_COMPAT_BASE = "https://api.anthropic.com/v1"; // Keep this static even when 9router runs on Linux: the provider profile is // intentionally matching the IDE client, not the server host. export const ANTIGRAVITY_IDE_VERSION = "2.1.1"; -export const ANTIGRAVITY_IDE_BASE_URL = "https://daily-cloudcode-pa.googleapis.com"; +export const ANTIGRAVITY_IDE_BASE_URL = "https://cloudcode-pa.googleapis.com"; export const ANTIGRAVITY_IDE_USER_AGENT = `antigravity/ide/${ANTIGRAVITY_IDE_VERSION} darwin/arm64`; // Antigravity OAuth client credentials (public CLI client — duplicated in usage.js + src/lib/oauth) diff --git a/open-sse/translator/formats/gemini.js b/open-sse/translator/formats/gemini.js index 6393a78b..3fe9eaeb 100644 --- a/open-sse/translator/formats/gemini.js +++ b/open-sse/translator/formats/gemini.js @@ -311,6 +311,26 @@ function ensureObjectType(obj) { // Clean JSON Schema for Antigravity API compatibility - removes unsupported keywords recursively export function cleanJSONSchemaForAntigravity(schema) { if (!schema || typeof schema !== "object") return schema; + const defs = schema.$defs || schema.definitions || {}; + function deref(obj) { + if (!obj || typeof obj !== "object") return obj; + if (Array.isArray(obj)) return obj.map(deref); + if (obj.$ref && typeof obj.$ref === "string") { + const name = obj.$ref.split("/").pop(); + if (defs[name]) return deref(Object.assign({}, defs[name])); + } + const res = {}; + for (const [k, v] of Object.entries(obj)) { + if (k === "$defs" || k === "definitions") continue; + res[k] = deref(v); + } + return res; + } + return _orig_cleanJSONSchemaForAntigravity(deref(schema)); +} + +function _orig_cleanJSONSchemaForAntigravity(schema) { + if (!schema || typeof schema !== "object") return schema; // Mutate directly (schema is only used once per request) let cleaned = schema;