opencode-pollinations-plugin 5.8.4-beta.4 → 5.8.4-beta.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.
- package/dist/server/generate-config.js +0 -12
- package/dist/server/proxy.js +21 -0
- package/package.json +1 -1
|
@@ -176,18 +176,6 @@ export async function generatePollinationsConfig(forceApiKey, forceStrict = fals
|
|
|
176
176
|
enterList.forEach((m) => {
|
|
177
177
|
if (m.tools === false)
|
|
178
178
|
return;
|
|
179
|
-
// FIX: ChickyTutor (Bedrock) crashes with tools due to missing toolConfig.
|
|
180
|
-
// Force disable tools to match Free behavior and ensure stability.
|
|
181
|
-
if ((m.id || m.name).includes('chickytutor')) {
|
|
182
|
-
// m.tools = false; // We can't mutate m effectively if we want to filter?
|
|
183
|
-
// No, simply map it but strip tools capability in mapModel?
|
|
184
|
-
// mapModel reads raw.tools to set capability icon.
|
|
185
|
-
// But OpenCode decides to send tools based on ???
|
|
186
|
-
// OpenCode reads the 'modalities' or expects 'tools' option?
|
|
187
|
-
// Let's just NOT push it here if we filter by tools, but wait, we want CHAT.
|
|
188
|
-
// So we allow it, but we hack mapModel to NOT advertise tools?
|
|
189
|
-
m.tools = false;
|
|
190
|
-
}
|
|
191
179
|
const mapped = mapModel(m, 'enter/', '[Enter] ');
|
|
192
180
|
modelsOutput.push(mapped);
|
|
193
181
|
});
|
package/dist/server/proxy.js
CHANGED
|
@@ -153,6 +153,11 @@ export async function handleChatCompletion(req, res, bodyRaw) {
|
|
|
153
153
|
const config = loadConfig();
|
|
154
154
|
// DEBUG: Trace Config State for Hot Reload verification
|
|
155
155
|
log(`[Proxy Request] Config Loaded. Mode: ${config.mode}, HasKey: ${!!config.apiKey}, KeyLength: ${config.apiKey ? config.apiKey.length : 0}`);
|
|
156
|
+
// SPY LOGGING
|
|
157
|
+
try {
|
|
158
|
+
fs.appendFileSync('/tmp/opencode_spy.log', `\n\n=== REQUEST ${new Date().toISOString()} ===\nMODEL: ${body.model}\nBODY:\n${JSON.stringify(body, null, 2)}\n==========================\n`);
|
|
159
|
+
}
|
|
160
|
+
catch (e) { }
|
|
156
161
|
// 0. COMMAND HANDLING
|
|
157
162
|
if (body.messages && body.messages.length > 0) {
|
|
158
163
|
const lastMsg = body.messages[body.messages.length - 1];
|
|
@@ -424,6 +429,22 @@ export async function handleChatCompletion(req, res, bodyRaw) {
|
|
|
424
429
|
if (proxyBody.tools && Array.isArray(proxyBody.tools)) {
|
|
425
430
|
hasFunctions = proxyBody.tools.some((t) => t.type === 'function' || t.function);
|
|
426
431
|
}
|
|
432
|
+
// BEDROCK FIX: Check if history has tools but current request misses tools definition
|
|
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
|
+
}
|
|
427
448
|
if (hasFunctions) {
|
|
428
449
|
// 1. Strict cleanup of 'google_search' tool
|
|
429
450
|
proxyBody.tools = proxyBody.tools.filter((t) => {
|
package/package.json
CHANGED