opencode-pollinations-plugin 5.6.0-beta.7 → 5.6.0-beta.8

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.
@@ -13,9 +13,10 @@ function checkEndpoint(ep, key) {
13
13
  let data = '';
14
14
  res.on('data', chunk => data += chunk);
15
15
  res.on('end', () => {
16
- console.log(`Body Sample: ${data.substring(0, 100)}...`);
17
- if (res.statusCode === 200) resolve({ ok: true });
18
- else resolve({ ok: false, status: res.statusCode });
16
+ console.log(`Headers:`, res.headers);
17
+ console.log(`Body Full: ${data}`);
18
+ if (res.statusCode === 200) resolve({ ok: true, body: data });
19
+ else resolve({ ok: false, status: res.statusCode, body: data });
19
20
  });
20
21
  });
21
22
  req.on('error', (e) => {
@@ -282,10 +282,34 @@ async function handleConnectCommand(args) {
282
282
  const masked = key.substring(0, 6) + '...';
283
283
  // Count Paid Only models found
284
284
  const diamondCount = enterpriseModels.filter(m => m.name.includes('💎')).length;
285
+ // CHECK RESTRICTIONS: Strict Check (Usage + Profile + Balance)
286
+ let forcedModeMsg = "";
287
+ let isLimited = false;
288
+ let limitReason = "";
289
+ try {
290
+ // Strict Probe: Must be able to read ALL accounting data
291
+ const check = await checkKeyPermissions(key);
292
+ if (!check.ok) {
293
+ isLimited = true;
294
+ limitReason = check.reason || "Unknown";
295
+ }
296
+ }
297
+ catch (e) {
298
+ isLimited = true;
299
+ limitReason = e.message;
300
+ }
301
+ // If Limited -> FORCE MANUAL
302
+ if (isLimited) {
303
+ saveConfig({ apiKey: key, mode: 'manual', keyHasAccessToProfile: false });
304
+ forcedModeMsg = `\n⚠️ **Clé Limitée** (Echec: ${limitReason}) -> Mode **MANUEL** forcé.\n*Requis pour mode Auto: Profile, Balance & Usage.*`;
305
+ }
306
+ else {
307
+ saveConfig({ apiKey: key, keyHasAccessToProfile: true }); // Let user keep current mode or default
308
+ }
285
309
  emitStatusToast('success', `Clé Valide! (${enterpriseModels.length} modèles Pro débloqués)`, 'Pollinations Config');
286
310
  return {
287
311
  handled: true,
288
- response: `✅ **Connexion Réussie!**\n- Clé: \`${masked}\`\n- Mode: **PRO** (Activé)\n- Modèles Débloqués: ${enterpriseModels.length} (dont ${diamondCount} 💎 Paid)`
312
+ response: `✅ **Connexion Réussie!**\n- Clé: \`${masked}\`\n- Modèles Débloqués: ${enterpriseModels.length} (dont ${diamondCount} 💎 Paid)${forcedModeMsg}`
289
313
  };
290
314
  }
291
315
  else {
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.7",
4
+ "version": "5.6.0-beta.8",
5
5
  "description": "Native Pollinations.ai Provider Plugin for OpenCode",
6
6
  "publisher": "pollinations",
7
7
  "repository": {