opencode-pollinations-plugin 5.3.4 → 5.3.6

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/README.md CHANGED
@@ -69,7 +69,14 @@ You spend it to verify API calls on premium models.
69
69
 
70
70
  > 🎁 **Beta Bonus**: Buy one Pollen pack, get one free!
71
71
 
72
- ## 📦 Installation & Ecology
72
+ ### 🐧 Platform Support & Port Management
73
+
74
+ This plugin is **Cross-Platform** (Windows, macOS, Linux).
75
+
76
+ > **Note**: The **Automatic Port Zombie Killer** (which clears port 10001 on startup) is currently **Linux-optimized** (using `fuser -k`).
77
+ > On **Windows/macOS**, if you encounter "Address in use", you may need to manually kill the process occupying port 10001 or reload the window.
78
+
79
+ ## 📦 Installation & Ecology Only
73
80
 
74
81
  This plugin is part of the **OpenCode Ecosystem**.
75
82
 
@@ -349,32 +349,41 @@ export async function handleChatCompletion(req, res, bodyRaw) {
349
349
  }
350
350
  // B2. GEMINI FREE / FAST (CRASH FIX: STRICT SANITIZATION)
351
351
  // Restore Tools but REMOVE conflicting ones (Search)
352
- else if ((actualModel.includes("gemini") && !isEnterprise) ||
353
- (actualModel.includes("gemini") && actualModel.includes("fast"))) {
354
- const hasFunctions = proxyBody.tools.some((t) => t.type === 'function' || t.function);
352
+ // B. GEMINI UNIFIED FIX (Free, Fast, Pro, Enterprise, Legacy)
353
+ // Handles: "tools" vs "grounding" conflicts, and "infinite loops" via Stop Sequences.
354
+ // B. GEMINI UNIFIED FIX (Free, Fast, Pro, Enterprise, Legacy)
355
+ // Fixes "Multiple tools" error (Vertex) and "JSON body validation failed" (v5.3.5 regression)
356
+ else if (actualModel.includes("gemini")) {
357
+ let hasFunctions = false;
358
+ if (proxyBody.tools && Array.isArray(proxyBody.tools)) {
359
+ hasFunctions = proxyBody.tools.some((t) => t.type === 'function' || t.function);
360
+ }
355
361
  if (hasFunctions) {
356
- // 1. Disable Magic Grounding (Source of loops/crashes)
357
- proxyBody.tools_config = { google_search_retrieval: { disable: true } };
358
- // 2. Remove 'google_search' explicitly (Replica of V3.5.5 logic)
362
+ // 1. Strict cleanup of 'google_search' tool
359
363
  proxyBody.tools = proxyBody.tools.filter((t) => {
360
364
  const isFunc = t.type === 'function' || t.function;
361
365
  const name = t.function?.name || t.name;
362
366
  return isFunc && name !== 'google_search';
363
367
  });
364
- // 3. Ensure tools are Vertex-Compatible
365
- proxyBody.tools = sanitizeToolsForVertex(proxyBody.tools);
366
- log(`[Proxy] Gemini Free: Tools RESTORED but Sanitized (No Search/Grounding).`);
368
+ // 2. If tools remain, sanitize them and DISABLE grounding
369
+ if (proxyBody.tools.length > 0) {
370
+ proxyBody.tools_config = { google_search_retrieval: { disable: true } };
371
+ proxyBody.tools = sanitizeToolsForVertex(proxyBody.tools);
372
+ }
373
+ else {
374
+ // 3. If no tools left (or only search was present), DELETE 'tools' entirely
375
+ // Sending tools: [] or tools_config without tools causes 400 Bad Request
376
+ delete proxyBody.tools;
377
+ if (proxyBody.tools_config)
378
+ delete proxyBody.tools_config;
379
+ }
367
380
  }
368
- }
369
- // B3. GEMINI ENTERPRISE 3.0+
370
- else if (actualModel.includes("gemini")) {
371
- const hasFunctions = proxyBody.tools.some((t) => t.type === 'function' || t.function);
372
- if (hasFunctions) {
373
- proxyBody.tools_config = { google_search_retrieval: { disable: true } };
374
- // Keep Search Tool in List
375
- proxyBody.tools = proxyBody.tools.filter((t) => t.type === 'function' || t.function);
376
- proxyBody.tools = sanitizeToolsForVertex(proxyBody.tools);
381
+ // 4. INJECT STOP SEQUENCES (Fixes "Boucle"/Loop issues) for ALL Gemini requests
382
+ // Gemini 2.5/Flash can be chatty or ignore standard stop tokens.
383
+ if (!proxyBody.stop) {
384
+ proxyBody.stop = ["<|endoftext|>", "User:", "\nUser", "User :", "Model:"];
377
385
  }
386
+ log(`[Proxy] Gemini Logic: Tools=${proxyBody.tools ? proxyBody.tools.length : 'REMOVED'}, Stops Injected.`);
378
387
  }
379
388
  }
380
389
  // C. GEMINI ID BACKTRACKING & SIGNATURE
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.3.4",
4
+ "version": "5.3.6",
5
5
  "description": "Native Pollinations.ai Provider Plugin for OpenCode",
6
6
  "publisher": "pollinations",
7
7
  "repository": {