opencode-pollinations-plugin 6.4.6 → 6.4.8

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.
Files changed (34) hide show
  1. package/README.de.md +3 -0
  2. package/README.es.md +3 -0
  3. package/README.fr.md +3 -0
  4. package/README.it.md +3 -0
  5. package/README.md +4 -1
  6. package/README.zh.md +3 -0
  7. package/dist/locales/de.json +17 -2
  8. package/dist/locales/en.json +17 -2
  9. package/dist/locales/es.json +17 -2
  10. package/dist/locales/fr.json +17 -2
  11. package/dist/locales/it.json +17 -2
  12. package/dist/locales/zh.json +17 -2
  13. package/dist/server/quota.js +10 -10
  14. package/dist/server/toast.d.ts +1 -0
  15. package/dist/server/toast.js +7 -2
  16. package/dist/tools/index.js +8 -0
  17. package/dist/tools/pollinations/gen_edit_image_free.js +4 -3
  18. package/dist/tools/pollinations/gen_video_free.js +3 -2
  19. package/dist/tools/pollinations/image_enhancer.d.ts +2 -0
  20. package/dist/tools/pollinations/image_enhancer.js +62 -0
  21. package/dist/tools/pollinations/image_upscaler.d.ts +2 -0
  22. package/dist/tools/pollinations/image_upscaler.js +61 -0
  23. package/dist/tools/pollinations/imgtools/clients.d.ts +11 -0
  24. package/dist/tools/pollinations/imgtools/clients.js +182 -0
  25. package/dist/tools/pollinations/imgtools/config.d.ts +42 -0
  26. package/dist/tools/pollinations/imgtools/config.js +81 -0
  27. package/dist/tools/pollinations/imgtools/crypto.d.ts +4 -0
  28. package/dist/tools/pollinations/imgtools/crypto.js +34 -0
  29. package/dist/tools/pollinations/imgtools/helpers.d.ts +24 -0
  30. package/dist/tools/pollinations/imgtools/helpers.js +111 -0
  31. package/dist/tools/pollinations/object_remover.d.ts +2 -0
  32. package/dist/tools/pollinations/object_remover.js +62 -0
  33. package/dist/tools/power/remove_background.js +16 -60
  34. package/package.json +1 -1
package/README.de.md CHANGED
@@ -4,6 +4,9 @@
4
4
 
5
5
  - 🎯 **Quests & Gamification** : `polli_quests` + `/poll quests` — sieh deine Quests und das **einlösbare kostenlose Pollen**. Die Nutzung des Plugins schließt Quests rückwirkend ab!
6
6
  - 🆓 **Kostenlose Bild- & Videogenerierung (ohne Schlüssel!)** : `gen_edit_image_free` (erstellen + bearbeiten, ~20/Tag) und `gen_video_free` (Text→Video + Bild/Audio, ~5/Tag), für jedes Modell.
7
+ - `object_remover` : Objekte per Prompt entfernen (kostenlos).
8
+ - `image_upscaler` : Bilder 2x/4x vergrößern (kostenlos).
9
+ - `image_enhancer` : KI-Bildverbesserung (kostenlos).
7
10
  - 🔐 **1-Klick-Login** : `/poll login` + `polli_login` (Device Flow wie `gh auth login`), Browser öffnet automatisch. `/poll connect sk_...` bleibt für permanente Schlüssel verfügbar.
8
11
  - 🇨🇳 **Chinesisch hinzugefügt** : Oberfläche in 6 Sprachen (en, fr, es, de, it, zh).
9
12
 
package/README.es.md CHANGED
@@ -4,6 +4,9 @@
4
4
 
5
5
  - 🎯 **Misiones y Gamificación** : `polli_quests` + `/poll quests` — mira tus misiones y el **Pollen gratis por reclamar**. ¡Usar el plugin completa misiones retroactivamente!
6
6
  - 🆓 **Imagen y Vídeo gratis (¡sin clave!)** : `gen_edit_image_free` (generar + editar, ~20/día) y `gen_video_free` (texto→vídeo + imagen/audio, ~5/día), para cualquier modelo.
7
+ - `object_remover` : Elimina objetos por prompt (gratis).
8
+ - `image_upscaler` : Amplía imágenes 2x/4x (gratis).
9
+ - `image_enhancer` : Mejora IA de imagen (gratis).
7
10
  - 🔐 **Inicio 1 clic** : `/poll login` + `polli_login` (device flow como `gh auth login`), el navegador se abre solo. `/poll connect sk_...` sigue disponible para clave permanente.
8
11
  - 🇨🇳 **Chino añadido** : interfaz en 6 idiomas (en, fr, es, de, it, zh).
9
12
 
package/README.fr.md CHANGED
@@ -4,6 +4,9 @@
4
4
 
5
5
  - 🎯 **Quêtes & Gamification** : `polli_quests` + `/poll quests` — voyez vos quêtes et le **Pollen gratuit à réclamer**. Utiliser le plugin complète des quêtes rétroactivement !
6
6
  - 🆓 **Image & Vidéo gratuites (sans clé !)** : `gen_edit_image_free` (génération + édition, ~20/j) et `gen_video_free` (texte→vidéo + image/audio, ~5/j), pour n'importe quel modèle.
7
+ - `object_remover`
8
+ - `image_upscaler`
9
+ - `image_enhancer`
7
10
  - 🔐 **Connexion 1 clic** : `/poll login` + `polli_login` (device flow façon `gh auth login`), le navigateur s'ouvre tout seul. `/poll connect sk_...` reste dispo pour une clé permanente.
8
11
  - 🇨🇳 **Chinois ajouté** : interface disponible en 6 langues (en, fr, es, de, it, zh).
9
12
 
package/README.it.md CHANGED
@@ -4,6 +4,9 @@
4
4
 
5
5
  - 🎯 **Quest e Gamification** : `polli_quests` + `/poll quests` — guarda le tue quest e il **Pollen gratuito da riscattare**. Usare il plugin completa quest retroattivamente!
6
6
  - 🆓 **Immagini e Video gratis (senza chiave!)** : `gen_edit_image_free` (genera + modifica, ~20/giorno) e `gen_video_free` (testo→video + immagine/audio, ~5/giorno), per qualsiasi modello.
7
+ - `object_remover` : Rimuovi oggetti con prompt (gratis).
8
+ - `image_upscaler` : Ingrandisci immagini 2x/4x (gratis).
9
+ - `image_enhancer` : Miglioramento IA immagini (gratis).
7
10
  - 🔐 **Accesso 1 clic** : `/poll login` + `polli_login` (device flow come `gh auth login`), il browser si apre da solo. `/poll connect sk_...` resta disponibile per chiave permanente.
8
11
  - 🇨🇳 **Cinese aggiunto** : interfaccia in 6 lingue (en, fr, es, de, it, zh).
9
12
 
package/README.md CHANGED
@@ -33,6 +33,9 @@
33
33
  - 🆓 **Free Image & Video Tools (no key required!)**: Two brand-new bonus tools usable by **any** OpenCode model, even without a Pollinations account:
34
34
  - `gen_edit_image_free` — generate **and edit** images (~20/day).
35
35
  - `gen_video_free` — text-to-video with optional first-frame image & audio (~5/day).
36
+ - 🧹 `object_remover` : Remove objects by prompt (free, direct).
37
+ - 📐 `image_upscaler` : Upscale images 2x/4x (free, direct).
38
+ - ✨ `image_enhancer` : AI image enhancement (free, direct).
36
39
  - 🔐 **1-Click Device Login**: New `/poll login` command + `polli_login` tool (like `gh auth login`). Opens your browser automatically and connects the plugin — no manual key copy-paste needed. The old `/poll connect sk_...` still works for permanent keys.
37
40
  - 🇨🇳 **Chinese added**: The interface is now available in **6 languages** (en, fr, es, de, it, **zh**).
38
41
  - 🛠️ **Tier fixes**: Full alignment with the official Pollinations tier config (added `router` 🐝, `anonymous`), crash fixes on no-refill tiers, and quest-based progression replacing the deprecated dev-points system.
@@ -53,7 +56,7 @@ Beyond text discussion, connecting your key gives OpenCode Agents access to our
53
56
  ### 🧰 Free Creator Bonus Tools (Always available — no API key needed)
54
57
  - 🆓 `gen_edit_image_free` : Generate **and edit** images for free (~20/day, any model, no key).
55
58
  - 🆓 `gen_video_free` : Free text-to-video with optional first-frame image & audio (~5/day, no key).
56
- - ✂️ `remove_background` : Built-in ultra-fast AI image background removal.
59
+ - ✂️ `remove_background` : AI background removal (bgeraser.com)'s rmbg, free).
57
60
  - 🛠️ `gen_qrcode`, `gen_diagram`, `gen_palette`, `extract_frames`, `extract_audio`, `file_to_url`: Dev utilities.
58
61
 
59
62
  ### 💻 Complete List of Terminal Commands
package/README.zh.md CHANGED
@@ -4,6 +4,9 @@
4
4
 
5
5
  - 🎯 **任务与游戏化** :`polli_quests` + `/poll quests` — 查看你的任务和**可领取的免费 Pollen**。使用本插件会追溯性地完成多个任务!
6
6
  - 🆓 **免费图像和视频 (无需密钥!)** :`gen_edit_image_free` (生成 + 编辑,约 20/天) 和 `gen_video_free` (文本→视频 + 图像/音频,约 5/天),适用于任何模型。
7
+ - `object_remover` : 通过提示移除对象 (免费).
8
+ - `image_upscaler` : 图像放大 2x/4x (免费).
9
+ - `image_enhancer` : AI 图像增强 (免费).
7
10
  - 🔐 **一键登录** :`/poll login` + `polli_login` (设备流程,类似 `gh auth login`),浏览器自动打开。`/poll connect sk_...` 仍可用于永久密钥。
8
11
  - 🇨🇳 **新增中文** :界面支持 6 种语言 (en, fr, es, de, it, zh)。
9
12
 
@@ -116,7 +116,7 @@
116
116
  "infos": {
117
117
  "title": "## 🍯💚 POLLINATIONS OPENCODE PLUGIN 💚🍯\n\nWillkommen **{name}** beim Pollinations OpenCode Plugin!\n\nDieses Plugin ermöglicht es, Code und Bilder zu generieren, Videos zu analysieren und nahtlos mit den besten KI-Modellen zu interagieren. Greifen Sie über Chat, Refactoring oder Terminal auf erstklassige LLMs zu.",
118
118
  "features_title": "**Was dieses Plugin Ihnen bietet! :**",
119
- "features_free": "**🛠️ Kostenlose Tools (Immer verfugbar):**\n- `gen_qrcode` / `gen_diagram` / `gen_palette` : Visuals und Dev-Tools.\n- `remove_background` : Hintergrundentfernung.\n- `extract_frames` / `extract_audio` : Medien-Extraktion.\n- `file_to_url` : Online-Hosting.\n- `gen_edit_image_free` : Kostenlose Bild-Generierung & Bearbeitung (~20/Tag).\n- `gen_video_free` : Kostenlose Video-Generierung (~5/Tag).",
119
+ "features_free": "**🛠️ Kostenlose Tools (Immer verfugbar):**\n- `gen_qrcode` / `gen_diagram` / `gen_palette` : Visuals und Dev-Tools.\n- `remove_background` : Hintergrundentfernung.\n- `extract_frames` / `extract_audio` : Medien-Extraktion.\n- `file_to_url` : Online-Hosting.\n- `gen_edit_image_free` : Kostenlose Bild-Generierung & Bearbeitung (~20/Tag).\n- `gen_video_free` : Kostenlose Video-Generierung (~5/Tag).\n- `object_remover` : Suppression d’objets par prompt (gratuit, direct).\n- `image_upscaler` : Agrandissement 2x/4x (gratuit, direct).\n- `image_enhancer` : Amélioration IA d’image (gratuit, direct).",
120
120
  "features_pro": "**💎 Pollinations Tools (Premium - Automatisiert mit Key):**\n- `polli_gen_image` : Bildgen (Flux, Gemini) + Image-to-Image.\n- `polli_gen_video` : Text-to-Video / Image-to-Video (Veo, Wan...).\n- `polli_gen_audio`/`polli_stt` : Whisper STT, ElevenLabs TTS.\n- `polli_gen_music` : Generative Musik-Engine.\n- `polli_web_search` : Verbundene Websuche.",
121
121
  "features_config": "- **Granulare Konfiguration**, Modus- und Token-Management, Kostenschutz...",
122
122
  "tiers_title": "> **Dein Quest Pollen Refill:** {emoji} {tier}",
@@ -445,11 +445,26 @@
445
445
  "polli_login": {
446
446
  "desc": "🔐 Startet einen schnellen Pollinations-Login (Device Flow) für den Benutzer. Zeigt einen kurzen Code + URL; der Benutzer meldet sich im Browser mit GitHub an, und das Plugin verbindet sich AUTOMATISCH nach Genehmigung (ein Toast bestätigt). Kein API-Schlüssel zum Ausführen nötig. Verwende dies, wenn der Benutzer sein Pollinations-Konto einfach verbinden möchte, ohne einen Schlüssel zu kopieren. Für einen permanenten Schlüssel sage ihm, `/poll connect sk_...` zu verwenden.",
447
447
  "arg_wait": "Wenn true, wartet auf den Abschluss eines laufenden Logins und gibt das Endergebnis zurück (✅ verbunden / abgelaufen). Rufe zuerst ohne wait auf, um den Code anzuzeigen, dann erneut mit wait:true, nachdem du den Benutzer zur Autorisierung aufgefordert hast."
448
+ },
449
+ "object_remover": {
450
+ "file_not_found": "❗ File not found: {path}",
451
+ "no_result": "❗ No result received.",
452
+ "error": "❗ Error: {error}"
453
+ },
454
+ "image_upscaler": {
455
+ "file_not_found": "❗ File not found: {path}",
456
+ "no_result": "❗ No result received.",
457
+ "error": "❗ Error: {error}"
458
+ },
459
+ "image_enhancer": {
460
+ "file_not_found": "❗ File not found: {path}",
461
+ "no_result": "❗ No result received.",
462
+ "error": "❗ Error: {error}"
448
463
  }
449
464
  },
450
465
  "connect_response": {
451
466
  "title_key": "## 🍯💚 POLLINATIONS PLUGIN VERBUNDEN 💚🍯\n\nWillkommen **{name}** beim Pollinations Agent Plugin!\n**Aktueller Modus**: `{mode}`",
452
- "tools_intro": "### 🚀 Multimedia Tools\n\nDieses Plugin ermöglicht es, Code und Bilder zu generieren, Videos zu analysieren und mit den besten KI-Modellen zu interagieren.\n\n**🛠️ Kostenlose Tools:**\n- `gen_qrcode` / `gen_diagram` / `gen_palette`\n- `remove_background`\n- `extract_frames` / `extract_audio`\n- `file_to_url`\n- `gen_edit_image_free` (Bild-Gen & Edit, ~20/Tag)\n- `gen_video_free` (Video-Gen, ~5/Tag)\n\n**💎 Premium Tools:**\n- `polli_gen_image`\n- `polli_gen_video`\n- `polli_gen_audio`/`polli_stt`\n- `polli_gen_music`\n- `polli_web_search`",
467
+ "tools_intro": "### 🚀 Multimedia Tools\n\nDieses Plugin ermöglicht es, Code und Bilder zu generieren, Videos zu analysieren und mit den besten KI-Modellen zu interagieren.\n\n**🛠️ Kostenlose Tools:**\n- `gen_qrcode` / `gen_diagram` / `gen_palette`\n- `remove_background`\n- `extract_frames` / `extract_audio`\n- `file_to_url`\n- `gen_edit_image_free` (Bild-Gen & Edit, ~20/Tag)\n- `gen_video_free` (Video-Gen, ~5/Tag)\n- `object_remover`\n- `image_upscaler`\n- `image_enhancer`\n\n**💎 Premium Tools:**\n- `polli_gen_image`\n- `polli_gen_video`\n- `polli_gen_audio`/`polli_stt`\n- `polli_gen_music`\n- `polli_web_search`",
453
468
  "terminal_cmds": "### 💻 Terminal Befehle\nVerwenden Sie `/poll help` um alle Befehle anzuzeigen.",
454
469
  "resources": "### 📚 Ressourcen\n* **Dashboard:** enter.pollinations.ai\n* **Discord:** Community beitreten\n* **Plugin:** github.com/fkom13/opencode-pollinations-plugin",
455
470
  "free_models_success": "Verfügbare Modelle: {models}",
@@ -115,7 +115,7 @@
115
115
  "infos": {
116
116
  "title": "## 🍯💚 POLLINATIONS OPENCODE PLUGIN 💚🍯\n\nWelcome **{name}** to the Pollinations OpenCode plugin!\n\nThis plugin empowers you to generate code, images, analyze videos, and interact with top-tier AI models seamlessly within your dev environment. Access state-of-the-art LLMs via chat, refactoring, or terminal.",
117
117
  "features_title": "**What this plugin brings to you! :**",
118
- "features_free": "**🛠️ Integrated Free Tools (Always Available):**\n- `gen_qrcode` / `gen_diagram` / `gen_palette` : Visuals and dev utilities.\n- `remove_background` : Native background removal.\n- `extract_frames` / `extract_audio` : Fast media extraction.\n- `file_to_url` : Instant online hosting of local files.\n- `gen_edit_image_free` : Free image gen & edit (~20/day).\n- `gen_video_free` : Free video gen (~5/day).",
118
+ "features_free": "**🛠️ Integrated Free Tools (Always Available):**\n- `gen_qrcode` / `gen_diagram` / `gen_palette` : Visuals and dev utilities.\n- `remove_background` : Native background removal.\n- `extract_frames` / `extract_audio` : Fast media extraction.\n- `file_to_url` : Instant online hosting of local files.\n- `gen_edit_image_free` : Free image gen & edit (~20/day).\n- `gen_video_free` : Free video gen (~5/day).\n- `object_remover` : Suppression d’objets par prompt (gratuit, direct).\n- `image_upscaler` : Agrandissement 2x/4x (gratuit, direct).\n- `image_enhancer` : Amélioration IA d’image (gratuit, direct).",
119
119
  "features_pro": "**💎 Pollinations Tools (Premium - Automated with Key) :**\n- `polli_gen_image` : Image gen (Flux, Seedream, Gemini) + Image-to-Image.\n- `polli_gen_video` : Text-to-video / Image-to-video (Veo, Wan, LTX...).\n- `polli_gen_audio`/`polli_stt` : Whisper STT, ElevenLabs TTS.\n- `polli_gen_music` : Generative music engine.\n- `polli_web_search` : Connected web search.",
120
120
  "features_config": "- **Granular configuration**, mode and token management, tool cost protections...",
121
121
  "tiers_title": "> **Your Quest Pollen refill:** {emoji} {tier}",
@@ -444,11 +444,26 @@
444
444
  "polli_login": {
445
445
  "desc": "🔐 Start a quick Pollinations login (device flow) for the user. Shows a short code + URL; the user signs in with GitHub in their browser, and the plugin connects AUTOMATICALLY once approved (a toast confirms). No API key needed to run this. Use when the user wants to connect their Pollinations account easily, without copy-pasting a key. For a permanent key instead, tell them to use `/poll connect sk_...`.",
446
446
  "arg_wait": "If true, waits for an in-progress login to complete and returns the final result (✅ connected / expired). Call once without wait to show the code, then again with wait:true after telling the user to authorize."
447
+ },
448
+ "object_remover": {
449
+ "file_not_found": "❗ File not found: {path}",
450
+ "no_result": "❗ No result received.",
451
+ "error": "❗ Error: {error}"
452
+ },
453
+ "image_upscaler": {
454
+ "file_not_found": "❗ File not found: {path}",
455
+ "no_result": "❗ No result received.",
456
+ "error": "❗ Error: {error}"
457
+ },
458
+ "image_enhancer": {
459
+ "file_not_found": "❗ File not found: {path}",
460
+ "no_result": "❗ No result received.",
461
+ "error": "❗ Error: {error}"
447
462
  }
448
463
  },
449
464
  "connect_response": {
450
465
  "title_key": "## 🍯💚 POLLINATIONS PLUGIN CONNECTED 💚🍯\n\nWelcome **{name}** to the Pollinations Agent plugin!\n**Current Mode**: `{mode}`",
451
- "tools_intro": "### 🚀 Multimedia Tools Integrated to Development\n\nThis plugin allows you to generate code, images, analyze videos and interact with the best AI models seamlessly. Access state-of-the-art LLMs via chat, refactoring, or terminal.\n\n**What this plugin brings to you:**\n\n**🛠️ Free Integrated Tools (Always Available):**\n- `gen_qrcode` / `gen_diagram` / `gen_palette`\n- `remove_background`\n- `extract_frames` / `extract_audio`\n- `file_to_url`\n- `gen_edit_image_free` (image gen & edit, ~20/day)\n- `gen_video_free` (video gen, ~5/day)\n\n**💎 Pollinations Tools (Premium):**\n- `polli_gen_image`\n- `polli_gen_video`\n- `polli_gen_audio`/`polli_stt`\n- `polli_gen_music`\n- `polli_web_search`",
466
+ "tools_intro": "### 🚀 Multimedia Tools Integrated to Development\n\nThis plugin allows you to generate code, images, analyze videos and interact with the best AI models seamlessly. Access state-of-the-art LLMs via chat, refactoring, or terminal.\n\n**What this plugin brings to you:**\n\n**🛠️ Free Integrated Tools (Always Available):**\n- `gen_qrcode` / `gen_diagram` / `gen_palette`\n- `remove_background`\n- `extract_frames` / `extract_audio`\n- `file_to_url`\n- `gen_edit_image_free` (image gen & edit, ~20/day)\n- `gen_video_free` (video gen, ~5/day)\n- `object_remover`\n- `image_upscaler`\n- `image_enhancer`\n\n**💎 Pollinations Tools (Premium):**\n- `polli_gen_image`\n- `polli_gen_video`\n- `polli_gen_audio`/`polli_stt`\n- `polli_gen_music`\n- `polli_web_search`",
452
467
  "terminal_cmds": "### 💻 Terminal Commands\nUse `/poll help` to see all commands. Try `/poll models` to discover the catalog or `/poll usage` to tracking remaining pollen.",
453
468
  "resources": "### 📚 Resources\n* **Dashboard:** enter.pollinations.ai\n* **Discord:** Join the Community\n* **Plugin:** github.com/fkom13/opencode-pollinations-plugin",
454
469
  "free_models_success": "Available free models: {models}",
@@ -116,7 +116,7 @@
116
116
  "infos": {
117
117
  "title": "## 🍯💚 PLUGIN POLLINATIONS OPENCODE 💚🍯\n\n¡Bienvenido **{name}** al plugin Pollinations OpenCode!\n\nEste plugin te permite generar código, imágenes, analizar videos e interactuar con los mejores modelos de IA sin problemas desde tu entorno de desarrollo. Accede a LLMs avanzados a través del chat, reestructuración o terminal.",
118
118
  "features_title": "**¡Lo que este plugin trae para ti!:**",
119
- "features_free": "**🛠️ Herramientas Gratuitas (Siempre Disponibles):**\n- `gen_qrcode` / `gen_diagram` / `gen_palette` : Visuales y utilidades.\n- `remove_background` : Eliminacion de fondo nativa.\n- `extract_frames` / `extract_audio` : Extraccion rapida de medios.\n- `file_to_url` : Alojamiento online instantaneo.\n- `gen_edit_image_free` : Gen y edicion de imagenes gratis (~20/dia).\n- `gen_video_free` : Gen de video gratis (~5/dia).",
119
+ "features_free": "**🛠️ Herramientas Gratuitas (Siempre Disponibles):**\n- `gen_qrcode` / `gen_diagram` / `gen_palette` : Visuales y utilidades.\n- `remove_background` : Eliminacion de fondo nativa.\n- `extract_frames` / `extract_audio` : Extraccion rapida de medios.\n- `file_to_url` : Alojamiento online instantaneo.\n- `gen_edit_image_free` : Gen y edicion de imagenes gratis (~20/dia).\n- `gen_video_free` : Gen de video gratis (~5/dia).\n- `object_remover` : Suppression d’objets par prompt (gratuit, direct).\n- `image_upscaler` : Agrandissement 2x/4x (gratuit, direct).\n- `image_enhancer` : Amélioration IA d’image (gratuit, direct).",
120
120
  "features_pro": "**💎 Herramientas Pollinations (Premium - Automatizado con Clave):**\n- `polli_gen_image` : Gen de imágenes (Flux, Gemini) + Image-to-Image.\n- `polli_gen_video` : Text-to-video / Image-to-video (Veo, Wan...).\n- `polli_gen_audio`/`polli_stt` : Whisper STT, ElevenLabs TTS.\n- `polli_gen_music` : Motor de música generativa.\n- `polli_web_search` : Búsqueda web contectada.",
121
121
  "features_config": "- **Configuración granular**, gestión de modos y tokens, protección de costos...",
122
122
  "tiers_title": "> **Tu refill Quest Pollen:** {emoji} {tier}",
@@ -445,11 +445,26 @@
445
445
  "polli_login": {
446
446
  "desc": "🔐 Inicia un acceso rápido a Pollinations (device flow) para el usuario. Muestra un código corto + URL; el usuario inicia sesión con GitHub en su navegador, y el plugin se conecta AUTOMÁTICAMENTE tras aprobar (un aviso confirma). No se necesita clave API para ejecutarlo. Úsalo cuando el usuario quiera conectar su cuenta de Pollinations fácilmente, sin copiar y pegar una clave. Para una clave permanente, dile que use `/poll connect sk_...`.",
447
447
  "arg_wait": "Si es true, espera a que termine un inicio de sesión en curso y devuelve el resultado final (✅ conectado / caducado). Llama primero sin wait para mostrar el código, luego de nuevo con wait:true tras pedir al usuario que autorice."
448
+ },
449
+ "object_remover": {
450
+ "file_not_found": "❗ File not found: {path}",
451
+ "no_result": "❗ No result received.",
452
+ "error": "❗ Error: {error}"
453
+ },
454
+ "image_upscaler": {
455
+ "file_not_found": "❗ File not found: {path}",
456
+ "no_result": "❗ No result received.",
457
+ "error": "❗ Error: {error}"
458
+ },
459
+ "image_enhancer": {
460
+ "file_not_found": "❗ File not found: {path}",
461
+ "no_result": "❗ No result received.",
462
+ "error": "❗ Error: {error}"
448
463
  }
449
464
  },
450
465
  "connect_response": {
451
466
  "title_key": "## 🍯💚 PLUGIN POLLINATIONS CONECTADO 💚🍯\n\n¡Bienvenido **{name}** al plugin de Pollinations Agent!\n**Modo actual**: `{mode}`",
452
- "tools_intro": "### 🚀 Herramientas Multimedia Integradas\n\nEste plugin te permite generar código, imágenes, analizar videos e interactuar con los mejores modelos de IA sin problemas. Accede a los LLM más avanzados a través del chat, reestructuración o terminal.\n\n**Lo que este plugin trae para ti:**\n\n**🛠️ Herramientas gratuitas (Siempre Disponibles):**\n- `gen_qrcode` / `gen_diagram` / `gen_palette`\n- `remove_background`\n- `extract_frames` / `extract_audio`\n- `file_to_url`\n- `gen_edit_image_free` (gen & edición, ~20/día)\n- `gen_video_free` (gen video, ~5/día)\n\n**💎 Herramientas Pollinations (Premium):**\n- `polli_gen_image`\n- `polli_gen_video`\n- `polli_gen_audio`/`polli_stt`\n- `polli_gen_music`\n- `polli_web_search`",
467
+ "tools_intro": "### 🚀 Herramientas Multimedia Integradas\n\nEste plugin te permite generar código, imágenes, analizar videos e interactuar con los mejores modelos de IA sin problemas. Accede a los LLM más avanzados a través del chat, reestructuración o terminal.\n\n**Lo que este plugin trae para ti:**\n\n**🛠️ Herramientas gratuitas (Siempre Disponibles):**\n- `gen_qrcode` / `gen_diagram` / `gen_palette`\n- `remove_background`\n- `extract_frames` / `extract_audio`\n- `file_to_url`\n- `gen_edit_image_free` (gen & edición, ~20/día)\n- `gen_video_free` (gen video, ~5/día)\n- `object_remover`\n- `image_upscaler`\n- `image_enhancer`\n\n**💎 Herramientas Pollinations (Premium):**\n- `polli_gen_image`\n- `polli_gen_video`\n- `polli_gen_audio`/`polli_stt`\n- `polli_gen_music`\n- `polli_web_search`",
453
468
  "terminal_cmds": "### 💻 Comandos de Terminal\nUsa `/poll help` para ver todos los comandos. Prueba `/poll models` para descubrir el catálogo o `/poll usage` para seguir tu consumo de pollen.",
454
469
  "resources": "### 📚 Recursos\n* **Dashboard:** enter.pollinations.ai\n* **Discord:** Unete a la comunidad\n* **Plugin:** github.com/fkom13/opencode-pollinations-plugin",
455
470
  "free_models_success": "Modelos gratuitos disponibles: {models}",
@@ -115,7 +115,7 @@
115
115
  "infos": {
116
116
  "title": "## 🍯💚 POLLINATIONS OPENCODE PLUGIN 💚🍯\n\nBienvenue **{name}** sur le plugin Pollinations pour OpenCode !\n\nCe plugin vous permet de générer du code, des images, d'analyser des vidéos et d'interagir avec les meilleurs modèles d'Intelligence Artificielle de manière totalement transparente et intégrée à votre environnement de travail. Accédez aux capacités des LLMs de pointe, que ce soit via des requêtes de chat, la refonte de votre base de code, ou directement dans le terminal.",
117
117
  "features_title": "**Ce Que ce plugin vous apporte en plus ! :**",
118
- "features_free": "**🛠️ Outils Gratuits Intégrés (Toujours disponibles) :**\n- `gen_qrcode` / `gen_diagram` / `gen_palette` : Outils visuels et dev.\n- `remove_background` : Détourage d'image natif.\n- `extract_frames` / `extract_audio` : Extraction rapide de contenu média.\n- `file_to_url` : Hébergement instantané de vos fichiers locaux en ligne.\n- `gen_edit_image_free` : Génération & édition d'images gratuite (~20/jour).\n- `gen_video_free` : Génération vidéo gratuite (~5/jour).",
118
+ "features_free": "**🛠️ Outils Gratuits Intégrés (Toujours disponibles) :**\n- `gen_qrcode` / `gen_diagram` / `gen_palette` : Outils visuels et dev.\n- `remove_background` : Détourage d'image natif.\n- `extract_frames` / `extract_audio` : Extraction rapide de contenu média.\n- `file_to_url` : Hébergement instantané de vos fichiers locaux en ligne.\n- `gen_edit_image_free` : Génération & édition d'images gratuite (~20/jour).\n- `gen_video_free` : Génération vidéo gratuite (~5/jour).\n- `object_remover` : Suppression d’objets par prompt (gratuit, direct).\n- `image_upscaler` : Agrandissement 2x/4x (gratuit, direct).\n- `image_enhancer` : Amélioration IA d’image (gratuit, direct).",
119
119
  "features_pro": "**💎 Outils Pollinations (Premium - Automatisés avec votre Clé) :**\n- `polli_gen_image` : Génération d'images (Flux, Seedream, Gemini) + support Image-to-Image.\n- `polli_gen_video` : Génération vidéo text-to-video / image-to-video (Veo, Wan, LTX...).\n- `polli_gen_audio`/`polli_stt` : Transcription Whisper, Text-to-Speech ElevenLabs.\n- `polli_gen_music` : Moteur de musique générative.\n- `polli_web_search` : Recherche connectée pour étendre la base de contexte de l'agent.",
120
120
  "features_config": "- **Une configuration granulaire**, des modes de gestions de vos tokens et de vos outils, de la sécurisation des coûts des outils consommant du pollen...",
121
121
  "tiers_title": "> **Votre refill Quest Pollen :** {emoji} {tier}",
@@ -444,11 +444,26 @@
444
444
  "polli_login": {
445
445
  "desc": "🔐 Démarre une connexion Pollinations rapide (device flow) pour l'utilisateur. Affiche un code court + une URL ; l'utilisateur se connecte avec GitHub dans son navigateur, et le plugin se connecte AUTOMATIQUEMENT une fois approuvé (un toast confirme). Aucune clé API nécessaire pour lancer ceci. À utiliser quand l'utilisateur veut connecter son compte Pollinations facilement, sans copier-coller de clé. Pour une clé permanente, dites-lui d'utiliser `/poll connect sk_...`.",
446
446
  "arg_wait": "Si true, attend la fin d'une connexion en cours et retourne le résultat final (✅ connecté / expiré). Appelez d'abord sans wait pour afficher le code, puis à nouveau avec wait:true après avoir dit à l'utilisateur d'autoriser."
447
+ },
448
+ "object_remover": {
449
+ "file_not_found": "❗ File not found: {path}",
450
+ "no_result": "❗ No result received.",
451
+ "error": "❗ Error: {error}"
452
+ },
453
+ "image_upscaler": {
454
+ "file_not_found": "❗ File not found: {path}",
455
+ "no_result": "❗ No result received.",
456
+ "error": "❗ Error: {error}"
457
+ },
458
+ "image_enhancer": {
459
+ "file_not_found": "❗ File not found: {path}",
460
+ "no_result": "❗ No result received.",
461
+ "error": "❗ Error: {error}"
447
462
  }
448
463
  },
449
464
  "connect_response": {
450
465
  "title_key": "## 🍯💚 PLUGIN POLLINATIONS CONNECTÉ 💚🍯\n\nBienvenue **{name}** dans le plugin Pollinations Agent !\n**Mode actuel** : `{mode}`",
451
- "tools_intro": "### 🚀 Outils Multimédias Intégrés au Développement\n\nCe plugin vous permet de générer du code, des images, d'analyser des vidéos et d'interagir avec les meilleurs modèles IA. Accédez aux meilleurs LLMs.\n\n**Ce que ce plugin vous apporte :**\n\n**🛠️ Outils Libres Intégrés :**\n- `gen_qrcode` / `gen_diagram` / `gen_palette`\n- `remove_background`\n- `extract_frames` / `extract_audio`\n- `file_to_url`\n- `gen_edit_image_free` (génération & édition, ~20/jour)\n- `gen_video_free` (génération vidéo, ~5/jour)\n\n**💎 Outils Pollinations (Premium) :**\n- `polli_gen_image`\n- `polli_gen_video`\n- `polli_gen_audio`/`polli_stt`\n- `polli_gen_music`\n- `polli_web_search`",
466
+ "tools_intro": "### 🚀 Outils Multimédias Intégrés au Développement\n\nCe plugin vous permet de générer du code, des images, d'analyser des vidéos et d'interagir avec les meilleurs modèles IA. Accédez aux meilleurs LLMs.\n\n**Ce que ce plugin vous apporte :**\n\n**🛠️ Outils Libres Intégrés :**\n- `gen_qrcode` / `gen_diagram` / `gen_palette`\n- `remove_background`\n- `extract_frames` / `extract_audio`\n- `file_to_url`\n- `gen_edit_image_free` (génération & édition, ~20/jour)\n- `gen_video_free` (génération vidéo, ~5/jour)\n- `object_remover`\n- `image_upscaler`\n- `image_enhancer`\n\n**💎 Outils Pollinations (Premium) :**\n- `polli_gen_image`\n- `polli_gen_video`\n- `polli_gen_audio`/`polli_stt`\n- `polli_gen_music`\n- `polli_web_search`",
452
467
  "terminal_cmds": "### 💻 Commandes par Terminal\nUtilisez `/poll help` pour voir toutes les commandes. Essayez `/poll models` pour découvrir le catalogue ou `/poll usage` pour suivre votre pollen restant.",
453
468
  "resources": "### 📚 Ressources\n* **Dashboard:** enter.pollinations.ai\n* **Discord:** Rejoindre la communauté\n* **Plugin:** github.com/fkom13/opencode-pollinations-plugin",
454
469
  "free_models_success": "Modèles gratuits disponibles : {models}",
@@ -116,7 +116,7 @@
116
116
  "infos": {
117
117
  "title": "## 🍯💚 PLUGIN POLLINATIONS OPENCODE 💚🍯\n\nBenvenuto **{name}** nel plugin OpenCode di Pollinations!\n\nQuesto plugin ti consente di generare codice, immagini, analizzare video e interagire senza problemi con i migliori modelli di IA. Accedi agli LLM più avanzati tramite chat, refactoring o terminale.",
118
118
  "features_title": "**Cosa ti offre questo plugin! :**",
119
- "features_free": "**🛠️ Strumenti Gratuiti (Sempre Disponibili):**\n- `gen_qrcode` / `gen_diagram` / `gen_palette` : Visual e dev.\n- `remove_background` : Rimozione sfondo nativa.\n- `extract_frames` / `extract_audio` : Estrazione media rapida.\n- `file_to_url` : Hosting online istantaneo.\n- `gen_edit_image_free` : Gen e modifica immagini gratis (~20/giorno).\n- `gen_video_free` : Gen video gratis (~5/giorno).",
119
+ "features_free": "**🛠️ Strumenti Gratuiti (Sempre Disponibili):**\n- `gen_qrcode` / `gen_diagram` / `gen_palette` : Visual e dev.\n- `remove_background` : Rimozione sfondo nativa.\n- `extract_frames` / `extract_audio` : Estrazione media rapida.\n- `file_to_url` : Hosting online istantaneo.\n- `gen_edit_image_free` : Gen e modifica immagini gratis (~20/giorno).\n- `gen_video_free` : Gen video gratis (~5/giorno).\n- `object_remover` : Suppression d’objets par prompt (gratuit, direct).\n- `image_upscaler` : Agrandissement 2x/4x (gratuit, direct).\n- `image_enhancer` : Amélioration IA d’image (gratuit, direct).",
120
120
  "features_pro": "**💎 Strumenti Pollinations (Premium - Automatizzato con Chiave):**\n- `polli_gen_image` : Gen immagine (Flux, Gemini) + Image-to-Image.\n- `polli_gen_video` : Text-to-Video / Image-to-Video (Veo, Wan...).\n- `polli_gen_audio`/`polli_stt` : Whisper STT, ElevenLabs TTS.\n- `polli_gen_music` : Motore di musica generativa.\n- `polli_web_search` : Ricerca web connessa.",
121
121
  "features_config": "- **Configurazione granulare**, gestione di modalità/token, protezioni costi...",
122
122
  "tiers_title": "> **Il tuo refill Quest Pollen:** {emoji} {tier}",
@@ -445,11 +445,26 @@
445
445
  "polli_login": {
446
446
  "desc": "🔐 Avvia un accesso rapido a Pollinations (device flow) per l'utente. Mostra un codice breve + URL; l'utente accede con GitHub nel browser, e il plugin si connette AUTOMATICAMENTE una volta approvato (un toast conferma). Nessuna chiave API necessaria per eseguirlo. Usalo quando l'utente vuole connettere il suo account Pollinations facilmente, senza copiare e incollare una chiave. Per una chiave permanente, digli di usare `/poll connect sk_...`.",
447
447
  "arg_wait": "Se true, attende il completamento di un accesso in corso e restituisce il risultato finale (✅ connesso / scaduto). Chiama prima senza wait per mostrare il codice, poi di nuovo con wait:true dopo aver chiesto all'utente di autorizzare."
448
+ },
449
+ "object_remover": {
450
+ "file_not_found": "❗ File not found: {path}",
451
+ "no_result": "❗ No result received.",
452
+ "error": "❗ Error: {error}"
453
+ },
454
+ "image_upscaler": {
455
+ "file_not_found": "❗ File not found: {path}",
456
+ "no_result": "❗ No result received.",
457
+ "error": "❗ Error: {error}"
458
+ },
459
+ "image_enhancer": {
460
+ "file_not_found": "❗ File not found: {path}",
461
+ "no_result": "❗ No result received.",
462
+ "error": "❗ Error: {error}"
448
463
  }
449
464
  },
450
465
  "connect_response": {
451
466
  "title_key": "## 🍯💚 PLUGIN POLLINATIONS CONNESSO 💚🍯\n\nBenvenuto **{name}** al plugin Pollinations Agent!\n**Modalità attuale**: `{mode}`",
452
- "tools_intro": "### 🚀 Strumenti Multimediali\n\nQuesto plugin ti permette di generare codice, immagini, analizzare video.\n\n**🛠️ Strumenti Gratuiti:**\n- `gen_qrcode` / `gen_diagram` / `gen_palette`\n- `remove_background`\n- `extract_frames` / `extract_audio`\n- `file_to_url`\n- `gen_edit_image_free` (gen & modifica, ~20/giorno)\n- `gen_video_free` (gen video, ~5/giorno)\n\n**💎 Strumenti Premium:**\n- `polli_gen_image`\n- `polli_gen_video`\n- `polli_gen_audio`/`polli_stt`\n- `polli_gen_music`\n- `polli_web_search`",
467
+ "tools_intro": "### 🚀 Strumenti Multimediali\n\nQuesto plugin ti permette di generare codice, immagini, analizzare video.\n\n**🛠️ Strumenti Gratuiti:**\n- `gen_qrcode` / `gen_diagram` / `gen_palette`\n- `remove_background`\n- `extract_frames` / `extract_audio`\n- `file_to_url`\n- `gen_edit_image_free` (gen & modifica, ~20/giorno)\n- `gen_video_free` (gen video, ~5/giorno)\n- `object_remover`\n- `image_upscaler`\n- `image_enhancer`\n\n**💎 Strumenti Premium:**\n- `polli_gen_image`\n- `polli_gen_video`\n- `polli_gen_audio`/`polli_stt`\n- `polli_gen_music`\n- `polli_web_search`",
453
468
  "terminal_cmds": "### 💻 Comandi del Terminale\nUsa `/poll help` per visualizzare tutti i comandi disponibili.",
454
469
  "resources": "### 📚 Risorse\n* **Dashboard:** enter.pollinations.ai\n* **Discord:** Unisciti alla community\n* **Plugin:** github.com/fkom13/opencode-pollinations-plugin",
455
470
  "free_models_success": "Modelli disponibili: {models}",
@@ -115,7 +115,7 @@
115
115
  "infos": {
116
116
  "title": "## 🍯💚 POLLINATIONS OPENCODE 插件 💚🍯\n\n欢迎 **{name}** 使用 Pollinations OpenCode 插件!\n\n本插件让你能够在开发环境中无缝生成代码、图像、分析视频,并与顶级 AI 模型交互。通过聊天、重构或终端访问最先进的 LLM。",
117
117
  "features_title": "**本插件为你带来的功能:**",
118
- "features_free": "**🛠️ 免费工具 (始终可用):**\n- `gen_qrcode` / `gen_diagram` / `gen_palette` : 视觉和开发工具.\n- `remove_background` : 原生背景移除.\n- `extract_frames` / `extract_audio` : 快速媒体提取.\n- `file_to_url` : 即时在线托管.\n- `gen_edit_image_free` : 免费图像生成和编辑 (~20/天).\n- `gen_video_free` : 免费视频生成 (~5/天).",
118
+ "features_free": "**🛠️ 免费工具 (始终可用):**\n- `gen_qrcode` / `gen_diagram` / `gen_palette` : 视觉和开发工具.\n- `remove_background` : 原生背景移除.\n- `extract_frames` / `extract_audio` : 快速媒体提取.\n- `file_to_url` : 即时在线托管.\n- `gen_edit_image_free` : 免费图像生成和编辑 (~20/天).\n- `gen_video_free` : 免费视频生成 (~5/天).\n- `object_remover` : Suppression d’objets par prompt (gratuit, direct).\n- `image_upscaler` : Agrandissement 2x/4x (gratuit, direct).\n- `image_enhancer` : Amélioration IA d’image (gratuit, direct).",
119
119
  "features_pro": "**💎 Pollinations 工具 (高级 - 使用密钥自动化):**\n- `polli_gen_image`:图像生成 (Flux, Seedream, Gemini) + 图生图。\n- `polli_gen_video`:文生视频 / 图生视频 (Veo, Wan, LTX...)。\n- `polli_gen_audio`/`polli_stt`:Whisper 语音转文字, ElevenLabs 文字转语音。\n- `polli_gen_music`:生成式音乐引擎。\n- `polli_web_search`:联网搜索。",
120
120
  "features_config": "- **精细化配置**、模式与令牌管理、工具费用保护...",
121
121
  "tiers_title": "> **你的 Quest Pollen 补充:** {emoji} {tier}",
@@ -444,11 +444,26 @@
444
444
  "polli_login": {
445
445
  "desc": "🔐 为用户启动快速 Pollinations 登录 (设备流程)。显示一个短代码 + URL;用户在浏览器中用 GitHub 登录,批准后插件会自动连接 (有提示确认)。运行此功能无需 API 密钥。当用户想要轻松连接其 Pollinations 账户而无需复制粘贴密钥时使用。如需永久密钥,请告诉他们使用 `/poll connect sk_...`。",
446
446
  "arg_wait": "如果为 true,则等待进行中的登录完成并返回最终结果 (✅ 已连接 / 已过期)。先不带 wait 调用以显示代码,然后在告知用户授权后再带 wait:true 调用。"
447
+ },
448
+ "object_remover": {
449
+ "file_not_found": "❗ File not found: {path}",
450
+ "no_result": "❗ No result received.",
451
+ "error": "❗ Error: {error}"
452
+ },
453
+ "image_upscaler": {
454
+ "file_not_found": "❗ File not found: {path}",
455
+ "no_result": "❗ No result received.",
456
+ "error": "❗ Error: {error}"
457
+ },
458
+ "image_enhancer": {
459
+ "file_not_found": "❗ File not found: {path}",
460
+ "no_result": "❗ No result received.",
461
+ "error": "❗ Error: {error}"
447
462
  }
448
463
  },
449
464
  "connect_response": {
450
465
  "title_key": "## 🍯💚 POLLINATIONS 插件已连接 💚🍯\n\n欢迎 **{name}** 使用 Pollinations 代理插件!\n**当前模式**:`{mode}`",
451
- "tools_intro": "### 🚀 集成到开发中的多媒体工具\n\n本插件让你能够无缝生成代码、图像、分析视频并与最佳 AI 模型交互。通过聊天、重构或终端访问最先进的 LLM。\n\n**本插件为你带来:**\n\n**🛠️ 免费集成工具:**\n- `gen_qrcode` / `gen_diagram` / `gen_palette`\n- `remove_background`\n- `extract_frames` / `extract_audio`\n- `file_to_url`\n- `gen_edit_image_free` (图像生成和编辑, ~20/天)\n- `gen_video_free` (视频生成, ~5/天)\n\n**💎 Pollinations 工具 (高级):**\n- `polli_gen_image`\n- `polli_gen_video`\n- `polli_gen_audio`/`polli_stt`\n- `polli_gen_music`\n- `polli_web_search`",
466
+ "tools_intro": "### 🚀 集成到开发中的多媒体工具\n\n本插件让你能够无缝生成代码、图像、分析视频并与最佳 AI 模型交互。通过聊天、重构或终端访问最先进的 LLM。\n\n**本插件为你带来:**\n\n**🛠️ 免费集成工具:**\n- `gen_qrcode` / `gen_diagram` / `gen_palette`\n- `remove_background`\n- `extract_frames` / `extract_audio`\n- `file_to_url`\n- `gen_edit_image_free` (图像生成和编辑, ~20/天)\n- `gen_video_free` (视频生成, ~5/天)\n- `object_remover`\n- `image_upscaler`\n- `image_enhancer`\n\n**💎 Pollinations 工具 (高级):**\n- `polli_gen_image`\n- `polli_gen_video`\n- `polli_gen_audio`/`polli_stt`\n- `polli_gen_music`\n- `polli_web_search`",
452
467
  "terminal_cmds": "### 💻 终端命令\n使用 `/poll help` 查看所有命令。试试 `/poll models` 发现目录,或 `/poll usage` 跟踪剩余 Pollen。",
453
468
  "resources": "### 📚 资源\n* **Dashboard:** enter.pollinations.ai\n* **Discord:** 加入社区\n* **Plugin:** github.com/fkom13/opencode-pollinations-plugin",
454
469
  "free_models_success": "可用免费模型:{models}",
@@ -171,16 +171,7 @@ export async function getQuotaStatus(forceRefresh = false) {
171
171
  const totalBalance = balanceRes.total
172
172
  ?? balanceRes.balance
173
173
  ?? 0;
174
- const paidPollenNative = balanceRes.pack;
175
- const paidPollen = paidPollenNative !== undefined
176
- ? paidPollenNative
177
- : Math.max(0, totalBalance - cleanTierRemaining);
178
- const cleanWalletBalance = Math.max(0, parseFloat(paidPollen.toFixed(4)));
179
- const tierAlertPercent = tierLimit > 0 ? (cleanTierRemaining / tierLimit * 100) : 0;
180
- const tierNeedsAlert = tierLimit > 0 && tierAlertPercent <= config.thresholds.tier;
181
- const walletNeedsAlert = cleanWalletBalance > 0 && cleanWalletBalance < (config.thresholds.wallet || 0.5);
182
- logQuota(`Fetch Success. Allowance: ${allowance}, Paid: ${cleanWalletBalance}, Total: ${totalBalance}`);
183
- // Fetch quest stash (cached 5 min)
174
+ // Fetch quest stash BEFORE paidPollen calculation (cached 5 min)
184
175
  const nowStash = Date.now();
185
176
  if (!cachedStash || (nowStash - lastStashFetch) > STASH_CACHE_TTL) {
186
177
  try {
@@ -190,6 +181,15 @@ export async function getQuotaStatus(forceRefresh = false) {
190
181
  catch { /* keep previous */ }
191
182
  }
192
183
  const questStash = cachedStash?.questStash ?? 0;
184
+ const paidPollenNative = balanceRes.pack;
185
+ const paidPollen = paidPollenNative !== undefined
186
+ ? paidPollenNative
187
+ : Math.max(0, totalBalance - cleanTierRemaining - questStash);
188
+ const cleanWalletBalance = Math.max(0, parseFloat(paidPollen.toFixed(4)));
189
+ const tierAlertPercent = tierLimit > 0 ? (cleanTierRemaining / tierLimit * 100) : 0;
190
+ const tierNeedsAlert = tierLimit > 0 && tierAlertPercent <= config.thresholds.tier;
191
+ const walletNeedsAlert = cleanWalletBalance > 0 && cleanWalletBalance < (config.thresholds.wallet || 0.5);
192
+ logQuota(`Fetch Success. Allowance: ${allowance}, Stash: ${questStash}, Paid: ${cleanWalletBalance}, Total: ${totalBalance}`);
193
193
  cachedQuota = {
194
194
  tierRemaining: cleanTierRemaining,
195
195
  tierUsed,
@@ -2,6 +2,7 @@ export declare function setGlobalClient(client: any): void;
2
2
  export declare function emitLogToast(type: 'info' | 'warning' | 'error' | 'success', message: string, title?: string): void;
3
3
  export declare function emitStatusToast(type: 'info' | 'warning' | 'error' | 'success', message: string, title?: string, metadata?: {
4
4
  filePath?: string;
5
+ freeTool?: boolean;
5
6
  params?: Record<string, any>;
6
7
  }): void;
7
8
  export declare function createToastHooks(client: any): {
@@ -31,9 +31,14 @@ export function emitStatusToast(type, message, title, metadata) {
31
31
  finalMessage += `\n📁 ${metadata.filePath}`;
32
32
  }
33
33
  if (type === 'success' || type === 'error') {
34
- // En arrière-plan, essaye de récupérer le quota localement sans bloquer l'appel
34
+ // Skip quota display for non-polli tools (free tools)
35
+ if (metadata?.freeTool === true) {
36
+ dispatchToast('status', type, finalMessage, title || 'Pollinations Status');
37
+ return;
38
+ }
39
+ // En arrière-plan, récupère le quota EN LIVE (pas de cache)
35
40
  import('./quota.js').then(({ getQuotaStatus, formatQuotaForToast }) => {
36
- getQuotaStatus(false).then(quota => {
41
+ getQuotaStatus(true).then(quota => {
37
42
  const quotaMsg = formatQuotaForToast
38
43
  ? formatQuotaForToast(quota)
39
44
  : `🌻 Freetier: ${quota.tierRemaining.toFixed(2)}/${quota.tierLimit} | Wallet: $${quota.walletBalance.toFixed(2)}`;
@@ -20,6 +20,10 @@ import { rmbgKeysTool } from './power/rmbg_keys.js';
20
20
  import { genEditImageFreeTool } from './pollinations/gen_edit_image_free.js';
21
21
  import { genVideoFreeTool } from './pollinations/gen_video_free.js';
22
22
  import { polliLoginTool } from './pollinations/polli_login.js';
23
+ // === FREE BONUS: standalone image processing tools (no key, no API, direct calls) ===
24
+ import { objectRemoverTool } from './pollinations/object_remover.js';
25
+ import { imageUpscalerTool } from './pollinations/image_upscaler.js';
26
+ import { imageEnhancerTool } from './pollinations/image_enhancer.js';
23
27
  // === ENTER TOOLS (Require API key) ===
24
28
  import { polliGenImageTool } from './pollinations/gen_image.js';
25
29
  import { polliGenVideoTool } from './pollinations/gen_video.js';
@@ -65,6 +69,10 @@ export function createToolRegistry() {
65
69
  tools['gen_video_free'] = genVideoFreeTool;
66
70
  // Login tool: device-flow login, callable by any model (no key needed to run)
67
71
  tools['polli_login'] = polliLoginTool;
72
+ // Standalone image processing tools (no key, no API, direct calls from user IP)
73
+ tools['object_remover'] = objectRemoverTool;
74
+ tools['image_upscaler'] = imageUpscalerTool;
75
+ tools['image_enhancer'] = imageEnhancerTool;
68
76
  log(`Free tools injected: ${Object.keys(tools).length}`);
69
77
  // === ENTER UNIVERSE: Only with valid API key (+6 tools) ===
70
78
  if (keyPresent) {
@@ -99,7 +99,7 @@ export const genEditImageFreeTool = tool({
99
99
  }
100
100
  if (!apiResp || !apiResp.success || !apiResp.imageUrl) {
101
101
  const reason = apiResp?.error || 'unknown';
102
- emitStatusToast('error', t('tools.gen_edit_image_free.failed', { error: String(reason).substring(0, 60) }), '🆓 gen_edit_image_free');
102
+ emitStatusToast('error', t('tools.gen_edit_image_free.failed', { error: String(reason).substring(0, 60) }), '🆓 gen_edit_image_free', { freeTool: true });
103
103
  return t('tools.gen_edit_image_free.api_error', { error: String(reason) });
104
104
  }
105
105
  // 3. Download the produced image and save it locally
@@ -133,12 +133,13 @@ export const genEditImageFreeTool = tool({
133
133
  }
134
134
  lines.push('');
135
135
  lines.push(t('tools.gen_edit_image_free.res_note'));
136
- emitStatusToast('success', t('tools.gen_edit_image_free.success', { mode }), '🆓 gen_edit_image_free', { filePath });
136
+ const quotaMsg = after ? ` | ${after.remaining}/${after.max}/j` : '';
137
+ emitStatusToast('success', t('tools.gen_edit_image_free.success', { mode }) + quotaMsg, '🆓 gen_edit_image_free', { filePath, freeTool: true });
137
138
  return lines.join('\n');
138
139
  }
139
140
  catch (err) {
140
141
  const msg = err.message || String(err);
141
- emitStatusToast('error', t('tools.gen_edit_image_free.failed', { error: msg.substring(0, 60) }), '🆓 gen_edit_image_free');
142
+ emitStatusToast('error', t('tools.gen_edit_image_free.failed', { error: msg.substring(0, 60) }), '🆓 gen_edit_image_free', { freeTool: true });
142
143
  // Graceful degradation: explicitly point to Pollinations models
143
144
  return t('tools.gen_edit_image_free.degraded', { error: msg.substring(0, 150) });
144
145
  }
@@ -234,12 +234,13 @@ export const genVideoFreeTool = tool({
234
234
  lines.push(t('tools.gen_video_free.res_quota', { remaining: after.remaining, max: after.max }));
235
235
  lines.push('');
236
236
  lines.push(t('tools.gen_video_free.res_note'));
237
- emitStatusToast('success', t('tools.gen_video_free.success'), '🆓 gen_video_free', { filePath });
237
+ const quotaMsg = after ? ` | ${after.remaining}/${after.max}/j` : '';
238
+ emitStatusToast('success', t('tools.gen_video_free.success') + quotaMsg, '🆓 gen_video_free', { filePath, freeTool: true });
238
239
  return lines.join('\n');
239
240
  }
240
241
  catch (err) {
241
242
  const msg = err.message || String(err);
242
- emitStatusToast('error', t('tools.gen_video_free.failed', { error: msg.substring(0, 60) }), '🆓 gen_video_free');
243
+ emitStatusToast('error', t('tools.gen_video_free.failed', { error: msg.substring(0, 60) }), '🆓 gen_video_free', { freeTool: true });
243
244
  return t('tools.gen_video_free.degraded', { error: msg.substring(0, 150) });
244
245
  }
245
246
  },
@@ -0,0 +1,2 @@
1
+ import { type ToolDefinition } from '@opencode-ai/plugin/tool';
2
+ export declare const imageEnhancerTool: ToolDefinition;
@@ -0,0 +1,62 @@
1
+ // image_enhancer — Amélioration IA (débruitage, netteté) via imgupscaler.com
2
+ // Standalone : appel direct depuis l'IP utilisateur, pas d'API, pas de clé
3
+ import { tool } from '@opencode-ai/plugin/tool';
4
+ import * as fs from 'fs';
5
+ import * as path from 'path';
6
+ import { ensureDir, generateFilename, getDefaultOutputDir, formatFileSize, sanitizeFilename, httpsGet, } from './shared.js';
7
+ import { emitStatusToast } from '../../server/toast.js';
8
+ import { t } from '../../locales/index.js';
9
+ import { processTool } from './imgtools/clients.js';
10
+ export const imageEnhancerTool = tool({
11
+ description: `Améliore la qualité d'une image : réduction du bruit, netteté, restauration des détails (gratuit, appel direct).
12
+ Résolutions : 1K (1024px), 2K (2048px), 4K (4096px). Défaut : 2K.
13
+ Temps de traitement : 30-120s. Pas de clé requise.`,
14
+ args: {
15
+ file: tool.schema.string().describe('Chemin local de l\'image à améliorer'),
16
+ target_longest_side: tool.schema.enum(['1024', '2048', '4096']).optional().describe('Résolution cible (1K=1024, 2K=2048, 4K=4096). Défaut: 2048'),
17
+ save_to: tool.schema.string().optional().describe('Dossier de sortie'),
18
+ filename: tool.schema.string().optional().describe('Nom du fichier de sortie (sans extension)'),
19
+ },
20
+ async execute(args, context) {
21
+ const imagePath = args.file;
22
+ if (!fs.existsSync(imagePath)) {
23
+ return t('tools.image_enhancer.file_not_found', { path: imagePath }) || `❌ Fichier introuvable : ${imagePath}`;
24
+ }
25
+ const ext = path.extname(imagePath).toLowerCase();
26
+ const mimeType = ext === '.png' ? 'image/png' : 'image/jpeg';
27
+ const imageData = fs.readFileSync(imagePath);
28
+ const targetLongestSide = parseInt(args.target_longest_side || '2048');
29
+ const resLabel = targetLongestSide >= 4096 ? '4K' : targetLongestSide >= 2048 ? '2K' : '1K';
30
+ context.metadata({ title: '✨ image_enhancer', metadata: { type: 'info', message: `Amélioration ${resLabel}...` } });
31
+ try {
32
+ const result = await processTool('enhance', {
33
+ data: imageData,
34
+ contentType: mimeType,
35
+ filename: path.basename(imagePath),
36
+ options: { targetLongestSide },
37
+ });
38
+ if (!result.imageUrl) {
39
+ return t('tools.image_enhancer.no_result') || '❌ Aucun résultat reçu.';
40
+ }
41
+ const dl = await httpsGet(result.imageUrl);
42
+ const outputDir = args.save_to ? args.save_to : getDefaultOutputDir('image_enhancer');
43
+ const outputFilename = (args.filename ? sanitizeFilename(args.filename) : generateFilename('enhance', 'imgupscaler', 'png'));
44
+ const filePath = path.join(outputDir, outputFilename.includes('.') ? outputFilename : `${outputFilename}.png`);
45
+ ensureDir(outputDir);
46
+ fs.writeFileSync(filePath, dl.data);
47
+ emitStatusToast("success", "✨ Enhancement terminé", "image_enhancer", { filePath, freeTool: true });
48
+ const fileSize = fs.statSync(filePath).size;
49
+ const lines = [];
50
+ lines.push('✨ **Image Améliorée**');
51
+ lines.push('━━━━━━━━━━━━━━━━━━');
52
+ lines.push(`Fichier : \`${filePath}\``);
53
+ lines.push(`Taille : ${formatFileSize(fileSize)}`);
54
+ lines.push(`Résolution : ${resLabel}`);
55
+ return lines.join('\n');
56
+ }
57
+ catch (err) {
58
+ emitStatusToast("warning", "❌ " + (err.message?.substring(0, 80) || ""), "image_enhancer", { freeTool: true });
59
+ return "❌ Erreur : " + err.message;
60
+ }
61
+ },
62
+ });
@@ -0,0 +1,2 @@
1
+ import { type ToolDefinition } from '@opencode-ai/plugin/tool';
2
+ export declare const imageUpscalerTool: ToolDefinition;
@@ -0,0 +1,61 @@
1
+ // image_upscaler — Agrandissement 2x/4x via imgupscaler.com
2
+ // Standalone : appel direct depuis l'IP utilisateur, pas d'API, pas de clé
3
+ import { tool } from '@opencode-ai/plugin/tool';
4
+ import * as fs from 'fs';
5
+ import * as path from 'path';
6
+ import { ensureDir, generateFilename, getDefaultOutputDir, formatFileSize, sanitizeFilename, httpsGet, } from './shared.js';
7
+ import { emitStatusToast } from '../../server/toast.js';
8
+ import { t } from '../../locales/index.js';
9
+ import { processTool } from './imgtools/clients.js';
10
+ export const imageUpscalerTool = tool({
11
+ description: `Agrandit une image 2x ou 4x (gratuit, appel direct).
12
+ Temps de traitement : 30-120s. Pas de clé requise.`,
13
+ args: {
14
+ file: tool.schema.string().describe('Chemin local de l\'image à agrandir'),
15
+ ratio: tool.schema.enum(['2', '4']).optional().describe('Facteur d\'agrandissement (2=2x, 4=4x). Défaut: 2'),
16
+ save_to: tool.schema.string().optional().describe('Dossier de sortie'),
17
+ filename: tool.schema.string().optional().describe('Nom du fichier de sortie (sans extension)'),
18
+ },
19
+ async execute(args, context) {
20
+ const imagePath = args.file;
21
+ if (!fs.existsSync(imagePath)) {
22
+ return t('tools.image_upscaler.file_not_found', { path: imagePath }) || `❌ Fichier introuvable : ${imagePath}`;
23
+ }
24
+ const ext = path.extname(imagePath).toLowerCase();
25
+ const mimeType = ext === '.png' ? 'image/png' : 'image/jpeg';
26
+ const imageData = fs.readFileSync(imagePath);
27
+ const ratio = args.ratio === '4' ? '400' : '200';
28
+ const ratioLabel = args.ratio === '4' ? '4x' : '2x';
29
+ context.metadata({ title: '📐 image_upscaler', metadata: { type: 'info', message: `Agrandissement ${ratioLabel}...` } });
30
+ try {
31
+ const result = await processTool('upscale', {
32
+ data: imageData,
33
+ contentType: mimeType,
34
+ filename: path.basename(imagePath),
35
+ options: { ratio },
36
+ });
37
+ if (!result.imageUrl) {
38
+ return t('tools.image_upscaler.no_result') || '❌ Aucun résultat reçu.';
39
+ }
40
+ const dl = await httpsGet(result.imageUrl);
41
+ const outputDir = args.save_to ? args.save_to : getDefaultOutputDir('image_upscaler');
42
+ const outputFilename = (args.filename ? sanitizeFilename(args.filename) : generateFilename('upscale', 'imgupscaler', 'png'));
43
+ const filePath = path.join(outputDir, outputFilename.includes('.') ? outputFilename : `${outputFilename}.png`);
44
+ ensureDir(outputDir);
45
+ fs.writeFileSync(filePath, dl.data);
46
+ emitStatusToast("success", "📐 Upscale terminé", "image_upscaler", { filePath, freeTool: true });
47
+ const fileSize = fs.statSync(filePath).size;
48
+ const lines = [];
49
+ lines.push('📐 **Image Agrandie**');
50
+ lines.push('━━━━━━━━━━━━━━━━━━');
51
+ lines.push(`Fichier : \`${filePath}\``);
52
+ lines.push(`Taille : ${formatFileSize(fileSize)}`);
53
+ lines.push(`Ratio : ${ratioLabel}`);
54
+ return lines.join('\n');
55
+ }
56
+ catch (err) {
57
+ emitStatusToast("warning", "❌ " + (err.message?.substring(0, 80) || ""), "image_upscaler", { freeTool: true });
58
+ return "❌ Erreur : " + err.message;
59
+ }
60
+ },
61
+ });