opencode-antigravity-auth 1.0.4 → 1.0.6
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/README.md +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/src/antigravity/oauth.d.ts +31 -0
- package/dist/src/antigravity/oauth.d.ts.map +1 -0
- package/dist/src/antigravity/oauth.js +154 -0
- package/dist/src/antigravity/oauth.js.map +1 -0
- package/dist/src/constants.d.ts +52 -0
- package/dist/src/constants.d.ts.map +1 -0
- package/dist/src/constants.js +66 -0
- package/dist/src/constants.js.map +1 -0
- package/dist/src/plugin/auth.d.ts +15 -0
- package/dist/src/plugin/auth.d.ts.map +1 -0
- package/dist/src/plugin/auth.js +33 -0
- package/dist/src/plugin/auth.js.map +1 -0
- package/dist/src/plugin/cache.d.ts +14 -0
- package/dist/src/plugin/cache.d.ts.map +1 -0
- package/dist/src/plugin/cache.js +56 -0
- package/dist/src/plugin/cache.js.map +1 -0
- package/dist/src/plugin/cli.d.ts +5 -0
- package/dist/src/plugin/cli.d.ts.map +1 -0
- package/dist/src/plugin/cli.js +16 -0
- package/dist/src/plugin/cli.js.map +1 -0
- package/dist/src/plugin/debug.d.ts +30 -0
- package/dist/src/plugin/debug.d.ts.map +1 -0
- package/dist/src/plugin/debug.js +142 -0
- package/dist/src/plugin/debug.js.map +1 -0
- package/dist/src/plugin/project.d.ts +33 -0
- package/dist/src/plugin/project.d.ts.map +1 -0
- package/dist/src/plugin/project.js +241 -0
- package/dist/src/plugin/project.js.map +1 -0
- package/dist/src/plugin/request-helpers.d.ts +81 -0
- package/dist/src/plugin/request-helpers.d.ts.map +1 -0
- package/dist/src/plugin/request-helpers.js +288 -0
- package/dist/src/plugin/request-helpers.js.map +1 -0
- package/dist/src/plugin/request.d.ts +27 -0
- package/dist/src/plugin/request.d.ts.map +1 -0
- package/dist/src/plugin/request.js +478 -0
- package/dist/src/plugin/request.js.map +1 -0
- package/dist/src/plugin/server.d.ts +23 -0
- package/dist/src/plugin/server.d.ts.map +1 -0
- package/dist/src/plugin/server.js +216 -0
- package/dist/src/plugin/server.js.map +1 -0
- package/dist/src/plugin/token.d.ts +6 -0
- package/dist/src/plugin/token.d.ts.map +1 -0
- package/dist/src/plugin/token.js +126 -0
- package/dist/src/plugin/token.js.map +1 -0
- package/dist/src/plugin/token.test.d.ts +2 -0
- package/dist/src/plugin/token.test.d.ts.map +1 -0
- package/dist/src/plugin/token.test.js +56 -0
- package/dist/src/plugin/token.test.js.map +1 -0
- package/dist/src/plugin/types.d.ts +68 -0
- package/dist/src/plugin/types.d.ts.map +1 -0
- package/dist/src/plugin/types.js +1 -0
- package/dist/src/plugin/types.js.map +1 -0
- package/dist/src/plugin.d.ts +8 -0
- package/dist/src/plugin.d.ts.map +1 -0
- package/dist/src/plugin.js +249 -0
- package/dist/src/plugin.js.map +1 -0
- package/package.json +4 -3
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
import { exec } from "node:child_process";
|
|
2
|
+
import { ANTIGRAVITY_ENDPOINT_FALLBACKS, ANTIGRAVITY_PROVIDER_ID, ANTIGRAVITY_REDIRECT_URI, } from "./constants";
|
|
3
|
+
import { authorizeAntigravity, exchangeAntigravity } from "./antigravity/oauth";
|
|
4
|
+
import { accessTokenExpired, isOAuthAuth } from "./plugin/auth";
|
|
5
|
+
import { promptProjectId } from "./plugin/cli";
|
|
6
|
+
import { ensureProjectContext } from "./plugin/project";
|
|
7
|
+
import { startAntigravityDebugRequest } from "./plugin/debug";
|
|
8
|
+
import { isGenerativeLanguageRequest, prepareAntigravityRequest, transformAntigravityResponse, } from "./plugin/request";
|
|
9
|
+
import { refreshAccessToken } from "./plugin/token";
|
|
10
|
+
import { startOAuthListener } from "./plugin/server";
|
|
11
|
+
/**
|
|
12
|
+
* Creates an Antigravity OAuth plugin for a specific provider ID.
|
|
13
|
+
*/
|
|
14
|
+
export const createAntigravityPlugin = (providerId) => async ({ client }) => ({
|
|
15
|
+
auth: {
|
|
16
|
+
provider: providerId,
|
|
17
|
+
loader: async (getAuth, provider) => {
|
|
18
|
+
const auth = await getAuth();
|
|
19
|
+
if (!isOAuthAuth(auth)) {
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
if (provider.models) {
|
|
23
|
+
for (const model of Object.values(provider.models)) {
|
|
24
|
+
if (model) {
|
|
25
|
+
model.cost = { input: 0, output: 0 };
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return {
|
|
30
|
+
apiKey: "",
|
|
31
|
+
async fetch(input, init) {
|
|
32
|
+
// If the request is for the *other* provider, we might still want to intercept if URL matches
|
|
33
|
+
// But strict compliance means we only handle requests if the auth provider matches.
|
|
34
|
+
// Since loader is instantiated per provider, we are good.
|
|
35
|
+
if (!isGenerativeLanguageRequest(input)) {
|
|
36
|
+
return fetch(input, init);
|
|
37
|
+
}
|
|
38
|
+
const latestAuth = await getAuth();
|
|
39
|
+
if (!isOAuthAuth(latestAuth)) {
|
|
40
|
+
return fetch(input, init);
|
|
41
|
+
}
|
|
42
|
+
let authRecord = latestAuth;
|
|
43
|
+
if (accessTokenExpired(authRecord)) {
|
|
44
|
+
const refreshed = await refreshAccessToken(authRecord, client, providerId);
|
|
45
|
+
if (!refreshed) {
|
|
46
|
+
return fetch(input, init);
|
|
47
|
+
}
|
|
48
|
+
authRecord = refreshed;
|
|
49
|
+
}
|
|
50
|
+
const accessToken = authRecord.access;
|
|
51
|
+
if (!accessToken) {
|
|
52
|
+
return fetch(input, init);
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Ensures we have a usable project context for the current auth snapshot.
|
|
56
|
+
*/
|
|
57
|
+
async function resolveProjectContext() {
|
|
58
|
+
try {
|
|
59
|
+
return await ensureProjectContext(authRecord, client, providerId);
|
|
60
|
+
}
|
|
61
|
+
catch (error) {
|
|
62
|
+
throw error;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
const projectContext = await resolveProjectContext();
|
|
66
|
+
// Endpoint fallback logic: try daily → autopush → prod
|
|
67
|
+
let lastError = null;
|
|
68
|
+
let lastResponse = null;
|
|
69
|
+
for (let i = 0; i < ANTIGRAVITY_ENDPOINT_FALLBACKS.length; i++) {
|
|
70
|
+
const currentEndpoint = ANTIGRAVITY_ENDPOINT_FALLBACKS[i];
|
|
71
|
+
try {
|
|
72
|
+
const { request, init: transformedInit, streaming, requestedModel, effectiveModel, projectId: usedProjectId, endpoint: usedEndpoint, toolDebugMissing, toolDebugSummary, toolDebugPayload, } = prepareAntigravityRequest(input, init, accessToken, projectContext.effectiveProjectId, currentEndpoint);
|
|
73
|
+
const originalUrl = toUrlString(input);
|
|
74
|
+
const resolvedUrl = toUrlString(request);
|
|
75
|
+
const debugContext = startAntigravityDebugRequest({
|
|
76
|
+
originalUrl,
|
|
77
|
+
resolvedUrl,
|
|
78
|
+
method: transformedInit.method,
|
|
79
|
+
headers: transformedInit.headers,
|
|
80
|
+
body: transformedInit.body,
|
|
81
|
+
streaming,
|
|
82
|
+
projectId: projectContext.effectiveProjectId,
|
|
83
|
+
});
|
|
84
|
+
const response = await fetch(request, transformedInit);
|
|
85
|
+
// Check if we should retry with next endpoint
|
|
86
|
+
const shouldRetry = (response.status === 403 || // Forbidden
|
|
87
|
+
response.status === 404 || // Not Found
|
|
88
|
+
response.status === 429 || // Rate Limit
|
|
89
|
+
response.status >= 500 // Server errors
|
|
90
|
+
);
|
|
91
|
+
if (shouldRetry && i < ANTIGRAVITY_ENDPOINT_FALLBACKS.length - 1) {
|
|
92
|
+
// Try next endpoint
|
|
93
|
+
lastResponse = response;
|
|
94
|
+
continue;
|
|
95
|
+
}
|
|
96
|
+
// Success or final attempt - return transformed response
|
|
97
|
+
return transformAntigravityResponse(response, streaming, debugContext, requestedModel, usedProjectId, usedEndpoint, effectiveModel, toolDebugMissing, toolDebugSummary, toolDebugPayload);
|
|
98
|
+
}
|
|
99
|
+
catch (error) {
|
|
100
|
+
// Network error or other exception
|
|
101
|
+
if (i < ANTIGRAVITY_ENDPOINT_FALLBACKS.length - 1) {
|
|
102
|
+
lastError = error instanceof Error ? error : new Error(String(error));
|
|
103
|
+
continue;
|
|
104
|
+
}
|
|
105
|
+
// Final attempt failed, throw the error
|
|
106
|
+
throw error;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
// If we get here, all endpoints failed
|
|
110
|
+
if (lastResponse) {
|
|
111
|
+
// Return the last response even if it was an error
|
|
112
|
+
const { streaming, requestedModel, effectiveModel, projectId: usedProjectId, endpoint: usedEndpoint, toolDebugMissing, toolDebugSummary, toolDebugPayload, } = prepareAntigravityRequest(input, init, accessToken, projectContext.effectiveProjectId, ANTIGRAVITY_ENDPOINT_FALLBACKS[ANTIGRAVITY_ENDPOINT_FALLBACKS.length - 1]);
|
|
113
|
+
const debugContext = startAntigravityDebugRequest({
|
|
114
|
+
originalUrl: toUrlString(input),
|
|
115
|
+
resolvedUrl: toUrlString(input),
|
|
116
|
+
method: init?.method,
|
|
117
|
+
headers: init?.headers,
|
|
118
|
+
body: init?.body,
|
|
119
|
+
streaming,
|
|
120
|
+
projectId: projectContext.effectiveProjectId,
|
|
121
|
+
});
|
|
122
|
+
return transformAntigravityResponse(lastResponse, streaming, debugContext, requestedModel, usedProjectId, usedEndpoint, effectiveModel, toolDebugMissing, toolDebugSummary, toolDebugPayload);
|
|
123
|
+
}
|
|
124
|
+
throw lastError || new Error("All Antigravity endpoints failed");
|
|
125
|
+
},
|
|
126
|
+
};
|
|
127
|
+
},
|
|
128
|
+
methods: [
|
|
129
|
+
{
|
|
130
|
+
label: "OAuth with Google (Antigravity)",
|
|
131
|
+
type: "oauth",
|
|
132
|
+
authorize: async () => {
|
|
133
|
+
const isHeadless = !!(process.env.SSH_CONNECTION ||
|
|
134
|
+
process.env.SSH_CLIENT ||
|
|
135
|
+
process.env.SSH_TTY ||
|
|
136
|
+
process.env.OPENCODE_HEADLESS);
|
|
137
|
+
let listener = null;
|
|
138
|
+
if (!isHeadless) {
|
|
139
|
+
try {
|
|
140
|
+
listener = await startOAuthListener();
|
|
141
|
+
}
|
|
142
|
+
catch (error) {
|
|
143
|
+
console.log("\nWarning: Couldn't start the local callback listener. Falling back to manual copy/paste.");
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
const authorization = await authorizeAntigravity("");
|
|
147
|
+
// Try to open the browser automatically
|
|
148
|
+
if (!isHeadless) {
|
|
149
|
+
try {
|
|
150
|
+
if (process.platform === "darwin") {
|
|
151
|
+
exec(`open "${authorization.url}"`);
|
|
152
|
+
}
|
|
153
|
+
else if (process.platform === "win32") {
|
|
154
|
+
exec(`start "${authorization.url}"`);
|
|
155
|
+
}
|
|
156
|
+
else {
|
|
157
|
+
exec(`xdg-open "${authorization.url}"`);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
catch (e) {
|
|
161
|
+
console.log("Could not open browser automatically. Please Copy/Paste the URL below.");
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
if (listener) {
|
|
165
|
+
const { host } = new URL(ANTIGRAVITY_REDIRECT_URI);
|
|
166
|
+
return {
|
|
167
|
+
url: authorization.url,
|
|
168
|
+
instructions: "Complete the sign-in flow in your browser. We'll automatically detect the redirect back to localhost.",
|
|
169
|
+
method: "auto",
|
|
170
|
+
callback: async () => {
|
|
171
|
+
try {
|
|
172
|
+
// We know listener is not null here because we checked 'if (listener)'
|
|
173
|
+
// But TS might need a check or non-null assertion if not inferable.
|
|
174
|
+
// Since we are in the if (listener) block, it is safe.
|
|
175
|
+
const callbackUrl = await listener.waitForCallback();
|
|
176
|
+
const code = callbackUrl.searchParams.get("code");
|
|
177
|
+
const state = callbackUrl.searchParams.get("state");
|
|
178
|
+
if (!code || !state) {
|
|
179
|
+
return {
|
|
180
|
+
type: "failed",
|
|
181
|
+
error: "Missing code or state in callback URL",
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
return await exchangeAntigravity(code, state);
|
|
185
|
+
}
|
|
186
|
+
catch (error) {
|
|
187
|
+
return {
|
|
188
|
+
type: "failed",
|
|
189
|
+
error: error instanceof Error ? error.message : "Unknown error",
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
finally {
|
|
193
|
+
try {
|
|
194
|
+
await listener?.close();
|
|
195
|
+
}
|
|
196
|
+
catch {
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
},
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
return {
|
|
203
|
+
url: authorization.url,
|
|
204
|
+
instructions: "Paste the full redirected URL (e.g., http://localhost:8085/oauth2callback?code=...): ",
|
|
205
|
+
method: "code",
|
|
206
|
+
callback: async (callbackUrl) => {
|
|
207
|
+
try {
|
|
208
|
+
const url = new URL(callbackUrl);
|
|
209
|
+
const code = url.searchParams.get("code");
|
|
210
|
+
const state = url.searchParams.get("state");
|
|
211
|
+
if (!code || !state) {
|
|
212
|
+
return {
|
|
213
|
+
type: "failed",
|
|
214
|
+
error: "Missing code or state in callback URL",
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
return exchangeAntigravity(code, state);
|
|
218
|
+
}
|
|
219
|
+
catch (error) {
|
|
220
|
+
return {
|
|
221
|
+
type: "failed",
|
|
222
|
+
error: error instanceof Error ? error.message : "Unknown error",
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
},
|
|
226
|
+
};
|
|
227
|
+
},
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
provider: providerId,
|
|
231
|
+
label: "Manually enter API Key",
|
|
232
|
+
type: "api",
|
|
233
|
+
},
|
|
234
|
+
],
|
|
235
|
+
},
|
|
236
|
+
});
|
|
237
|
+
export const AntigravityCLIOAuthPlugin = createAntigravityPlugin(ANTIGRAVITY_PROVIDER_ID);
|
|
238
|
+
export const GoogleOAuthPlugin = AntigravityCLIOAuthPlugin;
|
|
239
|
+
function toUrlString(value) {
|
|
240
|
+
if (typeof value === "string") {
|
|
241
|
+
return value;
|
|
242
|
+
}
|
|
243
|
+
const candidate = value.url;
|
|
244
|
+
if (candidate) {
|
|
245
|
+
return candidate;
|
|
246
|
+
}
|
|
247
|
+
return value.toString();
|
|
248
|
+
}
|
|
249
|
+
//# sourceMappingURL=plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../../src/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EACL,8BAA8B,EAC9B,uBAAuB,EACvB,wBAAwB,GACzB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAEhF,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,4BAA4B,EAAE,MAAM,gBAAgB,CAAC;AAC9D,OAAO,EACL,2BAA2B,EAC3B,yBAAyB,EACzB,4BAA4B,GAC7B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAsB,MAAM,iBAAiB,CAAC;AAUzE;;GAEG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,UAAkB,EAAE,EAAE,CAAC,KAAK,EAClE,EAAE,MAAM,EAAiB,EACF,EAAE,CAAC,CAAC;IAC3B,IAAI,EAAE;QACJ,QAAQ,EAAE,UAAU;QACpB,MAAM,EAAE,KAAK,EAAE,OAAgB,EAAE,QAAkB,EAAgC,EAAE;YACnF,MAAM,IAAI,GAAG,MAAM,OAAO,EAAE,CAAC;YAC7B,IAAI,CAAC,WAAW,CAAC,IAAI,CAA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AK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe;iCAChE,CAAC;4BACJ,CAAC;wBACH,CAAC;qBACF,CAAC;gBACJ,CAAC;aACF;YACD;gBACE,QAAQ,EAAE,UAAU;gBACpB,KAAK,EAAE,wBAAwB;gBAC/B,IAAI,EAAE,KAAK;aACZ;SACF;KACF;CACF,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,yBAAyB,GAAG,uBAAuB,CAAC,uBAAuB,CAAC,CAAC;AAC1F,MAAM,CAAC,MAAM,iBAAiB,GAAG,yBAAyB,CAAC;AAE3D,SAAS,WAAW,CAAC,KAAkB;IACrC,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,OAAO,KAAK,CAAC;IACf,CAAC;IACD,MAAM,SAAS,GAAI,KAAiB,CAAC,GAAG,CAAC;IACzC,IAAI,SAAS,EAAE,CAAC;QACd,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,OAAO,KAAK,CAAC,QAAQ,EAAE,CAAC;AAC1B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-antigravity-auth",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6",
|
|
4
4
|
"description": "Google Antigravity IDE OAuth auth plugin for Opencode - access Gemini 3 Pro and Claude 4.5 using Google credentials",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -34,12 +34,13 @@
|
|
|
34
34
|
"LICENSE"
|
|
35
35
|
],
|
|
36
36
|
"scripts": {
|
|
37
|
-
"build": "tsc",
|
|
37
|
+
"build": "tsc -p tsconfig.build.json",
|
|
38
38
|
"typecheck": "tsc --noEmit",
|
|
39
39
|
"test": "vitest run",
|
|
40
40
|
"test:watch": "vitest",
|
|
41
41
|
"test:ui": "vitest --ui",
|
|
42
|
-
"test:coverage": "vitest run --coverage"
|
|
42
|
+
"test:coverage": "vitest run --coverage",
|
|
43
|
+
"prepublishOnly": "npm run build"
|
|
43
44
|
},
|
|
44
45
|
"peerDependencies": {
|
|
45
46
|
"typescript": "^5"
|