opencode-pollinations-plugin 5.4.6 → 5.4.8-debug.1

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 CHANGED
@@ -1,4 +1,4 @@
1
- # 🌸 Pollinations AI Plugin for OpenCode (v5.1)
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
- ![Version](https://img.shields.io/badge/version-5.1.3-blue.svg)
13
+ ![Version](https://img.shields.io/badge/version-5.4.6-blue.svg)
14
14
  ![License](https://img.shields.io/badge/license-MIT-green.svg)
15
15
  ![Status](https://img.shields.io/badge/status-Stable-success.svg)
16
16
 
@@ -52,6 +52,7 @@ Pollinations.ai is an open-source platform built by and for the community. We pr
52
52
  - **🛡️ Safety Net V5**: never get blocked.
53
53
  - **Transparent Fallback**: If your Pro quota runs out mid-chat, the plugin automatically switches to a free model instantly. No errors, just a seamless experience.
54
54
  - **📊 Real-time Dashboard**: Track your **Pollen** usage, Tier Status, and Wallet Balance inside OpenCode.
55
+ - **🔇 Stealth Mode (v5.4.7)**: Status notifications are now strictly limited to Pollinations Enter (Paid) sessions. No more cluttered notifications when using other providers like Nvidia or Google AI.
55
56
 
56
57
  ## 🐝 Understanding Pollen & Tiers
57
58
 
@@ -69,14 +70,12 @@ You spend it to verify API calls on premium models.
69
70
 
70
71
  > 🎁 **Beta Bonus**: Buy one Pollen pack, get one free!
71
72
 
72
- ### 🐧 Platform Support & Port Management
73
+ ### 🐧 Platform Support & Dynamic Ports (v5.4.6+)
74
+ This plugin is **true Cross-Platform** (Windows, macOS, Linux).
75
+ - **Dynamic Port Allocation**: No more port conflicts! The plugin automatically finds an available port on startup.
76
+ - **Tools Support**: Using tools with Gemini (Free) triggers an **Automatic Intelligent Fallback** to OpenAI to ensure your workflow never breaks.
73
77
 
74
- This plugin is **Cross-Platform** (Windows, macOS, Linux).
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
78
+ > **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
79
 
81
80
  This plugin is part of the **OpenCode Ecosystem**.
82
81
 
@@ -33,6 +33,37 @@ function saveSignatureMap() {
33
33
  log(`ERROR: Error mapping signature: ${String(e)}`);
34
34
  }
35
35
  }
36
+ /**
37
+ * DEEP INSPECTION LOGGING (Temporary for v5.5.0 Analysis)
38
+ * Dumps the full payload to a local log file to identify OpenCode agent signatures.
39
+ */
40
+ function dumpPayload(body) {
41
+ try {
42
+ const logPath = '/home/fkomp/Bureau/oracle/opencode-pollinations-plugin/logs/payload_dump.log';
43
+ if (!fs.existsSync(path.dirname(logPath)))
44
+ fs.mkdirSync(path.dirname(logPath), { recursive: true });
45
+ // Extract interesting bits for quick reading
46
+ const systemPrompt = body.messages?.find((m) => m.role === 'system')?.content || "NONE";
47
+ const inspection = {
48
+ timestamp: new Date().toISOString(),
49
+ captured_fields: {
50
+ model: body.model,
51
+ user: body.user,
52
+ metadata: body.metadata,
53
+ agent: body.agent,
54
+ hasTools: !!(body.tools && body.tools.length > 0),
55
+ toolsCount: body.tools?.length || 0,
56
+ messageCount: body.messages?.length || 0,
57
+ systemPromptSnippet: systemPrompt.substring(0, 300) + "..."
58
+ },
59
+ full_body: body
60
+ };
61
+ fs.appendFileSync(logPath, JSON.stringify(inspection, null, 2) + "\n\n--- END OF REQUEST ---\n\n");
62
+ }
63
+ catch (e) {
64
+ console.error("[DebugLog] Failed to dump payload:", e);
65
+ }
66
+ }
36
67
  // RECURSIVE NORMALIZER for Stable Hashing
37
68
  function normalizeContent(c) {
38
69
  if (!c)
@@ -150,6 +181,7 @@ export async function handleChatCompletion(req, res, bodyRaw) {
150
181
  let authHeader = undefined;
151
182
  try {
152
183
  const body = JSON.parse(bodyRaw);
184
+ dumpPayload(body); // <--- DEEP INSPECTION
153
185
  const config = loadConfig();
154
186
  // DEBUG: Trace Config State for Hot Reload verification
155
187
  log(`[Proxy Request] Config Loaded. Mode: ${config.mode}, HasKey: ${!!config.apiKey}, KeyLength: ${config.apiKey ? config.apiKey.length : 0}`);
@@ -613,8 +645,10 @@ export async function handleChatCompletion(req, res, bodyRaw) {
613
645
  if (isFallbackActive)
614
646
  modeLabel += " (FALLBACK)";
615
647
  const fullMsg = `${dashboardMsg} | ⚙️ ${modeLabel}`;
616
- // Only emit if not silenced (handled inside emitStatusToast)
617
- emitStatusToast('info', fullMsg, 'Pollinations Status');
648
+ // Only emit if not silenced AND only for Enterprise/Paid requests
649
+ if (isEnterprise) {
650
+ emitStatusToast('info', fullMsg, 'Pollinations Status');
651
+ }
618
652
  }
619
653
  res.end();
620
654
  }
@@ -1,3 +1 @@
1
- export declare function createStatusHooks(client: any): {
2
- 'session.idle': () => Promise<void>;
3
- };
1
+ export declare function createStatusHooks(client: any): {};
@@ -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
- 'session.idle': async () => {
6
- const config = loadConfig();
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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "opencode-pollinations-plugin",
3
3
  "displayName": "Pollinations AI (V5.1)",
4
- "version": "5.4.6",
4
+ "version": "5.4.8-debug.1",
5
5
  "description": "Native Pollinations.ai Provider Plugin for OpenCode",
6
6
  "publisher": "pollinations",
7
7
  "repository": {