opencode-pollinations-plugin 6.1.0-beta.29 → 6.1.0-beta.30
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/README.md +22 -6
- package/dist/index.js +3 -20
- package/dist/server/proxy.js +0 -28
- package/dist/tools/pollinations/polli_config.js +7 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -180,15 +180,31 @@ Certain models (`claude-large`, `gemini-large`, `veo`, `seedream-pro`) are **Pai
|
|
|
180
180
|
|
|
181
181
|
Aliases: `/poll` works as a shorthand for all commands.
|
|
182
182
|
|
|
183
|
-
### Config Keys
|
|
183
|
+
### Config Keys & Agent Understanding
|
|
184
184
|
|
|
185
|
+
The plugin employs a **strict separation of concerns** between Chat/Conversational settings and Tool (generation/search) settings.
|
|
186
|
+
|
|
187
|
+
#### 1. Chat Models & Fallbacks
|
|
188
|
+
| Key | Values | Description |
|
|
189
|
+
|-----|--------|-------------|
|
|
190
|
+
| `mode` | `manual` / `alwaysfree` / `pro` | Automatic fallback routing strategy for chat. |
|
|
191
|
+
| `threshold_tier` | `0-100` | Alert threshold percentage for Free Tier quota. |
|
|
192
|
+
| `threshold_wallet` | `0-100` | Alert threshold percentage for Premium Wallet balance. |
|
|
193
|
+
|
|
194
|
+
#### 2. Tools Protection
|
|
195
|
+
| Key | Values | Description |
|
|
196
|
+
|-----|--------|-------------|
|
|
197
|
+
| `enablePaidTools` | `true` / `false` | Allows generation tools to consume Wallet pollen. |
|
|
198
|
+
| `costConfirmationRequired` | `true` / `false` | Demands validation if a tool estimate exceeds threshold. |
|
|
199
|
+
| `costThreshold` | numeric (e.g., `0.05`) | Trigger limit in Pollen for the confirmation lock. |
|
|
200
|
+
| `cost_estimator` | `true` / `false` | Shows live cost estimates in tool outputs. |
|
|
201
|
+
|
|
202
|
+
#### 3. UI & Notifications
|
|
185
203
|
| Key | Values | Description |
|
|
186
204
|
|-----|--------|-------------|
|
|
187
|
-
| `status_gui` | `none` / `alert` / `all` | Toast verbosity |
|
|
188
|
-
| `logs_gui` | `none` / `error` / `verbose` | Technical log verbosity |
|
|
189
|
-
| `
|
|
190
|
-
| `threshold_wallet` | `0-100` | Safety Net trigger ($) |
|
|
191
|
-
| `status_bar` | `true` / `false` | Status bar widget |
|
|
205
|
+
| `status_gui` | `none` / `alert` / `all` | Toast notification verbosity. |
|
|
206
|
+
| `logs_gui` | `none` / `error` / `verbose` | Technical log verbosity. |
|
|
207
|
+
| `status_bar` | `true` / `false` | Status bar widget visibility. |
|
|
192
208
|
|
|
193
209
|
---
|
|
194
210
|
|
package/dist/index.js
CHANGED
|
@@ -100,20 +100,9 @@ export const PollinationsPlugin = async (ctx) => {
|
|
|
100
100
|
return {
|
|
101
101
|
"chat.message": async (input) => {
|
|
102
102
|
const m = input.model;
|
|
103
|
-
if (m) {
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
log(`[Hook] Saved active model ${m.providerID}/${m.modelID} for session ${input.sessionID}`);
|
|
107
|
-
}
|
|
108
|
-
else if (m.modelID && m.modelID.includes('pollimock-handler')) {
|
|
109
|
-
const prev = sessionModels.get(input.sessionID);
|
|
110
|
-
if (prev) {
|
|
111
|
-
log(`[Hook] Virtual model triggered. Reverting to ${prev} in 500ms...`);
|
|
112
|
-
setTimeout(() => {
|
|
113
|
-
ctx.client.tui.executeCommand({ body: { command: `/model ${prev}` } }).catch(console.error);
|
|
114
|
-
}, 500);
|
|
115
|
-
}
|
|
116
|
-
}
|
|
103
|
+
if (m && m.modelID) {
|
|
104
|
+
sessionModels.set(input.sessionID, `${m.providerID}/${m.modelID}`);
|
|
105
|
+
log(`[Hook] Saved active model ${m.providerID}/${m.modelID} for session ${input.sessionID}`);
|
|
117
106
|
}
|
|
118
107
|
},
|
|
119
108
|
tool: toolRegistry,
|
|
@@ -130,12 +119,6 @@ export const PollinationsPlugin = async (ctx) => {
|
|
|
130
119
|
config.provider = {};
|
|
131
120
|
// Dynamic Provider Name
|
|
132
121
|
const version = require('../package.json').version;
|
|
133
|
-
// Inject Virtual Handler Model
|
|
134
|
-
modelsObj['pollimock-handler'] = {
|
|
135
|
-
id: 'pollimock-handler',
|
|
136
|
-
name: 'Command Handler (Virtual)',
|
|
137
|
-
options: { hidden: true } // Try to hide from UI if OpenCode supports it
|
|
138
|
-
};
|
|
139
122
|
config.provider['pollinations'] = {
|
|
140
123
|
id: 'pollinations',
|
|
141
124
|
name: `Pollinations AI (v${version})`,
|
package/dist/server/proxy.js
CHANGED
|
@@ -258,34 +258,6 @@ export async function handleChatCompletion(req, res, bodyRaw) {
|
|
|
258
258
|
}
|
|
259
259
|
}
|
|
260
260
|
log(`Incoming Model (OpenCode ID): ${body.model}`);
|
|
261
|
-
// 0. TEST 4: Virtual Model Handler for Commands
|
|
262
|
-
if (body.model === 'pollinations/pollimock-handler' || body.model === 'pollimock-handler') {
|
|
263
|
-
const mockContent = "🚀 **[TEST 4] Modèle Virtuel de Commande !**\n\nCe texte n'a jamais quitté ton ordinateur. La commande `/pollimock` a demandé à OpenCode de se brancher temporairement sur le modèle virtuel `pollimock-handler`.\nLe proxy a intercepté cet appel et répondu instantanément.\n\n✅ L'historique affiche bien le message du Chat, **mais la requête LLM est totalement court-circuitée**.\nC'est la méthode ultime pour créer des vues de configuration via commandes (`/pollinations-config` par ex) sans polluer le crédit ou les LLM tiers !";
|
|
264
|
-
res.writeHead(200, {
|
|
265
|
-
'Content-Type': 'text/event-stream',
|
|
266
|
-
'Cache-Control': 'no-cache',
|
|
267
|
-
'Connection': 'keep-alive'
|
|
268
|
-
});
|
|
269
|
-
const chunk = JSON.stringify({
|
|
270
|
-
id: 'mock-' + Date.now(),
|
|
271
|
-
object: 'chat.completion.chunk',
|
|
272
|
-
created: Math.floor(Date.now() / 1000),
|
|
273
|
-
model: body.model,
|
|
274
|
-
choices: [{ index: 0, delta: { role: 'assistant', content: mockContent }, finish_reason: null }]
|
|
275
|
-
});
|
|
276
|
-
res.write(`data: ${chunk}\n\n`);
|
|
277
|
-
const chunkEnd = JSON.stringify({
|
|
278
|
-
id: 'mock-' + Date.now(),
|
|
279
|
-
object: 'chat.completion.chunk',
|
|
280
|
-
created: Math.floor(Date.now() / 1000),
|
|
281
|
-
model: body.model,
|
|
282
|
-
choices: [{ index: 0, delta: {}, finish_reason: 'stop' }]
|
|
283
|
-
});
|
|
284
|
-
res.write(`data: ${chunkEnd}\n\n`);
|
|
285
|
-
res.write('data: [DONE]\n\n');
|
|
286
|
-
res.end();
|
|
287
|
-
return;
|
|
288
|
-
}
|
|
289
261
|
// 0. SPECIAL: pollinations/connect (Guide & Status)
|
|
290
262
|
const CONNECT_MODEL_IDS = ['pollinations/connect', 'free/pollinations/connect', 'enter/pollinations/connect', 'connect-pollinations'];
|
|
291
263
|
if (CONNECT_MODEL_IDS.includes(body.model)) {
|
|
@@ -5,22 +5,23 @@ export const polliConfigTool = tool({
|
|
|
5
5
|
description: `[CRITICAL TOOL FOR ASSISTANT] View or modify the Pollinations plugin configuration.
|
|
6
6
|
You must strictly understand the 3 INDEPENDENT categories of settings before explaining or changing them:
|
|
7
7
|
|
|
8
|
-
=== 1. CHAT MODELS & FALLBACKS (Applies ONLY to conversational models
|
|
8
|
+
=== 1. CHAT MODELS & FALLBACKS (Applies ONLY to conversational chat models) ===
|
|
9
9
|
- mode: Dictates fallback rules for the chat.
|
|
10
10
|
* 'manual': No automatic rules.
|
|
11
11
|
* 'alwaysfree': Free tiers first. If 'thresholdsTier' is reached -> fallbacks to Free Universe. NEVER uses Wallet.
|
|
12
12
|
* 'pro': Uses Wallet. If 'thresholdsWallet' is reached -> fallbacks to Free Universe.
|
|
13
13
|
- thresholdsTier: WARNING PERCENTAGE (e.g. 10 for 10%) that triggers chat fallback in 'alwaysfree' mode.
|
|
14
14
|
- thresholdsWallet: WARNING PERCENTAGE (e.g. 50 for 50%) that triggers chat fallback in 'pro' mode.
|
|
15
|
+
*Note: 'enter.agent' or 'free.agent' are fallback conversational models for logic reasoning, THEY DO NOT GENERATE IMAGES OR VIDEOS!*
|
|
15
16
|
|
|
16
17
|
=== 2. TOOLS PROTECTION (Applies ONLY to independent 'polli_' tools like image, video, search) ===
|
|
17
|
-
- enablePaidTools: Allow tools to
|
|
18
|
-
- costConfirmationRequired: Safety lock for tools. If true,
|
|
19
|
-
- costThreshold: USD/🌼 limit that triggers the
|
|
20
|
-
- costEstimator: Shows live cost estimates
|
|
18
|
+
- enablePaidTools: Allow tools to execute models that consume 'Wallet' pollen. If false, tools can only use models that consume 'Freetier' pollen.
|
|
19
|
+
- costConfirmationRequired: Safety lock for tools. If true, the user MUST manually confirm BEFORE executing ANY tool whose cost estimate exceeds the 'costThreshold'.
|
|
20
|
+
- costThreshold: USD/🌼 limit (cost of the tool execution) that triggers the confirmation lock.
|
|
21
|
+
- costEstimator: Shows live cost estimates IN TOOL OUTPUTS (false = Silent Mode).
|
|
21
22
|
|
|
22
23
|
=== 3. UI & NOTIFICATIONS (General display) ===
|
|
23
|
-
- statusBar: Show/Hide the
|
|
24
|
+
- statusBar: Show/Hide the floating status bar notification in the OpenCode UI.
|
|
24
25
|
|
|
25
26
|
Use 'action=update' to change these. NEVER confuse Chat Mode with Tools Protection!`,
|
|
26
27
|
args: {
|
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.
|
|
4
|
+
"version": "6.1.0-beta.30",
|
|
5
5
|
"description": "Native Pollinations.ai Provider Plugin for OpenCode",
|
|
6
6
|
"publisher": "pollinations",
|
|
7
7
|
"repository": {
|