opencode-studio-server 1.9.0 → 1.9.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 (3) hide show
  1. package/cli.js +7 -1
  2. package/index.js +13 -5
  3. package/package.json +1 -1
package/cli.js CHANGED
@@ -127,4 +127,10 @@ if (shouldOpenBrowser) {
127
127
  }
128
128
 
129
129
  // Start the server
130
- require('./index.js');
130
+ const server = require('./index.js');
131
+ if (server.startServer) {
132
+ server.startServer();
133
+ } else {
134
+ // Fallback if not exported (should not happen with new version)
135
+ console.error('Failed to start server: startServer not found');
136
+ }
package/index.js CHANGED
@@ -1470,7 +1470,8 @@ app.post('/api/auth/profiles/:provider/:name/activate', (req, res) => {
1470
1470
  ? (activePlugin === 'antigravity' ? 'google.antigravity' : 'google.gemini')
1471
1471
  : provider;
1472
1472
 
1473
- const profilePath = path.join(AUTH_PROFILES_DIR, namespace, `${name}.json`);
1473
+ const dir = getProfileDir(provider, activePlugin);
1474
+ const profilePath = path.join(dir, `${name}.json`);
1474
1475
  if (!fs.existsSync(profilePath)) return res.status(404).json({ error: 'Profile not found' });
1475
1476
 
1476
1477
  const profileData = JSON.parse(fs.readFileSync(profilePath, 'utf8'));
@@ -1517,7 +1518,8 @@ app.delete('/api/auth/profiles/:provider/:name', (req, res) => {
1517
1518
  ? (activePlugin === 'antigravity' ? 'google.antigravity' : 'google.gemini')
1518
1519
  : provider;
1519
1520
 
1520
- const profilePath = path.join(AUTH_PROFILES_DIR, namespace, `${name}.json`);
1521
+ const dir = getProfileDir(provider, activePlugin);
1522
+ const profilePath = path.join(dir, `${name}.json`);
1521
1523
  if (fs.existsSync(profilePath)) fs.unlinkSync(profilePath);
1522
1524
 
1523
1525
  const studio = loadStudioConfig();
@@ -1554,8 +1556,9 @@ app.put('/api/auth/profiles/:provider/:name', (req, res) => {
1554
1556
  ? (activePlugin === 'antigravity' ? 'google.antigravity' : 'google.gemini')
1555
1557
  : provider;
1556
1558
 
1557
- const oldPath = path.join(AUTH_PROFILES_DIR, namespace, `${name}.json`);
1558
- const newPath = path.join(AUTH_PROFILES_DIR, namespace, `${newName}.json`);
1559
+ const dir = getProfileDir(provider, activePlugin);
1560
+ const oldPath = path.join(dir, `${name}.json`);
1561
+ const newPath = path.join(dir, `${newName}.json`);
1559
1562
  if (fs.existsSync(oldPath)) fs.renameSync(oldPath, newPath);
1560
1563
 
1561
1564
  const metadata = loadPoolMetadata();
@@ -2817,13 +2820,18 @@ app.post('/api/presets/:id/apply', (req, res) => {
2817
2820
  });
2818
2821
 
2819
2822
  // Start watcher on server start
2820
- if (require.main === module) {
2823
+ function startServer() {
2821
2824
  setupLogWatcher();
2822
2825
  importExistingAuth();
2823
2826
  app.listen(PORT, () => console.log(`Server running at http://localhost:${PORT}`));
2824
2827
  }
2825
2828
 
2829
+ if (require.main === module) {
2830
+ startServer();
2831
+ }
2832
+
2826
2833
  module.exports = {
2834
+ startServer,
2827
2835
  rotateAccount,
2828
2836
  processLogLine,
2829
2837
  loadPoolMetadata,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-studio-server",
3
- "version": "1.9.0",
3
+ "version": "1.9.2",
4
4
  "description": "Backend server for OpenCode Studio - manages opencode configurations",
5
5
  "main": "index.js",
6
6
  "bin": {