opencode-pollinations-plugin 5.6.0-beta.23 → 5.6.0-beta.25

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.
@@ -174,11 +174,15 @@ async function handleModeCommand(args) {
174
174
  };
175
175
  }
176
176
  const checkConfig = loadConfig();
177
- // JIT VERIFICATION for PRO Mode
178
- if (mode === 'pro') {
177
+ // JIT VERIFICATION for PRO and ALWAYSFREE Mode
178
+ if (mode === 'pro' || mode === 'alwaysfree') {
179
+ const checkConfig = loadConfig(); // Reload to be sure
179
180
  const key = checkConfig.apiKey;
180
181
  if (!key) {
181
- return { handled: true, error: "❌ Mode Pro nécessite une Clé API configurée." };
182
+ // If NO key, allow alwaysfree? Yes.
183
+ // If HAS key, verify it? Yes.
184
+ if (mode === 'pro')
185
+ return { handled: true, error: "❌ Mode Pro nécessite une Clé API configurée." };
182
186
  }
183
187
  emitStatusToast('info', 'Vérification des droits...', 'Mode Pro');
184
188
  try {
@@ -259,17 +259,17 @@ export async function handleChatCompletion(req, res, bodyRaw) {
259
259
  }
260
260
  // B. SAFETY NETS (The Core V5 Logic)
261
261
  // 0. GLOBAL CHECK: Auth Limited (403 on Quota)
262
- // If we can't read quota because of 403, we MUST STOP and force manual.
262
+ // If we can't read quota because of 403, we downgrade to Manual but ALLOW the request.
263
263
  if (isEnterprise && quota.errorType === 'auth_limited') {
264
- log(`[SafetyNet] CRITICAL: Limited Key Detected (403). Enforcing Manual Mode.`);
265
- saveConfig({ mode: 'manual', keyHasAccessToProfile: false });
266
- res.writeHead(403, { 'Content-Type': 'application/json' });
267
- res.end(JSON.stringify({
268
- error: "Clé Limitée - Accès Profil Refusé",
269
- message: "Votre clé ne permet pas le suivi des quotas via /account/profile.\nLe mode automatique est désactivé.\nVeuillez passer en mode Manual ou utiliser une clé complète.",
270
- code: "AUTH_LIMITED"
271
- }));
272
- return;
264
+ // Only warn/switch if we were trying to be smart (Auto Mode)
265
+ if (config.mode !== 'manual') {
266
+ log(`[SafetyNet] Limited Key Detected (403). Downgrading to Manual Mode.`);
267
+ saveConfig({ mode: 'manual', keyHasAccessToProfile: false });
268
+ config.mode = 'manual'; // Local override to skip safety nets below
269
+ emitStatusToast('warning', 'Clé Limitée: Passage en Mode Manuel', 'Permissions (403)');
270
+ }
271
+ // WE DO NOT RETURN 403. WE ALLOW THE REQUEST.
272
+ // Since config.mode is now 'manual', the next checks (alwaysfree/pro) will be skipped.
273
273
  }
274
274
  if (config.mode === 'alwaysfree') {
275
275
  if (isEnterprise) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "opencode-pollinations-plugin",
3
3
  "displayName": "Pollinations AI (V5.1)",
4
- "version": "5.6.0-beta.23",
4
+ "version": "5.6.0-beta.25",
5
5
  "description": "Native Pollinations.ai Provider Plugin for OpenCode",
6
6
  "publisher": "pollinations",
7
7
  "repository": {