opencode-pollinations-plugin 6.1.0-beta.2 → 6.1.0-beta.22

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 (96) hide show
  1. package/README.md +242 -62
  2. package/dist/index.js +68 -159
  3. package/dist/server/commands.d.ts +6 -0
  4. package/dist/server/commands.js +400 -71
  5. package/dist/server/config.d.ts +32 -23
  6. package/dist/server/config.js +183 -99
  7. package/dist/server/connect-response.d.ts +2 -0
  8. package/dist/server/connect-response.js +141 -0
  9. package/dist/server/generate-config.d.ts +3 -30
  10. package/dist/server/generate-config.js +164 -106
  11. package/dist/server/index.d.ts +2 -1
  12. package/dist/server/index.js +124 -149
  13. package/dist/server/logger.d.ts +8 -0
  14. package/dist/server/logger.js +36 -0
  15. package/dist/server/models/cache.d.ts +35 -0
  16. package/dist/server/models/cache.js +160 -0
  17. package/dist/server/models/fetcher.d.ts +18 -0
  18. package/dist/server/models/fetcher.js +150 -0
  19. package/dist/server/models/index.d.ts +6 -0
  20. package/dist/server/models/index.js +5 -0
  21. package/dist/server/models/manual.d.ts +15 -0
  22. package/dist/server/models/manual.js +92 -0
  23. package/dist/server/models/types.d.ts +55 -0
  24. package/dist/server/models/types.js +7 -0
  25. package/dist/server/models/worker.d.ts +21 -0
  26. package/dist/server/models/worker.js +97 -0
  27. package/dist/server/pollinations-api.d.ts +11 -0
  28. package/dist/server/pollinations-api.js +21 -8
  29. package/dist/server/proxy.js +223 -160
  30. package/dist/server/quota.d.ts +2 -0
  31. package/dist/server/quota.js +89 -86
  32. package/dist/server/scripts/pollinations_pricing.d.ts +8 -0
  33. package/dist/server/scripts/pollinations_pricing.js +246 -0
  34. package/dist/server/scripts/test_cost_endpoints.d.ts +1 -0
  35. package/dist/server/scripts/test_cost_endpoints.js +61 -0
  36. package/dist/server/scripts/test_dynamic_pricing.d.ts +1 -0
  37. package/dist/server/scripts/test_dynamic_pricing.js +39 -0
  38. package/dist/server/scripts/test_freetier_audit.d.ts +11 -0
  39. package/dist/server/scripts/test_freetier_audit.js +215 -0
  40. package/dist/server/scripts/test_parallel_cost.d.ts +1 -0
  41. package/dist/server/scripts/test_parallel_cost.js +104 -0
  42. package/dist/server/toast.d.ts +7 -1
  43. package/dist/server/toast.js +43 -10
  44. package/dist/tools/design/gen_diagram.d.ts +2 -0
  45. package/dist/tools/design/gen_diagram.js +94 -0
  46. package/dist/tools/design/gen_palette.d.ts +2 -0
  47. package/dist/tools/design/gen_palette.js +182 -0
  48. package/dist/tools/design/gen_qrcode.d.ts +2 -0
  49. package/dist/tools/design/gen_qrcode.js +50 -0
  50. package/dist/tools/ffmpeg.d.ts +24 -0
  51. package/dist/tools/ffmpeg.js +54 -0
  52. package/dist/tools/index.d.ts +24 -0
  53. package/dist/tools/index.js +83 -0
  54. package/dist/tools/pollinations/beta_discovery.d.ts +9 -0
  55. package/dist/tools/pollinations/beta_discovery.js +197 -0
  56. package/dist/tools/pollinations/cost-guard.d.ts +38 -0
  57. package/dist/tools/pollinations/cost-guard.js +141 -0
  58. package/dist/tools/pollinations/deepsearch.d.ts +7 -0
  59. package/dist/tools/pollinations/deepsearch.js +80 -0
  60. package/dist/tools/pollinations/gen_audio.d.ts +18 -0
  61. package/dist/tools/pollinations/gen_audio.js +246 -0
  62. package/dist/tools/pollinations/gen_image.d.ts +11 -0
  63. package/dist/tools/pollinations/gen_image.js +225 -0
  64. package/dist/tools/pollinations/gen_music.d.ts +14 -0
  65. package/dist/tools/pollinations/gen_music.js +180 -0
  66. package/dist/tools/pollinations/gen_video.d.ts +16 -0
  67. package/dist/tools/pollinations/gen_video.js +256 -0
  68. package/dist/tools/pollinations/polli_gen_confirm.d.ts +2 -0
  69. package/dist/tools/pollinations/polli_gen_confirm.js +48 -0
  70. package/dist/tools/pollinations/polli_status.d.ts +2 -0
  71. package/dist/tools/pollinations/polli_status.js +31 -0
  72. package/dist/tools/pollinations/polli_web_search.d.ts +15 -0
  73. package/dist/tools/pollinations/polli_web_search.js +164 -0
  74. package/dist/tools/pollinations/search_crawl_scrape.d.ts +7 -0
  75. package/dist/tools/pollinations/search_crawl_scrape.js +85 -0
  76. package/dist/tools/pollinations/shared.d.ts +165 -0
  77. package/dist/tools/pollinations/shared.js +665 -0
  78. package/dist/tools/pollinations/test_estimators.d.ts +1 -0
  79. package/dist/tools/pollinations/test_estimators.js +22 -0
  80. package/dist/tools/pollinations/transcribe_audio.d.ts +13 -0
  81. package/dist/tools/pollinations/transcribe_audio.js +194 -0
  82. package/dist/tools/power/extract_audio.d.ts +2 -0
  83. package/dist/tools/power/extract_audio.js +179 -0
  84. package/dist/tools/power/extract_frames.d.ts +2 -0
  85. package/dist/tools/power/extract_frames.js +237 -0
  86. package/dist/tools/power/file_to_url.d.ts +2 -0
  87. package/dist/tools/power/file_to_url.js +217 -0
  88. package/dist/tools/power/remove_background.d.ts +2 -0
  89. package/dist/tools/power/remove_background.js +366 -0
  90. package/dist/tools/power/rmbg_keys.d.ts +2 -0
  91. package/dist/tools/power/rmbg_keys.js +79 -0
  92. package/dist/tools/shared.d.ts +30 -0
  93. package/dist/tools/shared.js +80 -0
  94. package/package.json +10 -4
  95. package/dist/server/models-seed.d.ts +0 -18
  96. package/dist/server/models-seed.js +0 -55
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Subdirectories for each tool category
3
+ */
4
+ export declare const TOOL_DIRS: {
5
+ readonly qrcodes: "qrcodes";
6
+ readonly diagrams: "diagrams";
7
+ readonly palettes: "palettes";
8
+ readonly rembg: "rembg";
9
+ readonly frames: "frames";
10
+ readonly audio: "audio";
11
+ readonly uploads: "uploads";
12
+ };
13
+ /**
14
+ * Resolve the output directory — uses customPath if provided,
15
+ * otherwise falls back to ~/Downloads/pollinations/{subdir}
16
+ * Works on all OSes (Linux, macOS, Windows).
17
+ */
18
+ export declare function resolveOutputDir(subdir: string, customPath?: string): string;
19
+ /**
20
+ * Format file size for human-readable output
21
+ */
22
+ export declare function formatFileSize(bytes: number): string;
23
+ /**
24
+ * Sanitize a filename — remove special chars, keep it safe
25
+ */
26
+ export declare function safeName(input: string): string;
27
+ /**
28
+ * Format a timestamp for display (human readable)
29
+ */
30
+ export declare function formatTimestamp(seconds: number): string;
@@ -0,0 +1,80 @@
1
+ /**
2
+ * Shared utilities for power tools — file saving, paths, and formatting.
3
+ * All tools use these helpers for consistent behavior.
4
+ */
5
+ import * as fs from 'fs';
6
+ import * as path from 'path';
7
+ import * as os from 'os';
8
+ // ─── Default base directory ──────────────────────────────────────────────────
9
+ const DEFAULT_BASE = path.join(os.homedir(), 'Downloads', 'pollinations');
10
+ /**
11
+ * Subdirectories for each tool category
12
+ */
13
+ export const TOOL_DIRS = {
14
+ qrcodes: 'qrcodes',
15
+ diagrams: 'diagrams',
16
+ palettes: 'palettes',
17
+ rembg: 'rembg',
18
+ frames: 'frames',
19
+ audio: 'audio',
20
+ uploads: 'uploads',
21
+ };
22
+ /**
23
+ * Resolve the output directory — uses customPath if provided,
24
+ * otherwise falls back to ~/Downloads/pollinations/{subdir}
25
+ * Works on all OSes (Linux, macOS, Windows).
26
+ */
27
+ export function resolveOutputDir(subdir, customPath) {
28
+ let dir;
29
+ if (customPath) {
30
+ // If customPath is absolute, use it directly
31
+ // If relative, resolve from cwd
32
+ // Handle tilde ~ manual expansion for cross-platform support
33
+ if (customPath.startsWith('~')) {
34
+ dir = path.join(os.homedir(), customPath.slice(1));
35
+ }
36
+ else {
37
+ dir = path.isAbsolute(customPath)
38
+ ? customPath
39
+ : path.resolve(process.cwd(), customPath);
40
+ }
41
+ }
42
+ else {
43
+ dir = path.join(DEFAULT_BASE, subdir);
44
+ }
45
+ // Ensure directory exists
46
+ if (!fs.existsSync(dir)) {
47
+ fs.mkdirSync(dir, { recursive: true });
48
+ }
49
+ return dir;
50
+ }
51
+ /**
52
+ * Format file size for human-readable output
53
+ */
54
+ export function formatFileSize(bytes) {
55
+ if (bytes < 1024)
56
+ return `${bytes} B`;
57
+ if (bytes < 1024 * 1024)
58
+ return `${(bytes / 1024).toFixed(1)} KB`;
59
+ if (bytes < 1024 * 1024 * 1024)
60
+ return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
61
+ return `${(bytes / (1024 * 1024 * 1024)).toFixed(1)} GB`;
62
+ }
63
+ /**
64
+ * Sanitize a filename — remove special chars, keep it safe
65
+ */
66
+ export function safeName(input) {
67
+ return input.replace(/[^a-zA-Z0-9_.-]/g, '_').replace(/_+/g, '_');
68
+ }
69
+ /**
70
+ * Format a timestamp for display (human readable)
71
+ */
72
+ export function formatTimestamp(seconds) {
73
+ const h = Math.floor(seconds / 3600);
74
+ const m = Math.floor((seconds % 3600) / 60);
75
+ const s = Math.floor(seconds % 60);
76
+ const ms = Math.round((seconds % 1) * 100);
77
+ if (h > 0)
78
+ return `${h}:${String(m).padStart(2, '0')}:${String(s).padStart(2, '0')}`;
79
+ return `${m}:${String(s).padStart(2, '0')}.${String(ms).padStart(2, '0')}`;
80
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "opencode-pollinations-plugin",
3
- "displayName": "Pollinations AI (V5.6)",
4
- "version": "6.1.0-beta.2",
3
+ "displayName": "Pollinations AI (V5.9)",
4
+ "version": "6.1.0-beta.22",
5
5
  "description": "Native Pollinations.ai Provider Plugin for OpenCode",
6
6
  "publisher": "pollinations",
7
7
  "repository": {
@@ -41,6 +41,10 @@
41
41
  {
42
42
  "command": "pollinations.usage",
43
43
  "title": "Pollinations: Show Usage"
44
+ },
45
+ {
46
+ "command": "pollinations.addKey",
47
+ "title": "Pollinations: Add BackgroundCut Key"
44
48
  }
45
49
  ]
46
50
  },
@@ -49,10 +53,12 @@
49
53
  ],
50
54
  "dependencies": {
51
55
  "@opencode-ai/plugin": "^1.0.85",
52
- "zod": "^3.22.4"
56
+ "qrcode": "^1.5.4",
57
+ "zod": "^3.25.76"
53
58
  },
54
59
  "devDependencies": {
55
60
  "@types/node": "^20.0.0",
61
+ "@types/qrcode": "^1.5.6",
56
62
  "typescript": "^5.0.0"
57
63
  }
58
- }
64
+ }
@@ -1,18 +0,0 @@
1
- export interface PollinationsModel {
2
- name: string;
3
- description?: string;
4
- type?: string;
5
- tools?: boolean;
6
- reasoning?: boolean;
7
- context?: number;
8
- context_window?: number;
9
- input_modalities?: string[];
10
- output_modalities?: string[];
11
- paid_only?: boolean;
12
- vision?: boolean;
13
- audio?: boolean;
14
- community?: boolean;
15
- censored?: boolean;
16
- [key: string]: any;
17
- }
18
- export declare const FREE_MODELS_SEED: PollinationsModel[];
@@ -1,55 +0,0 @@
1
- export const FREE_MODELS_SEED = [
2
- {
3
- "name": "gemini",
4
- "description": "Gemini 2.5 Flash Lite",
5
- "tier": "anonymous",
6
- "tools": true,
7
- "input_modalities": ["text", "image"],
8
- "output_modalities": ["text"],
9
- "vision": true
10
- },
11
- {
12
- "name": "mistral",
13
- "description": "Mistral Small 3.2 24B",
14
- "tier": "anonymous",
15
- "tools": true,
16
- "input_modalities": ["text"],
17
- "output_modalities": ["text"],
18
- "vision": false
19
- },
20
- {
21
- "name": "openai-fast",
22
- "description": "GPT-OSS 20B Reasoning LLM (OVH)",
23
- "tier": "anonymous",
24
- "tools": true,
25
- "input_modalities": ["text"],
26
- "output_modalities": ["text"],
27
- "vision": false,
28
- "reasoning": true
29
- },
30
- {
31
- "name": "bidara",
32
- "description": "BIDARA (Biomimetic Designer)",
33
- "tier": "anonymous",
34
- "community": true,
35
- "input_modalities": ["text", "image"],
36
- "output_modalities": ["text"],
37
- "vision": true
38
- },
39
- {
40
- "name": "chickytutor",
41
- "description": "ChickyTutor AI Language Tutor",
42
- "tier": "anonymous",
43
- "community": true,
44
- "input_modalities": ["text"],
45
- "output_modalities": ["text"]
46
- },
47
- {
48
- "name": "midijourney",
49
- "description": "MIDIjourney",
50
- "tier": "anonymous",
51
- "community": true,
52
- "input_modalities": ["text"],
53
- "output_modalities": ["text"]
54
- }
55
- ];