opencode-pollinations-plugin 6.2.7 → 6.3.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.
- package/README.de.md +9 -1
- package/README.es.md +9 -1
- package/README.fr.md +9 -1
- package/README.it.md +9 -1
- package/README.md +35 -16
- package/README.zh.md +9 -1
- package/dist/index.js +11 -7
- package/dist/locales/de.json +94 -6
- package/dist/locales/en.json +94 -6
- package/dist/locales/es.json +94 -6
- package/dist/locales/fr.json +94 -6
- package/dist/locales/index.js +3 -1
- package/dist/locales/it.json +94 -6
- package/dist/locales/zh.json +461 -0
- package/dist/server/commands.d.ts +8 -0
- package/dist/server/commands.js +203 -13
- package/dist/server/connect-response.js +1 -1
- package/dist/server/generate-config.js +4 -6
- package/dist/server/models/cache.js +1 -1
- package/dist/server/models/fetcher.js +24 -2
- package/dist/server/quota.js +29 -8
- package/dist/server/tier-info.d.ts +9 -4
- package/dist/server/tier-info.js +29 -18
- package/dist/tools/index.d.ts +2 -1
- package/dist/tools/index.js +14 -1
- package/dist/tools/pollinations/beta_discovery.d.ts +11 -4
- package/dist/tools/pollinations/beta_discovery.js +288 -136
- package/dist/tools/pollinations/gen_edit_image_free.d.ts +14 -0
- package/dist/tools/pollinations/gen_edit_image_free.js +146 -0
- package/dist/tools/pollinations/gen_video.js +2 -2
- package/dist/tools/pollinations/gen_video_free.d.ts +19 -0
- package/dist/tools/pollinations/gen_video_free.js +246 -0
- package/dist/tools/pollinations/polli_config.js +1 -1
- package/dist/tools/pollinations/polli_login.d.ts +13 -0
- package/dist/tools/pollinations/polli_login.js +30 -0
- package/dist/tools/pollinations/polli_quests.d.ts +3 -0
- package/dist/tools/pollinations/polli_quests.js +135 -0
- package/package.json +2 -2
- package/dist/server/index.d.ts +0 -2
- package/dist/server/index.js +0 -158
- package/dist/server/scripts/test_cost_endpoints.d.ts +0 -1
- package/dist/server/scripts/test_cost_endpoints.js +0 -61
- package/dist/server/scripts/test_dynamic_pricing.d.ts +0 -1
- package/dist/server/scripts/test_dynamic_pricing.js +0 -39
- package/dist/server/scripts/test_freetier_audit.d.ts +0 -11
- package/dist/server/scripts/test_freetier_audit.js +0 -215
- package/dist/server/scripts/test_parallel_cost.d.ts +0 -1
- package/dist/server/scripts/test_parallel_cost.js +0 -104
- package/dist/tools/pollinations/deepsearch.d.ts +0 -7
- package/dist/tools/pollinations/deepsearch.js +0 -80
- package/dist/tools/pollinations/search_crawl_scrape.d.ts +0 -7
- package/dist/tools/pollinations/search_crawl_scrape.js +0 -85
- package/dist/tools/pollinations/test_estimators.d.ts +0 -1
- 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,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();
|