opencode-studio-server 1.12.6 → 1.12.8

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 +25 -2
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -2069,10 +2069,14 @@ function buildAccountPool(provider) {
2069
2069
  const name = file.replace('.json', '');
2070
2070
  const meta = providerMeta[name] || {};
2071
2071
  let profileEmail = null;
2072
+ let projectId = null;
2073
+ let tier = null;
2072
2074
  try {
2073
2075
  const raw = fs.readFileSync(path.join(profileDir, file), 'utf8');
2074
2076
  const parsed = JSON.parse(raw);
2075
2077
  profileEmail = parsed?.email || null;
2078
+ projectId = parsed?.projectId || null;
2079
+ tier = parsed?.tier || null;
2076
2080
  } catch {}
2077
2081
  let status = getAccountStatus(meta, now);
2078
2082
  if (name === activeProfile && status === 'ready') status = 'active';
@@ -2084,7 +2088,9 @@ function buildAccountPool(provider) {
2084
2088
  lastUsed: meta.lastUsed || 0,
2085
2089
  usageCount: meta.usageCount || 0,
2086
2090
  cooldownUntil: meta.cooldownUntil || null,
2087
- createdAt: meta.createdAt || 0
2091
+ createdAt: meta.createdAt || 0,
2092
+ projectId,
2093
+ tier
2088
2094
  });
2089
2095
  });
2090
2096
  }
@@ -2347,7 +2353,7 @@ app.post('/api/auth/pool/:name/usage', (req, res) => {
2347
2353
  // PUT /api/auth/pool/:name/metadata - Update account metadata (email, etc.)
2348
2354
  app.put('/api/auth/pool/:name/metadata', (req, res) => {
2349
2355
  const { name } = req.params;
2350
- const { provider = 'google', email, createdAt } = req.body;
2356
+ const { provider = 'google', email, createdAt, projectId, tier } = req.body;
2351
2357
 
2352
2358
  const activePlugin = getActiveGooglePlugin();
2353
2359
  const namespace = provider === 'google'
@@ -2362,6 +2368,23 @@ app.put('/api/auth/pool/:name/metadata', (req, res) => {
2362
2368
  if (createdAt !== undefined) metadata[namespace][name].createdAt = createdAt;
2363
2369
 
2364
2370
  savePoolMetadata(metadata);
2371
+
2372
+ // Update physical profile file if needed
2373
+ if (projectId !== undefined || tier !== undefined) {
2374
+ const profileDir = getProfileDir(provider, activePlugin);
2375
+ const profilePath = path.join(profileDir, `${name}.json`);
2376
+ if (fs.existsSync(profilePath)) {
2377
+ try {
2378
+ const content = JSON.parse(fs.readFileSync(profilePath, 'utf8'));
2379
+ if (projectId !== undefined) content.projectId = projectId;
2380
+ if (tier !== undefined) content.tier = tier;
2381
+ atomicWriteFileSync(profilePath, JSON.stringify(content, null, 2));
2382
+ } catch (e) {
2383
+ console.error('[Auth] Failed to update profile file:', e);
2384
+ }
2385
+ }
2386
+ }
2387
+
2365
2388
  res.json({ success: true });
2366
2389
  });
2367
2390
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-studio-server",
3
- "version": "1.12.6",
3
+ "version": "1.12.8",
4
4
  "description": "Backend server for OpenCode Studio - manages opencode configurations",
5
5
  "main": "index.js",
6
6
  "bin": {