opencode-studio-server 1.16.1 → 1.16.2

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 +30 -4
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -184,9 +184,13 @@ function processLogLine(line) {
184
184
  const modelMatch = line.match(/modelID=([^\s]+)/);
185
185
 
186
186
  if (providerMatch) {
187
- const provider = providerMatch[1];
187
+ let provider = providerMatch[1];
188
188
  const model = modelMatch ? modelMatch[1] : 'unknown';
189
189
 
190
+ // Normalize providers
191
+ if (provider === 'codex') provider = 'openai';
192
+ if (provider === 'claude') provider = 'anthropic';
193
+
190
194
  // Map provider to pool namespace
191
195
  let namespace = provider;
192
196
  if (provider === 'google') {
@@ -1668,9 +1672,23 @@ app.delete('/api/auth/profiles/:provider/:name', (req, res) => {
1668
1672
  delete authCfg['google.gemini'];
1669
1673
  changed = true;
1670
1674
  }
1671
- } else if (wasActive && authCfg[provider]) {
1672
- delete authCfg[provider];
1673
- changed = true;
1675
+ } else if (authCfg[provider]) {
1676
+ // Check if the auth config matches the profile being deleted
1677
+ const creds = authCfg[provider];
1678
+ let matches = false;
1679
+
1680
+ // Try to match by email if available (OpenAI/Anthropic don't store email in auth.json usually, but we can check decoded token)
1681
+ if (creds.email === name) matches = true;
1682
+ else if (creds.accountId === name) matches = true;
1683
+ else if (provider === 'openai' && creds.access) {
1684
+ const decoded = decodeJWT(creds.access);
1685
+ if (decoded && decoded['https://api.openai.com/profile']?.email === name) matches = true;
1686
+ }
1687
+
1688
+ if (matches) {
1689
+ delete authCfg[provider];
1690
+ changed = true;
1691
+ }
1674
1692
  }
1675
1693
 
1676
1694
  if (changed) {
@@ -2004,6 +2022,14 @@ function importCurrentGoogleAuthToPool() {
2004
2022
  };
2005
2023
  }
2006
2024
  savePoolMetadata(metadata);
2025
+
2026
+ // Also update active profile to match what we just imported
2027
+ const studio = loadStudioConfig();
2028
+ if (!studio.activeProfiles) studio.activeProfiles = {};
2029
+ if (studio.activeProfiles.google !== email) {
2030
+ studio.activeProfiles.google = email;
2031
+ saveStudioConfig(studio);
2032
+ }
2007
2033
  }
2008
2034
  }
2009
2035
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-studio-server",
3
- "version": "1.16.1",
3
+ "version": "1.16.2",
4
4
  "description": "Backend server for OpenCode Studio - manages opencode configurations",
5
5
  "main": "index.js",
6
6
  "bin": {