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.
- package/index.js +50 -45
- 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
|
-
|
|
1031
|
-
|
|
1032
|
-
studio
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
const
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
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
|