opencode-pollinations-plugin 5.3.4 → 5.3.5

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.
@@ -349,32 +349,29 @@ 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"))) {
352
+ // B. GEMINI UNIFIED FIX (Free, Fast, Pro, Enterprise, Legacy)
353
+ // Handles: "tools" vs "grounding" conflicts, and "infinite loops" via Stop Sequences.
354
+ else if (actualModel.includes("gemini")) {
354
355
  const hasFunctions = proxyBody.tools.some((t) => t.type === 'function' || t.function);
355
356
  if (hasFunctions) {
356
- // 1. Disable Magic Grounding (Source of loops/crashes)
357
+ // 1. Force Disable Built-in Grounding (Source of "Multiple tools" error if mixed)
357
358
  proxyBody.tools_config = { google_search_retrieval: { disable: true } };
358
- // 2. Remove 'google_search' explicitly (Replica of V3.5.5 logic)
359
+ // 2. Strict cleanup of 'google_search' tool from the functions list
360
+ // (If we send a function named 'google_search' AND tools_config, Vertex crashes)
359
361
  proxyBody.tools = proxyBody.tools.filter((t) => {
360
362
  const isFunc = t.type === 'function' || t.function;
361
363
  const name = t.function?.name || t.name;
362
364
  return isFunc && name !== 'google_search';
363
365
  });
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).`);
367
- }
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);
366
+ // 3. Ensure tools are Vertex-Compatible (Schema Dereference)
376
367
  proxyBody.tools = sanitizeToolsForVertex(proxyBody.tools);
368
+ // 4. INJECT STOP SEQUENCES (Fixes "Boucle"/Loop issues)
369
+ // Gemini 2.5/Flash can be chatty or ignore standard stop tokens.
370
+ if (!proxyBody.stop) {
371
+ proxyBody.stop = ["<|endoftext|>", "User:", "\nUser", "User :", "Model:"];
372
+ }
377
373
  }
374
+ log(`[Proxy] Gemini Fix Applied: Grounding Disabled, Search Tool Removed, Stops Injected.`);
378
375
  }
379
376
  }
380
377
  // 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.5",
5
5
  "description": "Native Pollinations.ai Provider Plugin for OpenCode",
6
6
  "publisher": "pollinations",
7
7
  "repository": {