fix(antigravity): route chat traffic to prod endpoint and dereference in JSON schemas

This commit is contained in:
Zac Gaetano 2026-08-18 18:07:43 -04:00
parent 699edac327
commit 39ddda477e
3 changed files with 22 additions and 2 deletions

View file

@ -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",

View file

@ -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)

View file

@ -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;