opencode-pollinations-plugin 5.4.5 → 5.4.7
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 +7 -9
- package/dist/index.js +7 -13
- package/dist/server/generate-config.js +4 -1
- package/dist/server/proxy.js +4 -2
- package/dist/server/status.d.ts +1 -3
- package/dist/server/status.js +2 -23
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# 🌸 Pollinations AI Plugin for OpenCode (v5.
|
|
1
|
+
# 🌸 Pollinations AI Plugin for OpenCode (v5.4.6)
|
|
2
2
|
|
|
3
3
|
<div align="center">
|
|
4
4
|
<img src="https://avatars.githubusercontent.com/u/88394740?s=400&v=4" alt="Pollinations.ai Logo" width="200">
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
<div align="center">
|
|
12
12
|
|
|
13
|
-

|
|
14
14
|

|
|
15
15
|

|
|
16
16
|
|
|
@@ -69,14 +69,12 @@ You spend it to verify API calls on premium models.
|
|
|
69
69
|
|
|
70
70
|
> 🎁 **Beta Bonus**: Buy one Pollen pack, get one free!
|
|
71
71
|
|
|
72
|
-
### 🐧 Platform Support &
|
|
72
|
+
### 🐧 Platform Support & Dynamic Ports (v5.4.6+)
|
|
73
|
+
This plugin is **true Cross-Platform** (Windows, macOS, Linux).
|
|
74
|
+
- **Dynamic Port Allocation**: No more port conflicts! The plugin automatically finds an available port on startup.
|
|
75
|
+
- **Tools Support**: Using tools with Gemini (Free) triggers an **Automatic Intelligent Fallback** to OpenAI to ensure your workflow never breaks.
|
|
73
76
|
|
|
74
|
-
This plugin
|
|
75
|
-
|
|
76
|
-
> **Note**: The **Automatic Port Zombie Killer** (which clears port 10001 on startup) is currently **Linux-optimized** (using `fuser -k`).
|
|
77
|
-
> On **Windows/macOS**, if you encounter "Address in use", you may need to manually kill the process occupying port 10001 or reload the window.
|
|
78
|
-
|
|
79
|
-
## 📦 Installation & Ecology Only
|
|
77
|
+
> **Note**: Legacy static port (10001) logic has been replaced with system-assigned ports (0). This eliminates "Address in use" errors and effectively removes the need for Linux-specific `fuser` commands, making the plugin fully **Cross-Platform**.
|
|
80
78
|
|
|
81
79
|
This plugin is part of the **OpenCode Ecosystem**.
|
|
82
80
|
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import * as http from 'http';
|
|
2
2
|
import * as fs from 'fs';
|
|
3
|
-
import { execSync } from 'child_process';
|
|
4
3
|
import { generatePollinationsConfig } from './server/generate-config.js';
|
|
5
4
|
import { loadConfig } from './server/config.js';
|
|
6
5
|
import { handleChatCompletion } from './server/proxy.js';
|
|
@@ -14,15 +13,7 @@ function log(msg) {
|
|
|
14
13
|
}
|
|
15
14
|
catch (e) { }
|
|
16
15
|
}
|
|
17
|
-
|
|
18
|
-
// === ANTI-ZOMBIE (LINUX/MAC LEGACY STABLE) ===
|
|
19
|
-
try {
|
|
20
|
-
log(`[Init] Cleaning port ${TRACKING_PORT}...`);
|
|
21
|
-
execSync(`fuser -k ${TRACKING_PORT}/tcp || true`);
|
|
22
|
-
}
|
|
23
|
-
catch (e) {
|
|
24
|
-
// Ignore on non-Linux or if no process found
|
|
25
|
-
}
|
|
16
|
+
// Port killing removed: Using dynamic ports.
|
|
26
17
|
const startProxy = () => {
|
|
27
18
|
return new Promise((resolve) => {
|
|
28
19
|
const server = http.createServer(async (req, res) => {
|
|
@@ -69,9 +60,12 @@ const startProxy = () => {
|
|
|
69
60
|
res.writeHead(404);
|
|
70
61
|
res.end("Not Found");
|
|
71
62
|
});
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
63
|
+
// Listen on random port (0) to avoid conflicts (CLI/IDE)
|
|
64
|
+
server.listen(0, '127.0.0.1', () => {
|
|
65
|
+
// @ts-ignore
|
|
66
|
+
const assignedPort = server.address().port;
|
|
67
|
+
log(`[Proxy] Started V5.4.5 (Dynamic Port) on port ${assignedPort}`);
|
|
68
|
+
resolve(assignedPort);
|
|
75
69
|
});
|
|
76
70
|
server.on('error', (e) => {
|
|
77
71
|
log(`[Proxy] Fatal Error: ${e}`);
|
|
@@ -79,7 +79,10 @@ export async function generatePollinationsConfig(forceApiKey) {
|
|
|
79
79
|
if (!hasGemini) {
|
|
80
80
|
log(`[ConfigGen] Force-injecting free/gemini.`);
|
|
81
81
|
modelsOutput.push({ id: "free/gemini", name: "[Free] Gemini Flash (Force)", object: "model", variants: {} });
|
|
82
|
-
|
|
82
|
+
}
|
|
83
|
+
// ALIAS for Full ID matching (Fix ProviderModelNotFoundError) - ALWAYS CHECK SEPARATELY
|
|
84
|
+
const hasGeminiAlias = modelsOutput.find(m => m.id === 'pollinations/free/gemini');
|
|
85
|
+
if (!hasGeminiAlias) {
|
|
83
86
|
modelsOutput.push({ id: "pollinations/free/gemini", name: "[Free] Gemini Flash (Alias)", object: "model", variants: {} });
|
|
84
87
|
}
|
|
85
88
|
// 2. ENTERPRISE UNIVERSE
|
package/dist/server/proxy.js
CHANGED
|
@@ -613,8 +613,10 @@ export async function handleChatCompletion(req, res, bodyRaw) {
|
|
|
613
613
|
if (isFallbackActive)
|
|
614
614
|
modeLabel += " (FALLBACK)";
|
|
615
615
|
const fullMsg = `${dashboardMsg} | ⚙️ ${modeLabel}`;
|
|
616
|
-
// Only emit if not silenced
|
|
617
|
-
|
|
616
|
+
// Only emit if not silenced AND only for Enterprise/Paid requests
|
|
617
|
+
if (isEnterprise) {
|
|
618
|
+
emitStatusToast('info', fullMsg, 'Pollinations Status');
|
|
619
|
+
}
|
|
618
620
|
}
|
|
619
621
|
res.end();
|
|
620
622
|
}
|
package/dist/server/status.d.ts
CHANGED
package/dist/server/status.js
CHANGED
|
@@ -1,28 +1,7 @@
|
|
|
1
|
-
import { loadConfig } from './config.js';
|
|
2
|
-
import { getQuotaStatus } from './quota.js';
|
|
3
1
|
export function createStatusHooks(client) {
|
|
4
2
|
return {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
// Si la barre de statut est activée via 'status_bar' (bool)
|
|
8
|
-
// L'utilisateur peut l'activer via /pollinations config status_bar true
|
|
9
|
-
if (config.statusBar) {
|
|
10
|
-
const quota = await getQuotaStatus(false);
|
|
11
|
-
const statusText = formatStatus(quota);
|
|
12
|
-
try {
|
|
13
|
-
// ASTUCE: Toasts longue durée (30s) rafraîchis à chaque idle
|
|
14
|
-
// Simule un widget persistent à droite.
|
|
15
|
-
await client.tui.showToast({
|
|
16
|
-
body: {
|
|
17
|
-
message: statusText,
|
|
18
|
-
variant: 'info',
|
|
19
|
-
duration: 30000
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
catch (e) { }
|
|
24
|
-
}
|
|
25
|
-
}
|
|
3
|
+
// [DEPRECATED] Hook session.idle supprimé car il polluait les autres providers.
|
|
4
|
+
// Les notifications de statut sont désormais gérées par le proxy après chaque requête pollinations/enter.
|
|
26
5
|
};
|
|
27
6
|
}
|
|
28
7
|
function formatStatus(quota) {
|
package/package.json
CHANGED