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

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.
@@ -1,5 +1,6 @@
1
1
  import { tool } from '@opencode-ai/plugin/tool';
2
2
  import { loadConfig, saveConfig } from '../../server/config.js';
3
+ import { emitStatusToast } from '../../server/toast.js';
3
4
  export const polliConfigTool = tool({
4
5
  description: `[CRITICAL TOOL FOR ASSISTANT] View or modify the Pollinations plugin configuration.
5
6
  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").
@@ -12,7 +13,9 @@ Available settings to modify via this tool:
12
13
  3. costConfirmationRequired: Safety lock. If true, crossing the threshold requires explicit user confirmation.
13
14
  4. enablePaidTools: Let the AI use the paid 'Wallet' balance instead of free tier.
14
15
  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
+ 6. statusBar: Show/Hide the bottom status bar in UI.
17
+ 7. thresholdsTier: The WARNING PERCENTAGE (e.g. 10 for 10%) for the Free Tier quota.
18
+ 8. thresholdsWallet: The WARNING PERCENTAGE (e.g. 50 for 50%) for the Wallet balance.`,
16
19
  args: {
17
20
  action: tool.schema.enum(['view', 'update'])
18
21
  .describe('Action to perform: "view" to see current configuration, "update" to modify it.'),
@@ -21,7 +24,9 @@ Available settings to modify via this tool:
21
24
  statusBar: tool.schema.boolean().optional().describe('Enable/disable status bar visibility (true/false)'),
22
25
  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
26
  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')
27
+ costThreshold: tool.schema.number().optional().describe('Cost threshold in USD/🌼 above which confirmation is required'),
28
+ thresholdsTier: tool.schema.number().optional().describe('Warning threshold PERCENTAGE (e.g. 10 for 10%) for Free Tier.'),
29
+ thresholdsWallet: tool.schema.number().optional().describe('Warning threshold PERCENTAGE (e.g. 50 for 50%) for Wallet balance.')
25
30
  },
26
31
  async execute(args, context) {
27
32
  if (args.action === 'view') {
@@ -34,6 +39,7 @@ Available settings to modify via this tool:
34
39
  return `Current Plugin Configuration:\n\n${JSON.stringify(safeConfig, null, 2)}`;
35
40
  }
36
41
  if (args.action === 'update') {
42
+ const currentConfig = loadConfig();
37
43
  const updates = {};
38
44
  if (args.mode !== undefined)
39
45
  updates.mode = args.mode;
@@ -47,10 +53,21 @@ Available settings to modify via this tool:
47
53
  updates.enablePaidTools = args.enablePaidTools;
48
54
  if (args.costThreshold !== undefined)
49
55
  updates.costThreshold = args.costThreshold;
56
+ if (args.thresholdsTier !== undefined || args.thresholdsWallet !== undefined) {
57
+ updates.thresholds = { ...currentConfig.thresholds };
58
+ if (args.thresholdsTier !== undefined)
59
+ updates.thresholds.tier = args.thresholdsTier;
60
+ if (args.thresholdsWallet !== undefined)
61
+ updates.thresholds.wallet = args.thresholdsWallet;
62
+ }
50
63
  if (Object.keys(updates).length === 0) {
51
64
  return "No configuration values provided to update. Please specify at least one setting via the arguments.";
52
65
  }
53
66
  saveConfig(updates);
67
+ const newConfig = loadConfig();
68
+ if (newConfig.statusBar) {
69
+ emitStatusToast('info', "⚙️ Configuration du plugin mise à jour par l'Agent", 'Config Update');
70
+ }
54
71
  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
72
  }
56
73
  return "Invalid action. Use 'view' or 'update'.";
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.25",
4
+ "version": "6.1.0-beta.26",
5
5
  "description": "Native Pollinations.ai Provider Plugin for OpenCode",
6
6
  "publisher": "pollinations",
7
7
  "repository": {