opencode-gemini-app 0.0.0-stage → 0.1.0

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.
Files changed (42) hide show
  1. package/DISCLAIMER.md +17 -0
  2. package/LICENSE +21 -0
  3. package/README.md +44 -2
  4. package/extensions/opencode/auth.js +324 -0
  5. package/extensions/opencode/fetch.js +494 -0
  6. package/extensions/opencode/index.js +27 -0
  7. package/extensions/opencode/models.js +84 -0
  8. package/extensions/pi/auth.js +215 -0
  9. package/native-wire/consumer-tool-codec.mjs +239 -0
  10. package/native-wire/oauth-loopback.mjs +175 -0
  11. package/native-wire/protobuf.mjs +133 -0
  12. package/native-wire/robin-current.mjs +172 -0
  13. package/package.json +75 -4
  14. package/src/gateway/automatic-recovery.mjs +64 -0
  15. package/src/gateway/image-download.mjs +110 -0
  16. package/src/gateway/image-upload.mjs +219 -0
  17. package/src/gateway/native-diagnostic.mjs +189 -0
  18. package/src/gateway/native-evidence.mjs +113 -0
  19. package/src/gateway/native-response-limits.mjs +8 -0
  20. package/src/gateway/native-search-citations.mjs +196 -0
  21. package/src/gateway/native-search-diagnostic.mjs +282 -0
  22. package/src/gateway/native-search-metadata.mjs +749 -0
  23. package/src/gateway/native-transport.mjs +375 -0
  24. package/src/gateway/oauth-client-defaults.mjs +12 -0
  25. package/src/gateway/oauth-identity.mjs +67 -0
  26. package/src/gateway/outbound-proxy.mjs +320 -0
  27. package/src/gateway/output-recovery.mjs +48 -0
  28. package/src/gateway/quota-failover.mjs +14 -0
  29. package/src/gateway/quota-transport.mjs +37 -0
  30. package/src/gateway/quota.mjs +181 -0
  31. package/src/gateway/soft-error.mjs +25 -0
  32. package/src/gateway/structured-output.mjs +157 -0
  33. package/src/gateway/subscription.mjs +51 -0
  34. package/src/gateway/terms.mjs +126 -0
  35. package/src/image-input.mjs +137 -0
  36. package/src/image-url.mjs +21 -0
  37. package/src/native-provider.mjs +681 -0
  38. package/src/openai-contract.mjs +576 -0
  39. package/src/openai-usage.mjs +66 -0
  40. package/src/prompt-tool-schema.mjs +391 -0
  41. package/src/responses-tool-namespaces.mjs +84 -0
  42. package/src/tool-protocol.mjs +348 -0
package/DISCLAIMER.md ADDED
@@ -0,0 +1,17 @@
1
+ # Disclaimer & Terms of Use / 免責聲明與使用條款
2
+
3
+ ## English
4
+
5
+ 1. **Independent Interoperability Research Project:** Gemini App2API is an independent software engineering and protocol-interoperability project. It is **not** affiliated with, endorsed by, sponsored by, or supported by Google LLC.
6
+ 2. **Interoperability Configuration; No User Credentials, Accounts, or Quota Supplied:** The default fallback OAuth 2.0 loopback configuration incorporates standard desktop client identifiers strictly for protocol-interoperability research so users can authenticate locally with Google's OAuth endpoints. This repository does **not** distribute Google application binaries, user credentials, refresh/access tokens, accounts, or model quota. Users must authenticate personally with their own authorized Google accounts.
7
+ 3. **Terms of Service (ToS) & Account Risk:** Using third-party clients, automated coding harnesses, or multi-account routing with Google accounts may conflict with or violate Google's Terms of Service or plan-specific policies. Upstream enforcement by Google may result in rate limiting, feature restrictions, or temporary/permanent account suspension or termination. You are solely responsible for reviewing and complying with all applicable terms governing your accounts.
8
+ 4. **No Warranty & Limitation of Liability:** This software is provided **"AS IS"**, without warranty of any kind, express or implied (see [LICENSE](LICENSE)). In no event shall the authors, maintainers, or contributors be liable for any account suspension, quota loss, service interruption, data loss, or any direct, indirect, incidental, or consequential damages arising out of or in connection with the use of this software. **Your accounts, your deployment, your risk.**
9
+
10
+ ---
11
+
12
+ ## 繁體中文
13
+
14
+ 1. **獨立互通性研究專案:** Gemini App2API 為獨立之軟體工程與通訊協定互通性(Protocol Interoperability)研究專案,**與 Google LLC 無任何隸屬、合作、授權或背書關係**。
15
+ 2. **互通性設定聲明;不提供任何使用者憑證、帳戶或額度:** 預設之本機 OAuth 2.0 loopback 備援設定包含標準桌面端 client 識別參數,僅供通訊協定互通性(Protocol Interoperability)研究與本機標準 OAuth 驗證流程使用。本儲存庫**絕不分發**任何 Google 應用程式二進位檔、使用者登入憑證、Refresh/Access Token、帳戶或模型額度;使用者必須親自以本人合法授權之 Google 帳戶完成驗證。
16
+ 3. **服務條款(ToS)與帳戶風控風險:** 將 Google 帳戶連接至非官方客戶端、自動化編碼 Agent 工具鏈或使用多帳戶路由功能,可能違反 Google 服務條款(Terms of Service)或個別訂閱方案之使用規範,並可能導致上游限流、功能受限,或帳戶遭到暫時/永久停權與封禁。使用者須自行查閱並遵守其帳戶所適用之相關條款。
17
+ 4. **無擔保與零法律責任:** 本軟體係依「現狀(AS IS)」提供,不附帶任何明示或默示之保證(詳見 [LICENSE](LICENSE))。作者、維護者與貢獻者亦不鼓勵或誘導任何違反第三方合約之行為,且對因使用本軟體而引致之任何帳戶封禁、額度損失、服務中斷、資料遺失或任何直接/間接損害**概不承擔任何法律責任**。**你的帳戶、你的部署,一切風險由你自行承擔。**
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 shawtim
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,45 @@
1
- # Temporary Holding Version
1
+ # opencode-gemini-app
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Zero-dependency native Google Gemini HTTP/2 provider plugin for **OpenCode** (`opencode`). Connect your Google Gemini subscription (**AI Pro**, **AI Ultra**, or **Free**) directly in-process via OAuth—no local gateway server, no localhost port, no Docker, and zero external npm dependencies.
4
+
5
+ ## Install
6
+
7
+ Add `opencode-gemini-app` to your `opencode.json` (project or `~/.config/opencode/opencode.json`):
8
+
9
+ ```json
10
+ {
11
+ "$schema": "https://opencode.ai/config.json",
12
+ "plugin": ["opencode-gemini-app"]
13
+ }
14
+ ```
15
+
16
+ The plugin automatically registers the `gemini-app` provider and its models (`gemini-neon`, `gemini-hydrogen`, `gemini-flash-lite`, `gemini-auto`) via OpenCode's `config` hook—no manual provider block required.
17
+
18
+ ## Sign In & Select a Model
19
+
20
+ 1. Open OpenCode and run:
21
+ ```text
22
+ /connect
23
+ ```
24
+ 2. Select **`gemini-app`** and choose either:
25
+ - **Browser — automatic localhost callback** (local machine), or
26
+ - **Remote / Headless — paste redirect URL** (SSH / VPS).
27
+ 3. Switch models with `/models` and choose:
28
+
29
+ | Model ID | Context Window | Notes |
30
+ |---|---:|---|
31
+ | `gemini-app/gemini-neon` | `512,000` | High-capability Gemini 4 Neon (`PRO`, thinking + tools + images) |
32
+ | `gemini-app/gemini-hydrogen` | `512,000` | Fast Gemini 4 Hydrogen (`FAST`, ~2× faster and lower quota usage) |
33
+ | `gemini-app/gemini-flash-lite` | `128,000` | Lightweight model for quick tasks |
34
+ | `gemini-app/gemini-auto` | `128,000` | Dynamic routing (automatically used for Free-tier Google accounts) |
35
+
36
+ ## Features
37
+
38
+ - **In-Process Direct HTTP/2**: Intercepts OpenCode's `@ai-sdk/openai-compatible` `fetch` in-process with zero local server port and full live SSE streaming (`15s` keepalives + upstream stall watchdogs).
39
+ - **Zero Runtime Dependencies**: Pure ESM compatible with both Bun (OpenCode runtime) and Node.js `>=22`.
40
+ - **Full Tool Calling & Multimodal Images**: Up to 256 caller tools, strict schema validation, hallucinated tool-result suppression, and parallel HTTP/2 image uploads with per-session in-memory Blob-ID caching.
41
+ - **Built-in Proxy Support**: Honors standard `HTTPS_PROXY`, `HTTP_PROXY`, `ALL_PROXY`, and `NO_PROXY` environment variables.
42
+
43
+ ## Disclaimer & License
44
+
45
+ Independent open-source community project, not affiliated with Google. See [DISCLAIMER.md](DISCLAIMER.md) and [LICENSE](LICENSE).
@@ -0,0 +1,324 @@
1
+ import {
2
+ startLoopbackLogin as defaultStartLoopbackLogin,
3
+ refreshNativeCredential as defaultRefreshNativeCredential,
4
+ } from '../../native-wire/oauth-loopback.mjs';
5
+ import { acceptGoogleMainTerms as defaultAcceptGoogleMainTerms } from '../../src/gateway/terms.mjs';
6
+ import { fetchGoogleUsageInfo as defaultFetchGoogleUsageInfo } from '../../src/gateway/quota-transport.mjs';
7
+ import { decodeSubscription as defaultDecodeSubscription } from '../../src/gateway/subscription.mjs';
8
+ import { identifyGoogleAccount as defaultIdentifyGoogleAccount } from '../../src/gateway/oauth-identity.mjs';
9
+ import { DEFAULT_OAUTH_PROFILE } from '../../src/gateway/oauth-client-defaults.mjs';
10
+ import { resolveOAuthConfig } from '../pi/auth.js';
11
+ import { PROVIDER_ID } from './models.js';
12
+ import { createOpenCodeFetch } from './fetch.js';
13
+
14
+ function computeExpiresAtMs(expiresInSeconds) {
15
+ const ttlSeconds = Number.isFinite(expiresInSeconds) && expiresInSeconds > 0 ? expiresInSeconds : 3600;
16
+ return Date.now() + Math.max(60, ttlSeconds - 300) * 1000;
17
+ }
18
+
19
+ export function createOpenCodeAuthHook({
20
+ client,
21
+ env = process.env,
22
+ acceptTerms = env?.GEMINI_OPENCODE_ACCEPT_TERMS === '1',
23
+ startLoopbackLogin = defaultStartLoopbackLogin,
24
+ refreshNativeCredential = defaultRefreshNativeCredential,
25
+ acceptGoogleMainTerms = defaultAcceptGoogleMainTerms,
26
+ fetchGoogleUsageInfo = defaultFetchGoogleUsageInfo,
27
+ decodeSubscription = defaultDecodeSubscription,
28
+ identifyGoogleAccount = defaultIdentifyGoogleAccount,
29
+ defaultProfile = DEFAULT_OAUTH_PROFILE,
30
+ openTurn,
31
+ uploadImages,
32
+ now = Date.now,
33
+ } = {}) {
34
+ // Advisory display-only tier for provider.models(); each loader maintains its own isolated { identity, tier }.
35
+ let displayTierState = { identity: null, tier: 'unknown' };
36
+
37
+ async function detectSubscriptionTier(accessToken, { signal } = {}) {
38
+ try {
39
+ const { payload } = await fetchGoogleUsageInfo(accessToken, { signal, timeoutMs: 8000 });
40
+ const sub = decodeSubscription(payload);
41
+ return typeof sub?.tier === 'string' && sub.tier ? sub.tier : 'unknown';
42
+ } catch {
43
+ return 'unknown';
44
+ }
45
+ }
46
+
47
+ async function detectAccountId(accessToken) {
48
+ try {
49
+ const identity = await identifyGoogleAccount({ accessToken }, { timeoutMs: 8000 });
50
+ return typeof identity?.email === 'string' && identity.email ? identity.email : undefined;
51
+ } catch {
52
+ return undefined;
53
+ }
54
+ }
55
+
56
+ async function finalizeLoginTokens(config, tokens) {
57
+ if (!tokens || typeof tokens.refreshToken !== 'string' || !tokens.refreshToken) {
58
+ return { type: 'failed' };
59
+ }
60
+ const scoped = await refreshNativeCredential(config, tokens.refreshToken);
61
+ if (!scoped?.accessToken) {
62
+ return { type: 'failed' };
63
+ }
64
+ if (acceptTerms === true) {
65
+ try {
66
+ await acceptGoogleMainTerms(scoped.accessToken, { timeoutMs: 15_000 });
67
+ } catch {
68
+ // Non-fatal: accounts with already-accepted terms proceed cleanly.
69
+ }
70
+ }
71
+ const [tier, accountId] = await Promise.all([
72
+ detectSubscriptionTier(scoped.accessToken),
73
+ detectAccountId(scoped.accessToken),
74
+ ]);
75
+ const refresh = scoped.refreshToken || tokens.refreshToken;
76
+ displayTierState = { identity: refresh, tier };
77
+ return {
78
+ type: 'success',
79
+ refresh,
80
+ access: scoped.accessToken,
81
+ expires: computeExpiresAtMs(scoped.expiresInSeconds ?? tokens.expiresInSeconds),
82
+ ...(accountId ? { accountId } : {}),
83
+ };
84
+ }
85
+
86
+ async function beginLoopbackAuthorize({ remote = false } = {}) {
87
+ const config = resolveOAuthConfig({ defaultProfile, env });
88
+ const session = await startLoopbackLogin(config);
89
+ const authUrl = typeof session?.authorizationUrl === 'string' && session.authorizationUrl.trim()
90
+ ? session.authorizationUrl.trim()
91
+ : '';
92
+ if (!authUrl) {
93
+ try { session?.close?.('NO_AUTH_URL'); } catch {}
94
+ throw new Error('OAuth loopback login did not return an authorization URL');
95
+ }
96
+
97
+ if (remote) {
98
+ return {
99
+ url: authUrl,
100
+ instructions:
101
+ 'Open the URL in your browser, complete Google sign-in, then paste the full localhost redirect URL (containing code=...) below. Sign-in does not auto-accept Gemini ToS; accept in https://gemini.google.com/ (or opt in via GEMINI_OPENCODE_ACCEPT_TERMS=1).',
102
+ method: 'code',
103
+ async callback(pastedUrl) {
104
+ try {
105
+ if (typeof pastedUrl !== 'string' || !pastedUrl.includes('code=')) {
106
+ return { type: 'failed' };
107
+ }
108
+ await session.completeCallbackUrl(pastedUrl.trim());
109
+ const tokens = await session.done;
110
+ return await finalizeLoginTokens(config, tokens);
111
+ } catch {
112
+ return { type: 'failed' };
113
+ } finally {
114
+ try { session.close('LOGIN_CLEANUP'); } catch {}
115
+ }
116
+ },
117
+ };
118
+ }
119
+
120
+ return {
121
+ url: authUrl,
122
+ instructions:
123
+ 'Complete Google sign-in in your browser. OpenCode will detect the localhost callback automatically. Sign-in does not auto-accept Gemini ToS; accept in https://gemini.google.com/ (or opt in via GEMINI_OPENCODE_ACCEPT_TERMS=1).',
124
+ method: 'auto',
125
+ async callback() {
126
+ try {
127
+ const tokens = await session.done;
128
+ return await finalizeLoginTokens(config, tokens);
129
+ } catch {
130
+ return { type: 'failed' };
131
+ } finally {
132
+ try { session.close('LOGIN_CLEANUP'); } catch {}
133
+ }
134
+ },
135
+ };
136
+ }
137
+
138
+ async function loader(getAuth) {
139
+ const initial = await getAuth();
140
+ if (!initial || initial.type !== 'oauth' || !initial.refresh) {
141
+ return {};
142
+ }
143
+
144
+ // Track in-memory credential, tier, and accountEpoch strictly per-loader so concurrent loaders
145
+ // or account switches/logouts never cross-contaminate tiers, reuse stale tokens, or write back old accounts.
146
+ let liveCred = {
147
+ refresh: initial.refresh,
148
+ access: initial.access || '',
149
+ expires: Number.isFinite(initial.expires) ? initial.expires : 0,
150
+ };
151
+ let tierState = { identity: null, tier: 'unknown' };
152
+ let accountEpoch = 0;
153
+ let inflightRefresh = null;
154
+ let inflightRefreshIdentity = null;
155
+ let inflightTierProbe = null;
156
+ let inflightTierProbeIdentity = null;
157
+
158
+ const verifyIdentityMatches = async (expectedRefresh) => {
159
+ const current = await getAuth();
160
+ if (!current || current.type !== 'oauth' || typeof current.refresh !== 'string' || !current.refresh) {
161
+ liveCred = null;
162
+ tierState = { identity: null, tier: 'unknown' };
163
+ accountEpoch++;
164
+ throw Object.assign(new Error('Google Gemini OAuth session is signed out. Run /connect to sign in again.'), {
165
+ code: 'OAUTH_LOGGED_OUT',
166
+ status: 401,
167
+ });
168
+ }
169
+ if (current.refresh !== expectedRefresh) {
170
+ throw Object.assign(new Error('Google Gemini OAuth account changed during token refresh; retry request.'), {
171
+ code: 'OAUTH_ACCOUNT_CHANGED',
172
+ status: 401,
173
+ });
174
+ }
175
+ return current;
176
+ };
177
+
178
+ const resolveTierForIdentity = async (accessToken, identity, { signal } = {}) => {
179
+ if (tierState.identity === identity) return tierState.tier;
180
+ if (inflightTierProbe && inflightTierProbeIdentity === identity) {
181
+ return inflightTierProbe;
182
+ }
183
+ const probePromise = (async () => {
184
+ const tier = await detectSubscriptionTier(accessToken, { signal });
185
+ await verifyIdentityMatches(identity);
186
+ tierState = { identity, tier };
187
+ displayTierState = { identity, tier };
188
+ return tier;
189
+ })();
190
+ inflightTierProbe = probePromise;
191
+ inflightTierProbeIdentity = identity;
192
+ try {
193
+ return await probePromise;
194
+ } finally {
195
+ if (inflightTierProbe === probePromise) {
196
+ inflightTierProbe = null;
197
+ inflightTierProbeIdentity = null;
198
+ }
199
+ }
200
+ };
201
+
202
+ const resolveAccessToken = async ({ signal, forceRefresh = false } = {}) => {
203
+ const latest = await getAuth();
204
+ if (!latest || latest.type !== 'oauth' || typeof latest.refresh !== 'string' || !latest.refresh) {
205
+ liveCred = null;
206
+ tierState = { identity: null, tier: 'unknown' };
207
+ accountEpoch++;
208
+ throw Object.assign(new Error('Google Gemini OAuth session is signed out. Run /connect to sign in again.'), {
209
+ code: 'OAUTH_LOGGED_OUT',
210
+ status: 401,
211
+ });
212
+ }
213
+
214
+ // Account switch detected: replace in-memory state immediately and bump accountEpoch.
215
+ if (!liveCred || latest.refresh !== liveCred.refresh) {
216
+ liveCred = {
217
+ refresh: latest.refresh,
218
+ access: latest.access || '',
219
+ expires: Number.isFinite(latest.expires) ? latest.expires : 0,
220
+ };
221
+ tierState = { identity: null, tier: 'unknown' };
222
+ accountEpoch++;
223
+ } else if (latest.access && Number.isFinite(latest.expires) && latest.expires > liveCred.expires) {
224
+ liveCred = {
225
+ refresh: latest.refresh,
226
+ access: latest.access,
227
+ expires: latest.expires,
228
+ };
229
+ }
230
+
231
+ const activeEpoch = accountEpoch;
232
+ if (!forceRefresh && liveCred.access && liveCred.expires > now() + 60_000) {
233
+ const currentIdentity = liveCred.refresh;
234
+ const currentAccess = liveCred.access;
235
+ const subscriptionTier = await resolveTierForIdentity(currentAccess, currentIdentity, { signal });
236
+ return { accessToken: currentAccess, subscriptionTier, accountEpoch: activeEpoch };
237
+ }
238
+
239
+ const startRefreshIdentity = liveCred.refresh;
240
+ if (inflightRefresh && inflightRefreshIdentity === startRefreshIdentity) {
241
+ return inflightRefresh;
242
+ }
243
+
244
+ const refreshPromise = (async () => {
245
+ const config = resolveOAuthConfig({ defaultProfile, env });
246
+ const refreshed = await refreshNativeCredential(config, startRefreshIdentity, { signal });
247
+ if (!refreshed?.accessToken) {
248
+ throw Object.assign(new Error('OAuth refresh did not return an access token'), {
249
+ code: 'OAUTH_REFRESH_FAILED',
250
+ status: 401,
251
+ });
252
+ }
253
+ // Probe subscription tier BEFORE mutating live state or writing back, then re-verify
254
+ // auth identity AFTER all network awaits so account switch / logout during tier detection
255
+ // can never overwrite the new account or return a stale token.
256
+ const tier = await detectSubscriptionTier(refreshed.accessToken, { signal });
257
+ await verifyIdentityMatches(startRefreshIdentity);
258
+ const nextCred = {
259
+ refresh: refreshed.refreshToken || startRefreshIdentity,
260
+ access: refreshed.accessToken,
261
+ expires: computeExpiresAtMs(refreshed.expiresInSeconds),
262
+ };
263
+ liveCred = nextCred;
264
+ tierState = { identity: nextCred.refresh, tier };
265
+ displayTierState = { identity: nextCred.refresh, tier };
266
+ try {
267
+ await client?.auth?.set?.({
268
+ path: { id: PROVIDER_ID },
269
+ body: {
270
+ type: 'oauth',
271
+ refresh: nextCred.refresh,
272
+ access: nextCred.access,
273
+ expires: nextCred.expires,
274
+ },
275
+ });
276
+ } catch {
277
+ // Non-fatal: keep refreshed access token in memory even if client persistence fails.
278
+ }
279
+ return { accessToken: nextCred.access, subscriptionTier: tier, accountEpoch: activeEpoch };
280
+ })();
281
+
282
+ inflightRefresh = refreshPromise;
283
+ inflightRefreshIdentity = startRefreshIdentity;
284
+ try {
285
+ return await refreshPromise;
286
+ } finally {
287
+ if (inflightRefresh === refreshPromise) {
288
+ inflightRefresh = null;
289
+ inflightRefreshIdentity = null;
290
+ }
291
+ }
292
+ };
293
+
294
+ return {
295
+ apiKey: 'gemini-app-oauth',
296
+ fetch: createOpenCodeFetch({
297
+ resolveAccessToken,
298
+ getSubscriptionTier: () => tierState.tier,
299
+ ...(openTurn ? { openTurn } : {}),
300
+ ...(uploadImages ? { uploadImages } : {}),
301
+ }),
302
+ };
303
+ }
304
+
305
+ return {
306
+ auth: {
307
+ provider: PROVIDER_ID,
308
+ loader,
309
+ methods: [
310
+ {
311
+ type: 'oauth',
312
+ label: 'Google Gemini OAuth (Browser — automatic localhost callback)',
313
+ authorize: () => beginLoopbackAuthorize({ remote: false }),
314
+ },
315
+ {
316
+ type: 'oauth',
317
+ label: 'Google Gemini OAuth (Remote / Headless — paste redirect URL)',
318
+ authorize: () => beginLoopbackAuthorize({ remote: true }),
319
+ },
320
+ ],
321
+ },
322
+ getSubscriptionTier: () => displayTierState.tier,
323
+ };
324
+ }