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

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").
@@ -7,21 +8,25 @@ CRITICAL: Do not confuse 'Mode' with features. The conceptual "Mode Manuel" usua
7
8
  To discover model prefixes or precise names, use the 'polli_status' tool.
8
9
 
9
10
  Available settings to modify via this tool:
10
- 1. mode: The general operating mode of the plugin ("manual", "alwaysfree" or "pro").
11
+ 1. mode: Only the high-level tier ("manual", "alwaysfree" or "pro"). WARNING: Changing mode DOES NOT auto-enable paid tools or confirmations. You must change the other flags explicitly!
11
12
  2. costEstimator: Show live cost estimates in tool outputs. (false = Silent Mode).
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.'),
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.'),
22
+ mode: tool.schema.enum(['manual', 'alwaysfree', 'pro']).optional().describe('CRITICAL: Changing mode does NOT change your rights. To allow paid tools, change enablePaidTools. To enable confirmations, change costConfirmationRequired.'),
20
23
  costEstimator: tool.schema.boolean().optional().describe('Set to true to show cost estimates auto. Set to false for "Manual Mode" (hide estimates).'),
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,26 @@ 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
+ const changedKeys = Object.keys(updates).join(", ");
70
+ let toastMsg = "⚙️ Configuration modifiée par l'Agent";
71
+ if (changedKeys.length > 0) {
72
+ toastMsg += ` (${changedKeys})`;
73
+ }
74
+ emitStatusToast('info', toastMsg, 'Config Update');
75
+ }
54
76
  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
77
  }
56
78
  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.27",
5
5
  "description": "Native Pollinations.ai Provider Plugin for OpenCode",
6
6
  "publisher": "pollinations",
7
7
  "repository": {