opencode-pollinations-plugin 5.8.4-beta.5 → 5.8.4-beta.7
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/dist/server/proxy.js +18 -16
- package/package.json +1 -1
package/dist/server/proxy.js
CHANGED
|
@@ -421,6 +421,23 @@ export async function handleChatCompletion(req, res, bodyRaw) {
|
|
|
421
421
|
// Restore Tools but REMOVE conflicting ones (Search)
|
|
422
422
|
// B. GEMINI UNIFIED FIX (Free, Fast, Pro, Enterprise, Legacy)
|
|
423
423
|
// Handles: "tools" vs "grounding" conflicts, and "infinite loops" via Stop Sequences.
|
|
424
|
+
// GLOBAL BEDROCK FIX (All Models)
|
|
425
|
+
// Check if history has tools but current request misses tools definition.
|
|
426
|
+
// This happens when OpenCode sends the Tool Result (optimisation),
|
|
427
|
+
// but Bedrock requires toolConfig to validate the history.
|
|
428
|
+
const hasToolHistory = proxyBody.messages?.some((m) => m.role === 'tool' || m.tool_calls);
|
|
429
|
+
if (hasToolHistory && (!proxyBody.tools || proxyBody.tools.length === 0)) {
|
|
430
|
+
// Inject Shim Tool to satisfy Bedrock
|
|
431
|
+
proxyBody.tools = [{
|
|
432
|
+
type: 'function',
|
|
433
|
+
function: {
|
|
434
|
+
name: '_bedrock_compatibility_shim',
|
|
435
|
+
description: 'Internal system tool to satisfy Bedrock strict toolConfig requirement. Do not use.',
|
|
436
|
+
parameters: { type: 'object', properties: {} }
|
|
437
|
+
}
|
|
438
|
+
}];
|
|
439
|
+
log(`[Proxy] Bedrock Fix: Injected shim tool for ${actualModel} (History has tools, Request missing tools)`);
|
|
440
|
+
}
|
|
424
441
|
// B. GEMINI UNIFIED FIX (Free, Fast, Pro, Enterprise, Legacy)
|
|
425
442
|
// Fixes "Multiple tools" error (Vertex) and "JSON body validation failed" (v5.3.5 regression)
|
|
426
443
|
// Added ChickyTutor (Claude/Gemini based) to fix "toolConfig must be defined" error.
|
|
@@ -429,22 +446,7 @@ export async function handleChatCompletion(req, res, bodyRaw) {
|
|
|
429
446
|
if (proxyBody.tools && Array.isArray(proxyBody.tools)) {
|
|
430
447
|
hasFunctions = proxyBody.tools.some((t) => t.type === 'function' || t.function);
|
|
431
448
|
}
|
|
432
|
-
//
|
|
433
|
-
// This happens when OpenCode sends the Tool Result: it optimizes by removing "tools" definition,
|
|
434
|
-
// but Bedrock requires toolConfig to validate the history.
|
|
435
|
-
const hasToolHistory = proxyBody.messages?.some((m) => m.role === 'tool' || m.tool_calls);
|
|
436
|
-
if (hasToolHistory && (!proxyBody.tools || proxyBody.tools.length === 0)) {
|
|
437
|
-
// Inject Shim Tool to satisfy Bedrock
|
|
438
|
-
proxyBody.tools = [{
|
|
439
|
-
type: 'function',
|
|
440
|
-
function: {
|
|
441
|
-
name: '_bedrock_compatibility_shim',
|
|
442
|
-
description: 'Internal system tool to satisfy Bedrock strict toolConfig requirement. Do not use.',
|
|
443
|
-
parameters: { type: 'object', properties: {} }
|
|
444
|
-
}
|
|
445
|
-
}];
|
|
446
|
-
log(`[Proxy] Bedrock Fix: Injected shim tool for ${actualModel} (History has tools, Request missing tools)`);
|
|
447
|
-
}
|
|
449
|
+
// Old Shim logic removed (moved up)
|
|
448
450
|
if (hasFunctions) {
|
|
449
451
|
// 1. Strict cleanup of 'google_search' tool
|
|
450
452
|
proxyBody.tools = proxyBody.tools.filter((t) => {
|
package/package.json
CHANGED