opencode-pollinations-plugin 6.0.0 → 6.1.0-beta.10

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 (56) hide show
  1. package/README.md +140 -87
  2. package/dist/index.js +33 -154
  3. package/dist/server/commands.d.ts +2 -0
  4. package/dist/server/commands.js +84 -25
  5. package/dist/server/config.d.ts +6 -0
  6. package/dist/server/config.js +4 -1
  7. package/dist/server/generate-config.d.ts +3 -30
  8. package/dist/server/generate-config.js +172 -100
  9. package/dist/server/index.d.ts +2 -1
  10. package/dist/server/index.js +124 -149
  11. package/dist/server/pollinations-api.d.ts +11 -0
  12. package/dist/server/pollinations-api.js +20 -0
  13. package/dist/server/proxy.js +158 -72
  14. package/dist/server/quota.d.ts +8 -0
  15. package/dist/server/quota.js +106 -61
  16. package/dist/server/toast.d.ts +3 -0
  17. package/dist/server/toast.js +16 -0
  18. package/dist/tools/design/gen_diagram.d.ts +2 -0
  19. package/dist/tools/design/gen_diagram.js +94 -0
  20. package/dist/tools/design/gen_palette.d.ts +2 -0
  21. package/dist/tools/design/gen_palette.js +182 -0
  22. package/dist/tools/design/gen_qrcode.d.ts +2 -0
  23. package/dist/tools/design/gen_qrcode.js +50 -0
  24. package/dist/tools/index.d.ts +22 -0
  25. package/dist/tools/index.js +81 -0
  26. package/dist/tools/pollinations/deepsearch.d.ts +7 -0
  27. package/dist/tools/pollinations/deepsearch.js +80 -0
  28. package/dist/tools/pollinations/gen_audio.d.ts +18 -0
  29. package/dist/tools/pollinations/gen_audio.js +204 -0
  30. package/dist/tools/pollinations/gen_image.d.ts +13 -0
  31. package/dist/tools/pollinations/gen_image.js +239 -0
  32. package/dist/tools/pollinations/gen_music.d.ts +14 -0
  33. package/dist/tools/pollinations/gen_music.js +139 -0
  34. package/dist/tools/pollinations/gen_video.d.ts +16 -0
  35. package/dist/tools/pollinations/gen_video.js +222 -0
  36. package/dist/tools/pollinations/search_crawl_scrape.d.ts +7 -0
  37. package/dist/tools/pollinations/search_crawl_scrape.js +85 -0
  38. package/dist/tools/pollinations/shared.d.ts +170 -0
  39. package/dist/tools/pollinations/shared.js +454 -0
  40. package/dist/tools/pollinations/transcribe_audio.d.ts +17 -0
  41. package/dist/tools/pollinations/transcribe_audio.js +235 -0
  42. package/dist/tools/power/extract_audio.d.ts +2 -0
  43. package/dist/tools/power/extract_audio.js +180 -0
  44. package/dist/tools/power/extract_frames.d.ts +2 -0
  45. package/dist/tools/power/extract_frames.js +240 -0
  46. package/dist/tools/power/file_to_url.d.ts +2 -0
  47. package/dist/tools/power/file_to_url.js +217 -0
  48. package/dist/tools/power/remove_background.d.ts +2 -0
  49. package/dist/tools/power/remove_background.js +365 -0
  50. package/dist/tools/power/rmbg_keys.d.ts +2 -0
  51. package/dist/tools/power/rmbg_keys.js +78 -0
  52. package/dist/tools/shared.d.ts +30 -0
  53. package/dist/tools/shared.js +74 -0
  54. package/package.json +9 -3
  55. package/dist/server/models-seed.d.ts +0 -18
  56. 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,74 @@
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
+ dir = path.isAbsolute(customPath)
33
+ ? customPath
34
+ : path.resolve(process.cwd(), customPath);
35
+ }
36
+ else {
37
+ dir = path.join(DEFAULT_BASE, subdir);
38
+ }
39
+ // Ensure directory exists
40
+ if (!fs.existsSync(dir)) {
41
+ fs.mkdirSync(dir, { recursive: true });
42
+ }
43
+ return dir;
44
+ }
45
+ /**
46
+ * Format file size for human-readable output
47
+ */
48
+ export function formatFileSize(bytes) {
49
+ if (bytes < 1024)
50
+ return `${bytes} B`;
51
+ if (bytes < 1024 * 1024)
52
+ return `${(bytes / 1024).toFixed(1)} KB`;
53
+ if (bytes < 1024 * 1024 * 1024)
54
+ return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
55
+ return `${(bytes / (1024 * 1024 * 1024)).toFixed(1)} GB`;
56
+ }
57
+ /**
58
+ * Sanitize a filename — remove special chars, keep it safe
59
+ */
60
+ export function safeName(input) {
61
+ return input.replace(/[^a-zA-Z0-9_.-]/g, '_').replace(/_+/g, '_');
62
+ }
63
+ /**
64
+ * Format a timestamp for display (human readable)
65
+ */
66
+ export function formatTimestamp(seconds) {
67
+ const h = Math.floor(seconds / 3600);
68
+ const m = Math.floor((seconds % 3600) / 60);
69
+ const s = Math.floor(seconds % 60);
70
+ const ms = Math.round((seconds % 1) * 100);
71
+ if (h > 0)
72
+ return `${h}:${String(m).padStart(2, '0')}:${String(s).padStart(2, '0')}`;
73
+ return `${m}:${String(s).padStart(2, '0')}.${String(ms).padStart(2, '0')}`;
74
+ }
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.0.0",
3
+ "displayName": "Pollinations AI (V5.9)",
4
+ "version": "6.1.0-beta.10",
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
- ];