opencode-studio-server 1.14.8 → 1.16.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 (2) hide show
  1. package/index.js +38 -15
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -293,8 +293,8 @@ function loadStudioConfig() {
293
293
  availableGooglePlugins: [],
294
294
  presets: [],
295
295
  cooldownRules: [
296
- { name: "Antigravity Claude Opus (4h)", duration: 4 * 60 * 60 * 1000 },
297
- { name: "Antigravity Gemini 3 Pro (24h)", duration: 24 * 60 * 60 * 1000 }
296
+ { name: "Antigravity Claude Opus 4 (4h)", duration: 4 * 60 * 60 * 1000 },
297
+ { name: "Gemini 3 Pro (24h)", duration: 24 * 60 * 60 * 1000 }
298
298
  ],
299
299
  pluginModels: {
300
300
  gemini: {
@@ -2008,11 +2008,41 @@ function importCurrentGoogleAuthToPool() {
2008
2008
  }
2009
2009
 
2010
2010
  function syncAntigravityPool() {
2011
- const accounts = listAntigravityAccounts();
2012
2011
  const namespace = 'google.antigravity';
2013
2012
  const profileDir = path.join(AUTH_PROFILES_DIR, namespace);
2014
2013
 
2015
- if (!accounts.length) {
2014
+ // Collect accounts from multiple sources
2015
+ const allAccounts = [];
2016
+
2017
+ // Source 1: antigravity-accounts.json (antigravity plugin format)
2018
+ const antigravityAccounts = listAntigravityAccounts();
2019
+ antigravityAccounts.forEach(acc => {
2020
+ if (acc.email) allAccounts.push({ email: acc.email, source: 'antigravity' });
2021
+ });
2022
+
2023
+ // Source 2: CLIProxyAPI auth directory (~/.cli-proxy-api/)
2024
+ const CLIPROXY_AUTH_DIR = path.join(HOME_DIR, '.cli-proxy-api');
2025
+ if (fs.existsSync(CLIPROXY_AUTH_DIR)) {
2026
+ try {
2027
+ const files = fs.readdirSync(CLIPROXY_AUTH_DIR).filter(f => f.endsWith('.json') && f.startsWith('antigravity-'));
2028
+ files.forEach(f => {
2029
+ // Format: antigravity-email_at_gmail_com.json
2030
+ const parts = f.replace('.json', '').split('-');
2031
+ if (parts.length > 1) {
2032
+ const emailPart = parts.slice(1).join('-');
2033
+ // Convert underscore notation back to email
2034
+ const email = emailPart.replace(/_/g, '.').replace('.gmail.com', '@gmail.com').replace('.googlemail.com', '@googlemail.com');
2035
+ if (email && !allAccounts.find(a => a.email === email)) {
2036
+ allAccounts.push({ email, source: 'cliproxy', file: f });
2037
+ }
2038
+ }
2039
+ });
2040
+ } catch (e) {
2041
+ console.error('[Pool] Error reading CLIProxy auth dir:', e.message);
2042
+ }
2043
+ }
2044
+
2045
+ if (!allAccounts.length) {
2016
2046
  return;
2017
2047
  }
2018
2048
 
@@ -2022,12 +2052,12 @@ function syncAntigravityPool() {
2022
2052
  if (!metadata[namespace]) metadata[namespace] = {};
2023
2053
 
2024
2054
  const seen = new Set();
2025
- accounts.forEach((account, idx) => {
2055
+ allAccounts.forEach((account, idx) => {
2026
2056
  const name = account.email || `account-${idx + 1}`;
2027
2057
  seen.add(name);
2028
2058
  const profilePath = path.join(profileDir, `${name}.json`);
2029
2059
  if (!fs.existsSync(profilePath)) {
2030
- atomicWriteFileSync(profilePath, JSON.stringify({ email: account.email }, null, 2));
2060
+ atomicWriteFileSync(profilePath, JSON.stringify({ email: account.email, source: account.source }, null, 2));
2031
2061
  }
2032
2062
  if (!metadata[namespace][name]) {
2033
2063
  metadata[namespace][name] = {
@@ -2039,15 +2069,8 @@ function syncAntigravityPool() {
2039
2069
  }
2040
2070
  });
2041
2071
 
2042
- const profileFiles = fs.existsSync(profileDir) ? fs.readdirSync(profileDir).filter(f => f.endsWith('.json')) : [];
2043
- profileFiles.forEach(file => {
2044
- const name = file.replace('.json', '');
2045
- if (!seen.has(name)) {
2046
- fs.unlinkSync(path.join(profileDir, file));
2047
- if (metadata[namespace]?.[name]) delete metadata[namespace][name];
2048
- }
2049
- });
2050
-
2072
+ // Don't delete profiles that aren't in current sources - they might have been manually added
2073
+ // Only update metadata for accounts we found
2051
2074
  savePoolMetadata(metadata);
2052
2075
  }
2053
2076
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-studio-server",
3
- "version": "1.14.8",
3
+ "version": "1.16.0",
4
4
  "description": "Backend server for OpenCode Studio - manages opencode configurations",
5
5
  "main": "index.js",
6
6
  "bin": {