opencode-studio-server 1.18.0 → 1.20.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 +50 -45
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -1020,51 +1020,56 @@ app.get('/api/ohmyopencode', (req, res) => {
1020
1020
  res.json({ path: ohMyPath, exists, config, preferences });
1021
1021
  });
1022
1022
 
1023
- app.post('/api/ohmyopencode', (req, res) => {
1024
- try {
1025
- const { preferences } = req.body;
1026
- if (!preferences || !preferences.agents) {
1027
- return res.status(400).json({ error: 'Missing preferences.agents' });
1028
- }
1029
-
1030
- // Save preferences to studio.json
1031
- const studio = loadStudioConfig();
1032
- studio.ohmy = preferences;
1033
- saveStudioConfig(studio);
1034
-
1035
- // Load current oh-my-opencode.json or start fresh
1036
- const currentConfig = loadOhMyOpenCodeConfig() || {};
1037
- const warnings = [];
1038
-
1039
- // For each agent, pick first available model
1040
- for (const [agentName, agentPrefs] of Object.entries(preferences.agents)) {
1041
- const choices = agentPrefs.choices || [];
1042
- const available = choices.find(c => c.available);
1043
- if (available) {
1044
- // Set the model in oh-my-opencode.json
1045
- if (!currentConfig.agents) currentConfig.agents = {};
1046
- currentConfig.agents[agentName] = { model: available.model };
1047
- } else if (choices.length > 0) {
1048
- // No available model, keep existing or warn
1049
- warnings.push(`No available model for agent "${agentName}"`);
1050
- }
1051
- }
1052
-
1053
- saveOhMyOpenCodeConfig(currentConfig);
1054
-
1055
- const ohMyPath = getOhMyOpenCodeConfigPath();
1056
- res.json({
1057
- success: true,
1058
- path: ohMyPath,
1059
- exists: true,
1060
- config: currentConfig,
1061
- preferences,
1062
- warnings: warnings.length > 0 ? warnings : undefined
1063
- });
1064
- } catch (err) {
1065
- res.status(500).json({ error: err.message });
1066
- }
1067
- });
1023
+ app.post('/api/ohmyopencode', (req, res) => {
1024
+ try {
1025
+ const { preferences } = req.body;
1026
+ if (!preferences || !preferences.agents) {
1027
+ return res.status(400).json({ error: 'Missing preferences.agents' });
1028
+ }
1029
+
1030
+ const studio = loadStudioConfig();
1031
+ studio.ohmy = preferences;
1032
+ saveStudioConfig(studio);
1033
+
1034
+ const currentConfig = loadOhMyOpenCodeConfig() || {};
1035
+ const warnings = [];
1036
+
1037
+ for (const [agentName, agentPrefs] of Object.entries(preferences.agents)) {
1038
+ const choices = agentPrefs.choices || [];
1039
+ const available = choices.find(c => c.available);
1040
+ if (available) {
1041
+ if (!currentConfig.agents) currentConfig.agents = {};
1042
+ const agentConfig = { model: available.model };
1043
+
1044
+ if (available.thinking && available.thinking.type === 'enabled') {
1045
+ agentConfig.thinking = { type: 'enabled' };
1046
+ }
1047
+
1048
+ if (available.reasoning && available.reasoning.effort) {
1049
+ agentConfig.reasoning = { effort: available.reasoning.effort };
1050
+ }
1051
+
1052
+ currentConfig.agents[agentName] = agentConfig;
1053
+ } else if (choices.length > 0) {
1054
+ warnings.push(`No available model for agent "${agentName}"`);
1055
+ }
1056
+ }
1057
+
1058
+ saveOhMyOpenCodeConfig(currentConfig);
1059
+
1060
+ const ohMyPath = getOhMyOpenCodeConfigPath();
1061
+ res.json({
1062
+ success: true,
1063
+ path: ohMyPath,
1064
+ exists: true,
1065
+ config: currentConfig,
1066
+ preferences,
1067
+ warnings: warnings.length > 0 ? warnings : undefined
1068
+ });
1069
+ } catch (err) {
1070
+ res.status(500).json({ error: err.message });
1071
+ }
1072
+ });
1068
1073
 
1069
1074
  // ============================================
1070
1075
  // GITHUB BACKUP
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-studio-server",
3
- "version": "1.18.0",
3
+ "version": "1.20.0",
4
4
  "description": "Backend server for OpenCode Studio - manages opencode configurations",
5
5
  "main": "index.js",
6
6
  "bin": {