opencode-pollinations-plugin 5.6.0-beta.13 → 5.6.0-beta.16

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.
@@ -139,11 +139,11 @@ export async function handleCommand(command) {
139
139
  const args = parts.slice(2);
140
140
  switch (subCommand) {
141
141
  case 'mode':
142
- return handleModeCommand(args);
142
+ return await handleModeCommand(args);
143
143
  case 'usage':
144
144
  return await handleUsageCommand(args);
145
145
  case 'connect':
146
- return handleConnectCommand(args);
146
+ return await handleConnectCommand(args);
147
147
  case 'fallback':
148
148
  return handleFallbackCommand(args);
149
149
  case 'config':
@@ -158,7 +158,7 @@ export async function handleCommand(command) {
158
158
  }
159
159
  }
160
160
  // === SUB-COMMANDS ===
161
- function handleModeCommand(args) {
161
+ async function handleModeCommand(args) {
162
162
  const mode = args[0];
163
163
  if (!mode) {
164
164
  const config = loadConfig();
@@ -173,6 +173,32 @@ function handleModeCommand(args) {
173
173
  error: `Mode invalide: ${mode}. Valeurs: manual, alwaysfree, pro`
174
174
  };
175
175
  }
176
+ const checkConfig = loadConfig();
177
+ // JIT VERIFICATION for PRO Mode
178
+ if (mode === 'pro') {
179
+ const key = checkConfig.apiKey;
180
+ if (!key) {
181
+ return { handled: true, error: "❌ Mode Pro nécessite une Clé API configurée." };
182
+ }
183
+ emitStatusToast('info', 'Vérification des droits...', 'Mode Pro');
184
+ try {
185
+ // Force verify permissions NOW
186
+ const check = await checkKeyPermissions(key);
187
+ if (!check.ok) {
188
+ saveConfig({ mode: 'manual', keyHasAccessToProfile: false });
189
+ return {
190
+ handled: true,
191
+ error: `❌ **Mode Refusé**\nVotre clé est limitée (Code ${check.status}: ${check.reason}).\nPassage en mode **manual**.`
192
+ };
193
+ }
194
+ // Valid -> Ensure flag is true
195
+ saveConfig({ keyHasAccessToProfile: true });
196
+ }
197
+ catch (e) {
198
+ return { handled: true, error: `❌ Erreur de vérification: ${e.message}` };
199
+ }
200
+ }
201
+ // Allow switch (if alwaysfree or manual, or verified pro)
176
202
  saveConfig({ mode: mode });
177
203
  const config = loadConfig();
178
204
  if (config.gui.status !== 'none') {
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.13",
4
+ "version": "5.6.0-beta.16",
5
5
  "description": "Native Pollinations.ai Provider Plugin for OpenCode",
6
6
  "publisher": "pollinations",
7
7
  "repository": {