opencode-studio-server 1.12.0 → 1.12.3
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/index.js +24 -30
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -189,7 +189,7 @@ function processLogLine(line) {
|
|
|
189
189
|
let namespace = provider;
|
|
190
190
|
if (provider === 'google') {
|
|
191
191
|
const activePlugin = getActiveGooglePlugin();
|
|
192
|
-
namespace =
|
|
192
|
+
namespace = 'google.antigravity';
|
|
193
193
|
}
|
|
194
194
|
|
|
195
195
|
const metadata = loadPoolMetadata();
|
|
@@ -1353,7 +1353,7 @@ const AUTH_PROFILES_DIR = path.join(HOME_DIR, '.config', 'opencode-studio', 'aut
|
|
|
1353
1353
|
const getProfileDir = (provider, activePlugin) => {
|
|
1354
1354
|
let ns = provider;
|
|
1355
1355
|
if (provider === 'google') {
|
|
1356
|
-
ns =
|
|
1356
|
+
ns = 'google.antigravity';
|
|
1357
1357
|
const nsDir = path.join(AUTH_PROFILES_DIR, ns);
|
|
1358
1358
|
const plainDir = path.join(AUTH_PROFILES_DIR, 'google');
|
|
1359
1359
|
const nsHas = fs.existsSync(nsDir) && fs.readdirSync(nsDir).filter(f => f.endsWith('.json')).length > 0;
|
|
@@ -1448,7 +1448,7 @@ app.get('/api/auth', (req, res) => {
|
|
|
1448
1448
|
const saved = listAuthProfiles(p.id, activePlugin);
|
|
1449
1449
|
let curr = !!authCfg[p.id];
|
|
1450
1450
|
if (p.id === 'google') {
|
|
1451
|
-
const key =
|
|
1451
|
+
const key = 'google.antigravity';
|
|
1452
1452
|
curr = !!authCfg[key] || !!authCfg.google;
|
|
1453
1453
|
}
|
|
1454
1454
|
credentials.push({ ...p, active: ac[p.id] || (curr ? 'current' : null), profiles: saved, hasCurrentAuth: curr });
|
|
@@ -1475,7 +1475,7 @@ app.get('/api/auth/profiles', (req, res) => {
|
|
|
1475
1475
|
// Correct current auth check: handle google vs google.gemini/antigravity
|
|
1476
1476
|
let curr = !!authCfg[p];
|
|
1477
1477
|
if (p === 'google') {
|
|
1478
|
-
const key =
|
|
1478
|
+
const key = 'google.antigravity';
|
|
1479
1479
|
curr = !!authCfg[key] || !!authCfg.google;
|
|
1480
1480
|
}
|
|
1481
1481
|
|
|
@@ -1491,7 +1491,7 @@ app.post('/api/auth/profiles/:provider', (req, res) => {
|
|
|
1491
1491
|
const { name } = req.body;
|
|
1492
1492
|
const activePlugin = getActiveGooglePlugin();
|
|
1493
1493
|
const namespace = provider === 'google'
|
|
1494
|
-
? (
|
|
1494
|
+
? ('google.antigravity')
|
|
1495
1495
|
: provider;
|
|
1496
1496
|
|
|
1497
1497
|
const auth = loadAuthConfig() || {};
|
|
@@ -1524,7 +1524,7 @@ app.post('/api/auth/profiles/:provider/:name/activate', (req, res) => {
|
|
|
1524
1524
|
const { provider, name } = req.params;
|
|
1525
1525
|
const activePlugin = getActiveGooglePlugin();
|
|
1526
1526
|
const namespace = provider === 'google'
|
|
1527
|
-
? (
|
|
1527
|
+
? ('google.antigravity')
|
|
1528
1528
|
: provider;
|
|
1529
1529
|
|
|
1530
1530
|
const dir = getProfileDir(provider, activePlugin);
|
|
@@ -1542,7 +1542,7 @@ app.post('/api/auth/profiles/:provider/:name/activate', (req, res) => {
|
|
|
1542
1542
|
|
|
1543
1543
|
// Save both to persistent namespaced key and the shared 'google' key
|
|
1544
1544
|
if (provider === 'google') {
|
|
1545
|
-
const key =
|
|
1545
|
+
const key = 'google.antigravity';
|
|
1546
1546
|
authCfg[key] = profileData;
|
|
1547
1547
|
}
|
|
1548
1548
|
|
|
@@ -1574,7 +1574,7 @@ app.delete('/api/auth/profiles/:provider/all', (req, res) => {
|
|
|
1574
1574
|
console.log(`[Auth] Deleting ALL profiles for: ${provider}`);
|
|
1575
1575
|
const activePlugin = getActiveGooglePlugin();
|
|
1576
1576
|
const namespace = provider === 'google'
|
|
1577
|
-
? (
|
|
1577
|
+
? ('google.antigravity')
|
|
1578
1578
|
: provider;
|
|
1579
1579
|
|
|
1580
1580
|
const dir = getProfileDir(provider, activePlugin);
|
|
@@ -1595,7 +1595,7 @@ app.delete('/api/auth/profiles/:provider/all', (req, res) => {
|
|
|
1595
1595
|
if (authCfg[provider]) {
|
|
1596
1596
|
delete authCfg[provider];
|
|
1597
1597
|
if (provider === 'google') {
|
|
1598
|
-
const key =
|
|
1598
|
+
const key = 'google.antigravity';
|
|
1599
1599
|
delete authCfg.google;
|
|
1600
1600
|
delete authCfg[key];
|
|
1601
1601
|
}
|
|
@@ -1618,7 +1618,7 @@ app.delete('/api/auth/profiles/:provider/:name', (req, res) => {
|
|
|
1618
1618
|
console.log(`[Auth] Deleting profile: ${provider}/${name}`);
|
|
1619
1619
|
const activePlugin = getActiveGooglePlugin();
|
|
1620
1620
|
const namespace = provider === 'google'
|
|
1621
|
-
? (
|
|
1621
|
+
? ('google.antigravity')
|
|
1622
1622
|
: provider;
|
|
1623
1623
|
|
|
1624
1624
|
const dir = getProfileDir(provider, activePlugin);
|
|
@@ -1640,7 +1640,7 @@ app.delete('/api/auth/profiles/:provider/:name', (req, res) => {
|
|
|
1640
1640
|
const authCfg = loadAuthConfig() || {};
|
|
1641
1641
|
delete authCfg[provider];
|
|
1642
1642
|
if (provider === 'google') {
|
|
1643
|
-
const key =
|
|
1643
|
+
const key = 'google.antigravity';
|
|
1644
1644
|
delete authCfg.google;
|
|
1645
1645
|
delete authCfg[key];
|
|
1646
1646
|
}
|
|
@@ -1663,7 +1663,7 @@ app.put('/api/auth/profiles/:provider/:name', (req, res) => {
|
|
|
1663
1663
|
const { newName } = req.body;
|
|
1664
1664
|
const activePlugin = getActiveGooglePlugin();
|
|
1665
1665
|
const namespace = provider === 'google'
|
|
1666
|
-
? (
|
|
1666
|
+
? ('google.antigravity')
|
|
1667
1667
|
: provider;
|
|
1668
1668
|
|
|
1669
1669
|
const dir = getProfileDir(provider, activePlugin);
|
|
@@ -1813,7 +1813,7 @@ app.delete('/api/auth/:provider', (req, res) => {
|
|
|
1813
1813
|
}
|
|
1814
1814
|
|
|
1815
1815
|
if (provider === 'google' && activePlugin) {
|
|
1816
|
-
const key =
|
|
1816
|
+
const key = 'google.antigravity';
|
|
1817
1817
|
delete authCfg[key];
|
|
1818
1818
|
}
|
|
1819
1819
|
|
|
@@ -1918,12 +1918,6 @@ function syncAntigravityPool() {
|
|
|
1918
1918
|
const profileDir = path.join(AUTH_PROFILES_DIR, namespace);
|
|
1919
1919
|
|
|
1920
1920
|
if (!accounts.length) {
|
|
1921
|
-
if (fs.existsSync(profileDir)) fs.rmSync(profileDir, { recursive: true, force: true });
|
|
1922
|
-
const metadata = loadPoolMetadata();
|
|
1923
|
-
if (metadata[namespace]) {
|
|
1924
|
-
delete metadata[namespace];
|
|
1925
|
-
savePoolMetadata(metadata);
|
|
1926
|
-
}
|
|
1927
1921
|
return;
|
|
1928
1922
|
}
|
|
1929
1923
|
|
|
@@ -2036,7 +2030,7 @@ function getAccountStatus(meta, now) {
|
|
|
2036
2030
|
function buildAccountPool(provider) {
|
|
2037
2031
|
const activePlugin = getActiveGooglePlugin();
|
|
2038
2032
|
const namespace = provider === 'google'
|
|
2039
|
-
? (
|
|
2033
|
+
? ('google.antigravity')
|
|
2040
2034
|
: provider;
|
|
2041
2035
|
|
|
2042
2036
|
const profileDir = getProfileDir(provider, activePlugin);
|
|
@@ -2101,7 +2095,7 @@ function getPoolQuota(provider, pool) {
|
|
|
2101
2095
|
const metadata = loadPoolMetadata();
|
|
2102
2096
|
const activePlugin = getActiveGooglePlugin();
|
|
2103
2097
|
const namespace = provider === 'google'
|
|
2104
|
-
? (
|
|
2098
|
+
? ('google.antigravity')
|
|
2105
2099
|
: provider;
|
|
2106
2100
|
|
|
2107
2101
|
const quotaMeta = metadata._quota?.[namespace] || {};
|
|
@@ -2151,7 +2145,7 @@ function rotateAccount(provider, reason = 'manual_rotation') {
|
|
|
2151
2145
|
// Activate the new account
|
|
2152
2146
|
const activePlugin = getActiveGooglePlugin();
|
|
2153
2147
|
const namespace = provider === 'google'
|
|
2154
|
-
? (
|
|
2148
|
+
? ('google.antigravity')
|
|
2155
2149
|
: provider;
|
|
2156
2150
|
|
|
2157
2151
|
const profilePath = path.join(AUTH_PROFILES_DIR, namespace, `${next.name}.json`);
|
|
@@ -2239,7 +2233,7 @@ app.post('/api/auth/pool/limit', (req, res) => {
|
|
|
2239
2233
|
|
|
2240
2234
|
const activePlugin = getActiveGooglePlugin();
|
|
2241
2235
|
const namespace = provider === 'google'
|
|
2242
|
-
? (
|
|
2236
|
+
? ('google.antigravity')
|
|
2243
2237
|
: provider;
|
|
2244
2238
|
|
|
2245
2239
|
const metadata = loadPoolMetadata();
|
|
@@ -2269,7 +2263,7 @@ app.put('/api/auth/pool/:name/cooldown', (req, res) => {
|
|
|
2269
2263
|
|
|
2270
2264
|
const activePlugin = getActiveGooglePlugin();
|
|
2271
2265
|
const namespace = provider === 'google'
|
|
2272
|
-
? (
|
|
2266
|
+
? ('google.antigravity')
|
|
2273
2267
|
: provider;
|
|
2274
2268
|
|
|
2275
2269
|
const metadata = loadPoolMetadata();
|
|
@@ -2292,7 +2286,7 @@ app.delete('/api/auth/pool/:name/cooldown', (req, res) => {
|
|
|
2292
2286
|
|
|
2293
2287
|
const activePlugin = getActiveGooglePlugin();
|
|
2294
2288
|
const namespace = provider === 'google'
|
|
2295
|
-
? (
|
|
2289
|
+
? ('google.antigravity')
|
|
2296
2290
|
: provider;
|
|
2297
2291
|
|
|
2298
2292
|
const metadata = loadPoolMetadata();
|
|
@@ -2311,7 +2305,7 @@ app.post('/api/auth/pool/:name/usage', (req, res) => {
|
|
|
2311
2305
|
|
|
2312
2306
|
const activePlugin = getActiveGooglePlugin();
|
|
2313
2307
|
const namespace = provider === 'google'
|
|
2314
|
-
? (
|
|
2308
|
+
? ('google.antigravity')
|
|
2315
2309
|
: provider;
|
|
2316
2310
|
|
|
2317
2311
|
const metadata = loadPoolMetadata();
|
|
@@ -2338,7 +2332,7 @@ app.put('/api/auth/pool/:name/metadata', (req, res) => {
|
|
|
2338
2332
|
|
|
2339
2333
|
const activePlugin = getActiveGooglePlugin();
|
|
2340
2334
|
const namespace = provider === 'google'
|
|
2341
|
-
? (
|
|
2335
|
+
? ('google.antigravity')
|
|
2342
2336
|
: provider;
|
|
2343
2337
|
|
|
2344
2338
|
const metadata = loadPoolMetadata();
|
|
@@ -2357,7 +2351,7 @@ app.get('/api/auth/pool/quota', (req, res) => {
|
|
|
2357
2351
|
const provider = req.query.provider || 'google';
|
|
2358
2352
|
const activePlugin = getActiveGooglePlugin();
|
|
2359
2353
|
const namespace = provider === 'google'
|
|
2360
|
-
? (
|
|
2354
|
+
? ('google.antigravity')
|
|
2361
2355
|
: provider;
|
|
2362
2356
|
|
|
2363
2357
|
const metadata = loadPoolMetadata();
|
|
@@ -2381,7 +2375,7 @@ app.post('/api/auth/pool/quota/limit', (req, res) => {
|
|
|
2381
2375
|
const { provider = 'google', limit } = req.body;
|
|
2382
2376
|
const activePlugin = getActiveGooglePlugin();
|
|
2383
2377
|
const namespace = provider === 'google'
|
|
2384
|
-
? (
|
|
2378
|
+
? ('google.antigravity')
|
|
2385
2379
|
: provider;
|
|
2386
2380
|
|
|
2387
2381
|
const metadata = loadPoolMetadata();
|
|
@@ -2714,7 +2708,7 @@ app.post('/api/auth/google/start', async (req, res) => {
|
|
|
2714
2708
|
|
|
2715
2709
|
const studioConfig = loadStudioConfig();
|
|
2716
2710
|
const activePlugin = studioConfig.activeGooglePlugin || 'gemini';
|
|
2717
|
-
const namespace =
|
|
2711
|
+
const namespace = 'google.antigravity';
|
|
2718
2712
|
|
|
2719
2713
|
const credentials = {
|
|
2720
2714
|
refresh_token: tokens.refresh_token,
|