opencode-pollinations-plugin 6.1.0-beta.8 → 6.1.0-beta.9
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 +33 -19
- package/package.json +1 -1
package/dist/server/proxy.js
CHANGED
|
@@ -194,29 +194,43 @@ function sanitizeForBedrock(body) {
|
|
|
194
194
|
};
|
|
195
195
|
}
|
|
196
196
|
}
|
|
197
|
-
// 3. CRITICAL: If no tools BUT history has tool calls, inject shim
|
|
198
|
-
else if (hasToolHistory
|
|
197
|
+
// 3. CRITICAL: If no tools BUT history has tool calls, inject shim tools array
|
|
198
|
+
else if (hasToolHistory) {
|
|
199
199
|
// Bedrock requires toolConfig when history contains toolUse/toolResult
|
|
200
|
-
//
|
|
200
|
+
// Pollinations builds toolConfig from the 'tools' array, not from our 'tool_config'
|
|
201
|
+
// So we MUST inject 'tools' in OpenAI format, not just 'tool_config'
|
|
201
202
|
const uniqueToolNames = [...new Set(toolNamesFromHistory)];
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
203
|
+
// Build OpenAI-format tools array (this is what Pollinations actually uses!)
|
|
204
|
+
const shimTools = uniqueToolNames.length > 0
|
|
205
|
+
? uniqueToolNames.map(name => ({
|
|
206
|
+
type: 'function',
|
|
207
|
+
function: {
|
|
208
|
+
name: name,
|
|
209
|
+
description: 'Tool inferred from conversation history (Bedrock compatibility shim)',
|
|
210
|
+
parameters: { type: 'object', properties: {} }
|
|
211
|
+
}
|
|
212
|
+
}))
|
|
213
|
+
: [{
|
|
214
|
+
type: 'function',
|
|
215
|
+
function: {
|
|
216
|
+
name: '_bedrock_shim_tool',
|
|
217
|
+
description: 'Internal shim to satisfy Bedrock toolConfig requirement',
|
|
218
|
+
parameters: { type: 'object', properties: {} }
|
|
209
219
|
}
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
220
|
+
}];
|
|
221
|
+
// Inject the tools array (Pollinations format)
|
|
222
|
+
sanitized.tools = shimTools;
|
|
223
|
+
// Also set tool_config for direct Bedrock passthrough (belt & suspenders)
|
|
224
|
+
sanitized.tool_config = {
|
|
225
|
+
tools: shimTools.map(t => ({
|
|
226
|
+
toolSpec: {
|
|
227
|
+
name: t.function.name,
|
|
228
|
+
description: t.function.description,
|
|
229
|
+
inputSchema: { json: t.function.parameters }
|
|
230
|
+
}
|
|
231
|
+
}))
|
|
218
232
|
};
|
|
219
|
-
log(`[Bedrock Shim] Injected
|
|
233
|
+
log(`[Bedrock Shim] Injected ${shimTools.length} shim tool(s) for history compatibility: [${uniqueToolNames.join(', ') || '_bedrock_shim_tool'}]`);
|
|
220
234
|
}
|
|
221
235
|
return sanitized;
|
|
222
236
|
}
|
package/package.json
CHANGED