opencode-studio-server 1.9.6 → 1.10.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 +44 -2
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -290,6 +290,10 @@ function loadStudioConfig() {
290
290
  activeGooglePlugin: 'gemini',
291
291
  availableGooglePlugins: [],
292
292
  presets: [],
293
+ cooldownRules: [
294
+ { name: "Opus 4.5 (Antigravity)", duration: 4 * 60 * 60 * 1000 }, // 4 hours
295
+ { name: "Gemini 3 Pro (Antigravity)", duration: 24 * 60 * 60 * 1000 } // 24 hours
296
+ ],
293
297
  pluginModels: {
294
298
  gemini: {
295
299
  "gemini-3-pro-preview": {
@@ -646,6 +650,36 @@ app.post('/api/restore', (req, res) => {
646
650
  }
647
651
  });
648
652
 
653
+ app.get('/api/cooldowns', (req, res) => {
654
+ const studio = loadStudioConfig();
655
+ res.json(studio.cooldownRules || []);
656
+ });
657
+
658
+ app.post('/api/cooldowns', (req, res) => {
659
+ const { name, duration } = req.body;
660
+ if (!name || typeof duration !== 'number') return res.status(400).json({ error: 'Invalid name or duration' });
661
+ const studio = loadStudioConfig();
662
+ if (!studio.cooldownRules) studio.cooldownRules = [];
663
+
664
+ // Update if exists, else push
665
+ const idx = studio.cooldownRules.findIndex(r => r.name === name);
666
+ if (idx >= 0) studio.cooldownRules[idx] = { name, duration };
667
+ else studio.cooldownRules.push({ name, duration });
668
+
669
+ saveStudioConfig(studio);
670
+ res.json(studio.cooldownRules);
671
+ });
672
+
673
+ app.delete('/api/cooldowns/:name', (req, res) => {
674
+ const { name } = req.params;
675
+ const studio = loadStudioConfig();
676
+ if (studio.cooldownRules) {
677
+ studio.cooldownRules = studio.cooldownRules.filter(r => r.name !== name);
678
+ saveStudioConfig(studio);
679
+ }
680
+ res.json(studio.cooldownRules || []);
681
+ });
682
+
649
683
  const DROPBOX_CLIENT_ID = 'your-dropbox-app-key';
650
684
  const GDRIVE_CLIENT_ID = 'your-google-client-id';
651
685
 
@@ -2223,7 +2257,15 @@ app.post('/api/auth/pool/limit', (req, res) => {
2223
2257
  // PUT /api/auth/pool/:name/cooldown - Mark account as in cooldown
2224
2258
  app.put('/api/auth/pool/:name/cooldown', (req, res) => {
2225
2259
  const { name } = req.params;
2226
- const { duration = 3600000, provider = 'google' } = req.body; // default 1 hour
2260
+ let { duration, provider = 'google', rule } = req.body;
2261
+
2262
+ if (rule) {
2263
+ const studio = loadStudioConfig();
2264
+ const r = (studio.cooldownRules || []).find(cr => cr.name === rule);
2265
+ if (r) duration = r.duration;
2266
+ }
2267
+
2268
+ if (!duration) duration = 3600000; // default 1 hour
2227
2269
 
2228
2270
  const activePlugin = getActiveGooglePlugin();
2229
2271
  const namespace = provider === 'google'
@@ -2950,7 +2992,7 @@ app.post('/api/presets/:id/apply', (req, res) => {
2950
2992
 
2951
2993
  // Start watcher on server start
2952
2994
  function startServer() {
2953
- setupLogWatcher();
2995
+ // setupLogWatcher(); // Disabled as per user request (manual switching only)
2954
2996
  importExistingAuth();
2955
2997
  app.listen(PORT, () => console.log(`Server running at http://localhost:${PORT}`));
2956
2998
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-studio-server",
3
- "version": "1.9.6",
3
+ "version": "1.10.0",
4
4
  "description": "Backend server for OpenCode Studio - manages opencode configurations",
5
5
  "main": "index.js",
6
6
  "bin": {