opencode-pollinations-plugin 6.1.0-beta.23 → 6.1.0-beta.25

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.
@@ -15,10 +15,11 @@ import { polliWebSearchTool } from './pollinations/polli_web_search.js';
15
15
  import { polliBetaDiscoveryTool } from './pollinations/beta_discovery.js';
16
16
  import { polliGenConfirmTool } from './pollinations/polli_gen_confirm.js';
17
17
  import { polliStatusTool } from './pollinations/polli_status.js';
18
+ import { polliConfigTool } from './pollinations/polli_config.js';
18
19
  /**
19
20
  * Build the tool registry based on user's access level
20
21
  *
21
22
  * @returns Record<string, Tool> to be spread into the plugin's tool: {} property
22
23
  */
23
24
  export declare function createToolRegistry(): Record<string, any>;
24
- export { polliGenImageTool, polliGenVideoTool, polliGenAudioTool, polliSttTool, polliGenMusicTool, polliWebSearchTool, polliBetaDiscoveryTool, polliGenConfirmTool, polliStatusTool };
25
+ export { polliGenImageTool, polliGenVideoTool, polliGenAudioTool, polliSttTool, polliGenMusicTool, polliWebSearchTool, polliBetaDiscoveryTool, polliGenConfirmTool, polliStatusTool, polliConfigTool };
@@ -26,6 +26,7 @@ import { polliWebSearchTool } from './pollinations/polli_web_search.js';
26
26
  import { polliBetaDiscoveryTool } from './pollinations/beta_discovery.js';
27
27
  import { polliGenConfirmTool } from './pollinations/polli_gen_confirm.js';
28
28
  import { polliStatusTool } from './pollinations/polli_status.js';
29
+ import { polliConfigTool } from './pollinations/polli_config.js';
29
30
  import { log } from '../server/logger.js';
30
31
  /**
31
32
  * Detect if a valid API key is present
@@ -68,6 +69,8 @@ export function createToolRegistry() {
68
69
  tools['polli_gen_confirm'] = polliGenConfirmTool;
69
70
  // Model API discovery & diagnostics
70
71
  tools['polli_beta_discovery'] = polliBetaDiscoveryTool;
72
+ // Plugin Configuration editor (Agents)
73
+ tools['polli_config'] = polliConfigTool;
71
74
  // Plugin Status / Info / Pricing helper map
72
75
  tools['polli_status'] = polliStatusTool;
73
76
  log(`Enter tools injected (key detected). Total: ${Object.keys(tools).length}`);
@@ -80,4 +83,4 @@ export function createToolRegistry() {
80
83
  return tools;
81
84
  }
82
85
  // Re-export for convenience
83
- export { polliGenImageTool, polliGenVideoTool, polliGenAudioTool, polliSttTool, polliGenMusicTool, polliWebSearchTool, polliBetaDiscoveryTool, polliGenConfirmTool, polliStatusTool };
86
+ export { polliGenImageTool, polliGenVideoTool, polliGenAudioTool, polliSttTool, polliGenMusicTool, polliWebSearchTool, polliBetaDiscoveryTool, polliGenConfirmTool, polliStatusTool, polliConfigTool };
@@ -0,0 +1,2 @@
1
+ import { type ToolDefinition } from '@opencode-ai/plugin/tool';
2
+ export declare const polliConfigTool: ToolDefinition;
@@ -0,0 +1,58 @@
1
+ import { tool } from '@opencode-ai/plugin/tool';
2
+ import { loadConfig, saveConfig } from '../../server/config.js';
3
+ export const polliConfigTool = tool({
4
+ description: `[CRITICAL TOOL FOR ASSISTANT] View or modify the Pollinations plugin configuration.
5
+ Use this tool ONLY when the user explicitly asks to view or change plugin settings (e.g. "change threshold", "disable cost estimates", "enable paid tools", "pass in manual mode").
6
+ CRITICAL: Do not confuse 'Mode' with features. The conceptual "Mode Manuel" usually means disabling 'costEstimator' and enabling 'costConfirmationRequired' so the user has full control.
7
+ To discover model prefixes or precise names, use the 'polli_status' tool.
8
+
9
+ Available settings to modify via this tool:
10
+ 1. mode: The general operating mode of the plugin ("manual", "alwaysfree" or "pro").
11
+ 2. costEstimator: Show live cost estimates in tool outputs. (false = Silent Mode).
12
+ 3. costConfirmationRequired: Safety lock. If true, crossing the threshold requires explicit user confirmation.
13
+ 4. enablePaidTools: Let the AI use the paid 'Wallet' balance instead of free tier.
14
+ 5. costThreshold: The USD/🌼 limit that triggers the confirmation lock lock (0.00 to 10.00).
15
+ 6. statusBar: Show/Hide the bottom status bar in UI.`,
16
+ args: {
17
+ action: tool.schema.enum(['view', 'update'])
18
+ .describe('Action to perform: "view" to see current configuration, "update" to modify it.'),
19
+ mode: tool.schema.enum(['manual', 'alwaysfree', 'pro']).optional().describe('General Plugin Mode. PRO allows wallet deductions, MANUAL requires you to pass explicit flags (no auto-deduction). ALWAYSFREE forces free-tier.'),
20
+ costEstimator: tool.schema.boolean().optional().describe('Set to true to show cost estimates auto. Set to false for "Manual Mode" (hide estimates).'),
21
+ statusBar: tool.schema.boolean().optional().describe('Enable/disable status bar visibility (true/false)'),
22
+ costConfirmationRequired: tool.schema.boolean().optional().describe('Safety Lock: Set to true to ask user confirmation before spending money. Set to false to spend automatically.'),
23
+ enablePaidTools: tool.schema.boolean().optional().describe('Allow execution of paid or premium models using user Wallet balance (true/false)'),
24
+ costThreshold: tool.schema.number().optional().describe('Cost threshold in USD/🌼 above which confirmation is required')
25
+ },
26
+ async execute(args, context) {
27
+ if (args.action === 'view') {
28
+ const current = loadConfig();
29
+ // Obfuscate API key for safety in logs/UI
30
+ const safeConfig = { ...current };
31
+ if (safeConfig.apiKey && safeConfig.apiKey.length > 10) {
32
+ safeConfig.apiKey = safeConfig.apiKey.substring(0, 5) + '...[REDACTED]';
33
+ }
34
+ return `Current Plugin Configuration:\n\n${JSON.stringify(safeConfig, null, 2)}`;
35
+ }
36
+ if (args.action === 'update') {
37
+ const updates = {};
38
+ if (args.mode !== undefined)
39
+ updates.mode = args.mode;
40
+ if (args.costEstimator !== undefined)
41
+ updates.costEstimator = args.costEstimator;
42
+ if (args.statusBar !== undefined)
43
+ updates.statusBar = args.statusBar;
44
+ if (args.costConfirmationRequired !== undefined)
45
+ updates.costConfirmationRequired = args.costConfirmationRequired;
46
+ if (args.enablePaidTools !== undefined)
47
+ updates.enablePaidTools = args.enablePaidTools;
48
+ if (args.costThreshold !== undefined)
49
+ updates.costThreshold = args.costThreshold;
50
+ if (Object.keys(updates).length === 0) {
51
+ return "No configuration values provided to update. Please specify at least one setting via the arguments.";
52
+ }
53
+ saveConfig(updates);
54
+ return `Configuration successfully updated.\nApplied changes:\n${JSON.stringify(updates, null, 2)}\n\n(Note: Verify with polli_status if you need to know model prefixes).`;
55
+ }
56
+ return "Invalid action. Use 'view' or 'update'.";
57
+ }
58
+ });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "opencode-pollinations-plugin",
3
3
  "displayName": "Pollinations AI (V5.9)",
4
- "version": "6.1.0-beta.23",
4
+ "version": "6.1.0-beta.25",
5
5
  "description": "Native Pollinations.ai Provider Plugin for OpenCode",
6
6
  "publisher": "pollinations",
7
7
  "repository": {