opencode-studio-server 1.12.8 → 1.12.10

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 +21 -11
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -1643,21 +1643,29 @@ app.delete('/api/auth/profiles/:provider/:name', (req, res) => {
1643
1643
  }
1644
1644
 
1645
1645
  const studio = loadStudioConfig();
1646
- if (studio.activeProfiles && studio.activeProfiles[provider] === name) {
1646
+ const wasActive = studio.activeProfiles && studio.activeProfiles[provider] === name;
1647
+
1648
+ if (wasActive) {
1647
1649
  delete studio.activeProfiles[provider];
1648
1650
  saveStudioConfig(studio);
1649
1651
  }
1650
1652
 
1651
1653
  const authCfg = loadAuthConfig() || {};
1652
- if (provider === 'google' && authCfg.google?.email === name) {
1653
- delete authCfg.google;
1654
- delete authCfg['google.antigravity'];
1655
- delete authCfg['google.gemini'];
1656
- const cp = getConfigPath();
1657
- const ap = path.join(path.dirname(cp), 'auth.json');
1658
- atomicWriteFileSync(ap, JSON.stringify(authCfg, null, 2));
1659
- } else if (authCfg[provider]) {
1654
+ let changed = false;
1655
+
1656
+ if (provider === 'google') {
1657
+ if (authCfg.google?.email === name || authCfg['google.antigravity']?.email === name || authCfg['google.gemini']?.email === name) {
1658
+ delete authCfg.google;
1659
+ delete authCfg['google.antigravity'];
1660
+ delete authCfg['google.gemini'];
1661
+ changed = true;
1662
+ }
1663
+ } else if (wasActive && authCfg[provider]) {
1660
1664
  delete authCfg[provider];
1665
+ changed = true;
1666
+ }
1667
+
1668
+ if (changed) {
1661
1669
  const cp = getConfigPath();
1662
1670
  const ap = path.join(path.dirname(cp), 'auth.json');
1663
1671
  atomicWriteFileSync(ap, JSON.stringify(authCfg, null, 2));
@@ -1896,12 +1904,14 @@ function importCurrentGoogleAuthToPool() {
1896
1904
  const email = creds.email;
1897
1905
  const profilePath = path.join(profileDir, `${email}.json`);
1898
1906
 
1899
- // Check if we need to sync (new account or updated tokens)
1907
+ // Check if we need to sync (new account or updated tokens/metadata)
1900
1908
  let shouldSync = true;
1901
1909
  if (fs.existsSync(profilePath)) {
1902
1910
  try {
1903
1911
  const current = JSON.parse(fs.readFileSync(profilePath, 'utf8'));
1904
- if (current.access_token === creds.access_token) {
1912
+ if (current.access_token === creds.access_token &&
1913
+ current.projectId === creds.projectId &&
1914
+ current.tier === creds.tier) {
1905
1915
  shouldSync = false;
1906
1916
  }
1907
1917
  } catch {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-studio-server",
3
- "version": "1.12.8",
3
+ "version": "1.12.10",
4
4
  "description": "Backend server for OpenCode Studio - manages opencode configurations",
5
5
  "main": "index.js",
6
6
  "bin": {