feat(gemini): add Gemini 3.6 Flash tier routing and 3.5 Flash Lite

Add gemini-3.6-flash tiered (high/medium/low) for Antigravity routing
via upstreamModelId "gemini-3.6-flash-tiered(level)" + thinkingLevel,
plus gemini-3.6-flash and gemini-3.5-flash-lite direct API models.

- getModelUpstreamId: split (level) suffix before lookup, re-append after
- Antigravity executor: preserve transformed body.model
- MITM extractModel: parse thinkingLevel for tiered model (default medium)
- Isolate Cloud Code endpoints: discovery (loadCodeAssist/onboardUser/
  quota) on PROD cloudcode-pa, chat transport on daily-cloudcode-pa
  to bypass prod 429
This commit is contained in:
Phuong Lambert
2026-07-23 16:33:03 +07:00
committed by decolua
parent 3c17d3406b
commit 783e271c16
15 changed files with 236 additions and 65 deletions

View File

@@ -83,7 +83,7 @@ startCacheCleanup();
* @param {string} accessToken - Valid OAuth access token
* @returns {Promise<string|null>} Real project ID or null
*/
export async function getProjectIdForConnection(connectionId, accessToken) {
export async function getProjectIdForConnection(connectionId, accessToken, provider = "gemini-cli") {
if (!connectionId || !accessToken) return null;
// Return cached value if still fresh
@@ -102,7 +102,7 @@ export async function getProjectIdForConnection(connectionId, accessToken) {
const promise = (async () => {
try {
const projectId = await fetchProjectId(accessToken, controller.signal);
const projectId = await fetchProjectId(accessToken, controller.signal, provider);
if (projectId) {
projectIdCache.set(connectionId, {projectId, fetchedAt: Date.now()});
return projectId;
@@ -155,8 +155,9 @@ export function removeConnection(connectionId) {
* @param {AbortSignal} signal
* @returns {Promise<string|null>}
*/
async function fetchProjectId(accessToken, signal) {
const response = await fetch(CLOUD_CODE_API.loadCodeAssist, {
async function fetchProjectId(accessToken, signal, provider) {
const endpoints = CLOUD_CODE_API[provider] || CLOUD_CODE_API["gemini-cli"];
const response = await fetch(endpoints.loadCodeAssist, {
method: "POST",
headers: { ...LOAD_CODE_ASSIST_HEADERS, "Authorization": `Bearer ${accessToken}` },
body: JSON.stringify({ metadata: LOAD_CODE_ASSIST_METADATA }),
@@ -185,7 +186,7 @@ async function fetchProjectId(accessToken, signal) {
}
}
return onboardUser(accessToken, tierID, signal);
return onboardUser(accessToken, tierID, signal, endpoints);
}
/**
@@ -196,7 +197,7 @@ async function fetchProjectId(accessToken, signal) {
* @param {AbortSignal} externalSignal – propagated from the connection's AbortController
* @returns {Promise<string|null>}
*/
async function onboardUser(accessToken, tierID, externalSignal) {
async function onboardUser(accessToken, tierID, externalSignal, endpoints) {
console.log(`[ProjectId] Onboarding user with tier: ${tierID}`);
const reqBody = { tierId: tierID, metadata: LOAD_CODE_ASSIST_METADATA };
@@ -213,7 +214,7 @@ async function onboardUser(accessToken, tierID, externalSignal) {
externalSignal?.addEventListener("abort", forwardAbort);
try {
const response = await fetch(CLOUD_CODE_API.onboardUser, {
const response = await fetch(endpoints.onboardUser, {
method: "POST",
headers: { ...LOAD_CODE_ASSIST_HEADERS, "Authorization": `Bearer ${accessToken}` },
body: JSON.stringify(reqBody),