opencode-studio-server 1.18.0 → 1.19.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 +57 -45
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -1020,51 +1020,63 @@ 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
+ // 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 and apply thinking/reasoning
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
+ const agentConfig = { model: available.model };
1047
+
1048
+ // Add thinking config if enabled (for Gemini models)
1049
+ if (agentPrefs.thinking && agentPrefs.thinking.type === 'enabled') {
1050
+ agentConfig.thinking = { type: 'enabled' };
1051
+ }
1052
+
1053
+ // Add reasoning config if set (for OpenAI o-series models)
1054
+ if (agentPrefs.reasoning && agentPrefs.reasoning.effort) {
1055
+ agentConfig.reasoning = { effort: agentPrefs.reasoning.effort };
1056
+ }
1057
+
1058
+ currentConfig.agents[agentName] = agentConfig;
1059
+ } else if (choices.length > 0) {
1060
+ // No available model, keep existing or warn
1061
+ warnings.push(`No available model for agent "${agentName}"`);
1062
+ }
1063
+ }
1064
+
1065
+ saveOhMyOpenCodeConfig(currentConfig);
1066
+
1067
+ const ohMyPath = getOhMyOpenCodeConfigPath();
1068
+ res.json({
1069
+ success: true,
1070
+ path: ohMyPath,
1071
+ exists: true,
1072
+ config: currentConfig,
1073
+ preferences,
1074
+ warnings: warnings.length > 0 ? warnings : undefined
1075
+ });
1076
+ } catch (err) {
1077
+ res.status(500).json({ error: err.message });
1078
+ }
1079
+ });
1068
1080
 
1069
1081
  // ============================================
1070
1082
  // 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.19.0",
4
4
  "description": "Backend server for OpenCode Studio - manages opencode configurations",
5
5
  "main": "index.js",
6
6
  "bin": {