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.
@@ -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 toolConfig
198
- else if (hasToolHistory && !sanitized.tool_config && !sanitized.toolConfig) {
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
- // Create shim tools from the tool names we found in history
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
- sanitized.tool_config = {
203
- tools: uniqueToolNames.length > 0
204
- ? uniqueToolNames.map(name => ({
205
- toolSpec: {
206
- name: name,
207
- description: 'Tool inferred from conversation history (Bedrock compatibility shim)',
208
- inputSchema: { json: { type: 'object', properties: {} } }
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
- toolSpec: {
213
- name: '_bedrock_shim_tool',
214
- description: 'Internal shim to satisfy Bedrock toolConfig requirement',
215
- inputSchema: { json: { type: 'object', properties: {} } }
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 toolConfig with ${uniqueToolNames.length || 1} shim tool(s) for history compatibility`);
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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "opencode-pollinations-plugin",
3
3
  "displayName": "Pollinations AI (V5.6)",
4
- "version": "6.1.0-beta.8",
4
+ "version": "6.1.0-beta.9",
5
5
  "description": "Native Pollinations.ai Provider Plugin for OpenCode",
6
6
  "publisher": "pollinations",
7
7
  "repository": {