opencode-pollinations-plugin 6.2.7 → 6.4.0

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 (54) hide show
  1. package/README.de.md +9 -1
  2. package/README.es.md +9 -1
  3. package/README.fr.md +9 -1
  4. package/README.it.md +9 -1
  5. package/README.md +35 -16
  6. package/README.zh.md +9 -1
  7. package/dist/index.js +11 -7
  8. package/dist/locales/de.json +97 -7
  9. package/dist/locales/en.json +97 -7
  10. package/dist/locales/es.json +97 -7
  11. package/dist/locales/fr.json +97 -7
  12. package/dist/locales/index.js +3 -1
  13. package/dist/locales/it.json +97 -7
  14. package/dist/locales/zh.json +463 -0
  15. package/dist/server/commands.d.ts +8 -0
  16. package/dist/server/commands.js +272 -14
  17. package/dist/server/connect-response.js +1 -1
  18. package/dist/server/generate-config.js +4 -6
  19. package/dist/server/models/cache.js +1 -1
  20. package/dist/server/models/fetcher.js +24 -2
  21. package/dist/server/quota.js +29 -8
  22. package/dist/server/tier-info.d.ts +9 -4
  23. package/dist/server/tier-info.js +29 -18
  24. package/dist/tools/index.d.ts +2 -1
  25. package/dist/tools/index.js +14 -1
  26. package/dist/tools/pollinations/beta_discovery.d.ts +11 -4
  27. package/dist/tools/pollinations/beta_discovery.js +288 -136
  28. package/dist/tools/pollinations/gen_edit_image_free.d.ts +14 -0
  29. package/dist/tools/pollinations/gen_edit_image_free.js +146 -0
  30. package/dist/tools/pollinations/gen_video.js +2 -2
  31. package/dist/tools/pollinations/gen_video_free.d.ts +19 -0
  32. package/dist/tools/pollinations/gen_video_free.js +246 -0
  33. package/dist/tools/pollinations/polli_config.js +1 -1
  34. package/dist/tools/pollinations/polli_login.d.ts +13 -0
  35. package/dist/tools/pollinations/polli_login.js +30 -0
  36. package/dist/tools/pollinations/polli_quests.d.ts +3 -0
  37. package/dist/tools/pollinations/polli_quests.js +135 -0
  38. package/package.json +2 -2
  39. package/dist/server/index.d.ts +0 -2
  40. package/dist/server/index.js +0 -158
  41. package/dist/server/scripts/test_cost_endpoints.d.ts +0 -1
  42. package/dist/server/scripts/test_cost_endpoints.js +0 -61
  43. package/dist/server/scripts/test_dynamic_pricing.d.ts +0 -1
  44. package/dist/server/scripts/test_dynamic_pricing.js +0 -39
  45. package/dist/server/scripts/test_freetier_audit.d.ts +0 -11
  46. package/dist/server/scripts/test_freetier_audit.js +0 -215
  47. package/dist/server/scripts/test_parallel_cost.d.ts +0 -1
  48. package/dist/server/scripts/test_parallel_cost.js +0 -104
  49. package/dist/tools/pollinations/deepsearch.d.ts +0 -7
  50. package/dist/tools/pollinations/deepsearch.js +0 -80
  51. package/dist/tools/pollinations/search_crawl_scrape.d.ts +0 -7
  52. package/dist/tools/pollinations/search_crawl_scrape.js +0 -85
  53. package/dist/tools/pollinations/test_estimators.d.ts +0 -1
  54. package/dist/tools/pollinations/test_estimators.js +0 -22
@@ -1,80 +0,0 @@
1
- /**
2
- * deepsearch Tool - Deep Research with AI
3
- *
4
- * Uses perplexity-reasoning for in-depth research and analysis
5
- */
6
- import { tool } from '@opencode-ai/plugin/tool';
7
- import { getApiKey, httpsPost, } from './shared.js';
8
- // ─── Tool Definition ──────────────────────────────────────────────────────
9
- export const deepsearchTool = tool({
10
- description: `Perform deep research and analysis on a topic using AI reasoning.
11
-
12
- **Model:** perplexity-reasoning
13
-
14
- This tool provides comprehensive research with:
15
- - Multi-step reasoning
16
- - Source citations
17
- - In-depth analysis
18
- - Fact verification
19
-
20
- **Use for:**
21
- - Complex research questions
22
- - Technical analysis
23
- - Fact-checking
24
- - Comparative studies
25
-
26
- **Cost:** ~0.000002-0.000008 🌻 per token (very affordable)`,
27
- args: {
28
- query: tool.schema.string().describe('Research query or question to investigate'),
29
- depth: tool.schema.enum(['quick', 'standard', 'thorough']).optional()
30
- .describe('Research depth (default: standard)'),
31
- },
32
- async execute(args, context) {
33
- const apiKey = getApiKey();
34
- if (!apiKey) {
35
- return `❌ Deep Search nécessite une clé API Pollinations.
36
- 🔧 Connectez votre clé avec /pollinations connect`;
37
- }
38
- const model = 'perplexity-reasoning';
39
- const depth = args.depth || 'standard';
40
- // Metadata
41
- context.metadata({ title: `🔍 Deep Search: ${args.query.substring(0, 50)}...` });
42
- try {
43
- // Build system prompt based on depth
44
- const systemPrompts = {
45
- quick: 'Provide a concise but thorough answer with key sources. Be efficient.',
46
- standard: 'Provide comprehensive research with analysis, sources, and reasoning steps.',
47
- thorough: 'Provide exhaustive research with multiple perspectives, detailed analysis, all relevant sources, and thorough fact-checking. Consider edge cases and alternative viewpoints.',
48
- };
49
- const { data } = await httpsPost('https://gen.pollinations.ai/v1/chat/completions', {
50
- model: model,
51
- messages: [
52
- { role: 'system', content: systemPrompts[depth] },
53
- { role: 'user', content: args.query },
54
- ],
55
- max_tokens: depth === 'thorough' ? 8000 : depth === 'standard' ? 4000 : 2000,
56
- }, {
57
- 'Authorization': `Bearer ${apiKey}`,
58
- });
59
- const jsonData = JSON.parse(data.toString());
60
- const content = jsonData.choices?.[0]?.message?.content || 'No response';
61
- // Format result
62
- const lines = [
63
- `🔍 Deep Search Results`,
64
- `━━━━━━━━━━━━━━━━━━`,
65
- `Query: ${args.query}`,
66
- `Depth: ${depth}`,
67
- `Model: ${model}`,
68
- ``,
69
- content,
70
- ];
71
- return lines.join('\n');
72
- }
73
- catch (err) {
74
- if (err.message?.includes('402') || err.message?.includes('Payment')) {
75
- return `❌ Crédits insuffisants.`;
76
- }
77
- return `❌ Erreur Deep Search: ${err.message}`;
78
- }
79
- },
80
- });
@@ -1,7 +0,0 @@
1
- /**
2
- * search_crawl_scrape Tool - Web Search and Content Extraction
3
- *
4
- * Uses perplexity-fast for quick web search with sources
5
- */
6
- import { type ToolDefinition } from '@opencode-ai/plugin/tool';
7
- export declare const searchCrawlScrapeTool: ToolDefinition;
@@ -1,85 +0,0 @@
1
- /**
2
- * search_crawl_scrape Tool - Web Search and Content Extraction
3
- *
4
- * Uses perplexity-fast for quick web search with sources
5
- */
6
- import { tool } from '@opencode-ai/plugin/tool';
7
- import { getApiKey, httpsPost, } from './shared.js';
8
- // ─── Tool Definition ──────────────────────────────────────────────────────
9
- export const searchCrawlScrapeTool = tool({
10
- description: `Search the web and extract information quickly.
11
-
12
- **Model:** perplexity-fast
13
-
14
- **Features:**
15
- - Real-time web search
16
- - Source citations
17
- - Quick summaries
18
- - Current information
19
-
20
- **Use for:**
21
- - Quick fact lookups
22
- - Current news/events
23
- - Documentation search
24
- - General web queries
25
-
26
- **Cost:** ~0.000001 🌻 per token (very cheap)`,
27
- args: {
28
- query: tool.schema.string().describe('Search query'),
29
- include_sources: tool.schema.boolean().optional()
30
- .describe('Include source URLs in response (default: true)'),
31
- recency: tool.schema.enum(['any', 'day', 'week', 'month']).optional()
32
- .describe('Filter by recency (default: any)'),
33
- },
34
- async execute(args, context) {
35
- const apiKey = getApiKey();
36
- if (!apiKey) {
37
- return `❌ Web Search nécessite une clé API Pollinations.
38
- 🔧 Connectez votre clé avec /pollinations connect`;
39
- }
40
- const model = 'perplexity-fast';
41
- const includeSources = args.include_sources !== false;
42
- // Build recency hint
43
- const recencyHints = {
44
- any: '',
45
- day: 'Focus on information from the last 24 hours. ',
46
- week: 'Focus on information from the last week. ',
47
- month: 'Focus on information from the last month. ',
48
- };
49
- // Metadata
50
- context.metadata({ title: `🔎 Search: ${args.query.substring(0, 40)}...` });
51
- try {
52
- const systemPrompt = `You are a web search assistant. Provide concise, accurate answers based on web search results.
53
- ${recencyHints[args.recency || 'any']}
54
- ${includeSources ? 'Always include source URLs at the end of your response.' : ''}`;
55
- const { data } = await httpsPost('https://gen.pollinations.ai/v1/chat/completions', {
56
- model: model,
57
- messages: [
58
- { role: 'system', content: systemPrompt },
59
- { role: 'user', content: args.query },
60
- ],
61
- max_tokens: 2000,
62
- }, {
63
- 'Authorization': `Bearer ${apiKey}`,
64
- });
65
- const jsonData = JSON.parse(data.toString());
66
- const content = jsonData.choices?.[0]?.message?.content || 'No results found';
67
- // Format result
68
- const lines = [
69
- `🔎 Web Search Results`,
70
- `━━━━━━━━━━━━━━━━━━`,
71
- `Query: ${args.query}`,
72
- `Model: ${model}`,
73
- ``,
74
- content,
75
- ];
76
- return lines.join('\n');
77
- }
78
- catch (err) {
79
- if (err.message?.includes('402') || err.message?.includes('Payment')) {
80
- return `❌ Crédits insuffisants.`;
81
- }
82
- return `❌ Erreur Web Search: ${err.message}`;
83
- }
84
- },
85
- });
@@ -1 +0,0 @@
1
- export {};
@@ -1,22 +0,0 @@
1
- import { estimateImageCost, estimateVideoCost, estimateTtsCost, per1pollen } from './shared.js';
2
- import { ModelRegistry } from '../../server/models/index.js';
3
- async function testEstimators() {
4
- console.log("Loading models...");
5
- await ModelRegistry.ensureFresh();
6
- const imageTests = ['flux', 'flux-pro', 'turbo'];
7
- console.log("\n=== IMAGE ESTIMATIONS ===");
8
- for (const model of imageTests) {
9
- const cost = estimateImageCost(model);
10
- console.log(`[${model}]: Cost = ${cost}, 1 pollen ≈ ${per1pollen(cost)} images`);
11
- }
12
- const videoTests = ['ltx-2', 'wan', 'veo'];
13
- console.log("\n=== VIDEO ESTIMATIONS (6s) ===");
14
- for (const model of videoTests) {
15
- const cost = estimateVideoCost(model, 6);
16
- console.log(`[${model}]: Cost = ${cost}, 1 pollen ≈ ${per1pollen(cost)} vidéos`);
17
- }
18
- console.log("\n=== TTS ESTIMATIONS (200 chars) ===");
19
- const ttsCost = estimateTtsCost(200);
20
- console.log(`[elevenlabs]: Cost = ${ttsCost}, 1 pollen ≈ ${per1pollen(ttsCost)} generations`);
21
- }
22
- testEstimators();