antigravity-auth 1.7.0 → 1.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +15255 -269
- package/dist/handler.js +28 -0
- package/dist/index.js +28 -0
- package/package.json +1 -1
package/dist/handler.js
CHANGED
|
@@ -24565,6 +24565,26 @@ async function exchangeAntigravity(code, state, options = {}) {
|
|
|
24565
24565
|
}
|
|
24566
24566
|
|
|
24567
24567
|
// src/driver/login.ts
|
|
24568
|
+
async function checkAntigravityAccess(access, projectId, proxy) {
|
|
24569
|
+
try {
|
|
24570
|
+
const headers = { ...getAntigravityHeaders(), Authorization: "Bearer " + access, "Content-Type": "application/json" };
|
|
24571
|
+
headers["x-goog-user-project"] = projectId || generateSyntheticProjectId();
|
|
24572
|
+
const body = JSON.stringify({ model: "gemini-3-flash", request: { model: "gemini-3-flash", contents: [{ role: "user", parts: [{ text: "ping" }] }], generationConfig: { maxOutputTokens: 1, temperature: 0 } } });
|
|
24573
|
+
const aborter = new AbortController();
|
|
24574
|
+
const timer = setTimeout(() => aborter.abort(), 2e4);
|
|
24575
|
+
let res;
|
|
24576
|
+
try {
|
|
24577
|
+
res = await fetch(ANTIGRAVITY_ENDPOINT_PROD + "/v1internal:streamGenerateContent?alt=sse", { method: "POST", headers, body, signal: aborter.signal, proxy });
|
|
24578
|
+
} finally {
|
|
24579
|
+
clearTimeout(timer);
|
|
24580
|
+
}
|
|
24581
|
+
if (res.status === 200 || res.status === 400) return { ok: true };
|
|
24582
|
+
if (res.status === 401 || res.status === 403) return { ok: false, status: res.status };
|
|
24583
|
+
return { ok: true, inconclusive: res.status };
|
|
24584
|
+
} catch (e) {
|
|
24585
|
+
return { ok: true, inconclusive: e && e.message || "error" };
|
|
24586
|
+
}
|
|
24587
|
+
}
|
|
24568
24588
|
var PROVIDER_ID = "antigravity";
|
|
24569
24589
|
var LOGIN_TIMEOUT_MS = 5 * 60 * 1e3;
|
|
24570
24590
|
function dbg(message) {
|
|
@@ -24653,6 +24673,14 @@ async function loginFlow() {
|
|
|
24653
24673
|
return null;
|
|
24654
24674
|
}
|
|
24655
24675
|
const account = toCoreAccount(result);
|
|
24676
|
+
const projectId = account.meta.managedProjectId || account.meta.projectId || result.projectId || "";
|
|
24677
|
+
const check2 = await checkAntigravityAccess(result.access, projectId, boundProxy);
|
|
24678
|
+
if (!check2.ok) {
|
|
24679
|
+
dbg("finish: Antigravity REJECTED " + (result.email || "?") + " (status " + check2.status + ") \u2014 not adding");
|
|
24680
|
+
process.stderr.write("antigravity: this account isn't enabled for Antigravity (HTTP " + check2.status + ") \u2014 not added.\nUse a Google account that has Antigravity/Gemini access.\n");
|
|
24681
|
+
return null;
|
|
24682
|
+
}
|
|
24683
|
+
if (check2.inconclusive) dbg("finish: access check inconclusive (" + check2.inconclusive + ") \u2014 adding anyway");
|
|
24656
24684
|
addAccount(PROVIDER_ID, account);
|
|
24657
24685
|
dbg("finish: addAccount done id=" + account.id);
|
|
24658
24686
|
if (boundProxy) proxyManager.bindAccountProxy(account.id, boundProxy);
|
package/dist/index.js
CHANGED
|
@@ -24565,6 +24565,26 @@ async function exchangeAntigravity(code, state, options = {}) {
|
|
|
24565
24565
|
}
|
|
24566
24566
|
|
|
24567
24567
|
// src/driver/login.ts
|
|
24568
|
+
async function checkAntigravityAccess(access, projectId, proxy) {
|
|
24569
|
+
try {
|
|
24570
|
+
const headers = { ...getAntigravityHeaders(), Authorization: "Bearer " + access, "Content-Type": "application/json" };
|
|
24571
|
+
headers["x-goog-user-project"] = projectId || generateSyntheticProjectId();
|
|
24572
|
+
const body = JSON.stringify({ model: "gemini-3-flash", request: { model: "gemini-3-flash", contents: [{ role: "user", parts: [{ text: "ping" }] }], generationConfig: { maxOutputTokens: 1, temperature: 0 } } });
|
|
24573
|
+
const aborter = new AbortController();
|
|
24574
|
+
const timer = setTimeout(() => aborter.abort(), 2e4);
|
|
24575
|
+
let res;
|
|
24576
|
+
try {
|
|
24577
|
+
res = await fetch(ANTIGRAVITY_ENDPOINT_PROD + "/v1internal:streamGenerateContent?alt=sse", { method: "POST", headers, body, signal: aborter.signal, proxy });
|
|
24578
|
+
} finally {
|
|
24579
|
+
clearTimeout(timer);
|
|
24580
|
+
}
|
|
24581
|
+
if (res.status === 200 || res.status === 400) return { ok: true };
|
|
24582
|
+
if (res.status === 401 || res.status === 403) return { ok: false, status: res.status };
|
|
24583
|
+
return { ok: true, inconclusive: res.status };
|
|
24584
|
+
} catch (e) {
|
|
24585
|
+
return { ok: true, inconclusive: e && e.message || "error" };
|
|
24586
|
+
}
|
|
24587
|
+
}
|
|
24568
24588
|
var PROVIDER_ID = "antigravity";
|
|
24569
24589
|
var LOGIN_TIMEOUT_MS = 5 * 60 * 1e3;
|
|
24570
24590
|
function dbg(message) {
|
|
@@ -24653,6 +24673,14 @@ async function loginFlow() {
|
|
|
24653
24673
|
return null;
|
|
24654
24674
|
}
|
|
24655
24675
|
const account = toCoreAccount(result);
|
|
24676
|
+
const projectId = account.meta.managedProjectId || account.meta.projectId || result.projectId || "";
|
|
24677
|
+
const check2 = await checkAntigravityAccess(result.access, projectId, boundProxy);
|
|
24678
|
+
if (!check2.ok) {
|
|
24679
|
+
dbg("finish: Antigravity REJECTED " + (result.email || "?") + " (status " + check2.status + ") \u2014 not adding");
|
|
24680
|
+
process.stderr.write("antigravity: this account isn't enabled for Antigravity (HTTP " + check2.status + ") \u2014 not added.\nUse a Google account that has Antigravity/Gemini access.\n");
|
|
24681
|
+
return null;
|
|
24682
|
+
}
|
|
24683
|
+
if (check2.inconclusive) dbg("finish: access check inconclusive (" + check2.inconclusive + ") \u2014 adding anyway");
|
|
24656
24684
|
addAccount(PROVIDER_ID, account);
|
|
24657
24685
|
dbg("finish: addAccount done id=" + account.id);
|
|
24658
24686
|
if (boundProxy) proxyManager.bindAccountProxy(account.id, boundProxy);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "antigravity-auth",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.1",
|
|
4
4
|
"description": "Google Antigravity provider for OpenCode and Claude Code, built on core-auth — multi-account rotation, quota management, proxy support",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"type": "module",
|