opencode-pollinations-plugin 6.0.0-beta.23 → 6.0.0-beta.24

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/dist/index.js +26 -12
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -189,22 +189,36 @@ export const PollinationsPlugin = async (ctx) => {
189
189
  modelsObj[m.id] = m;
190
190
  }
191
191
  const version = require('../package.json').version;
192
- // Use Server API to PATCH the config at runtime
192
+ // CRITICAL: Fetch current config first to avoid overwriting other providers
193
+ let currentConfig = {};
194
+ try {
195
+ // Try to fetch existing config to preserve other providers
196
+ const response = await ctx.client.fetch('/config');
197
+ if (response.ok) {
198
+ currentConfig = await response.json();
199
+ }
200
+ }
201
+ catch (err) {
202
+ log(`[Event] Warning: Could not fetch current config: ${err}`);
203
+ }
204
+ // Safe Merge
205
+ if (!currentConfig.provider)
206
+ currentConfig.provider = {};
207
+ currentConfig.provider.pollinations = {
208
+ id: 'openai',
209
+ name: `Pollinations AI (v${version})`,
210
+ options: {
211
+ baseURL: localBaseUrl,
212
+ apiKey: 'plugin-managed',
213
+ },
214
+ models: modelsObj
215
+ };
216
+ // Use Server API to update config with the MERGED object
193
217
  await ctx.client.fetch('/config', {
194
218
  method: 'PATCH',
195
219
  headers: { 'Content-Type': 'application/json' },
196
220
  body: JSON.stringify({
197
- provider: {
198
- pollinations: {
199
- id: 'openai',
200
- name: `Pollinations AI (v${version})`,
201
- options: {
202
- baseURL: localBaseUrl,
203
- apiKey: 'plugin-managed',
204
- },
205
- models: modelsObj
206
- }
207
- }
221
+ provider: currentConfig.provider
208
222
  })
209
223
  });
210
224
  log(`[Event] Provider config refreshed with ${Object.keys(modelsObj).length} models.`);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "opencode-pollinations-plugin",
3
3
  "displayName": "Pollinations AI (V5.6)",
4
- "version": "6.0.0-beta.23",
4
+ "version": "6.0.0-beta.24",
5
5
  "description": "Native Pollinations.ai Provider Plugin for OpenCode",
6
6
  "publisher": "pollinations",
7
7
  "repository": {