opencode-pollinations-plugin 5.4.8-debug.2 → 5.4.8-debug.3
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/dist/server/commands.js +25 -0
- package/dist/server/proxy.js +1 -33
- package/package.json +1 -1
package/dist/server/commands.js
CHANGED
|
@@ -89,6 +89,8 @@ export async function handleCommand(command) {
|
|
|
89
89
|
return handleModeCommand(args);
|
|
90
90
|
case 'usage':
|
|
91
91
|
return await handleUsageCommand(args);
|
|
92
|
+
case 'connect':
|
|
93
|
+
return handleConnectCommand(args);
|
|
92
94
|
case 'fallback':
|
|
93
95
|
return handleFallbackCommand(args);
|
|
94
96
|
case 'config':
|
|
@@ -202,6 +204,29 @@ function handleFallbackCommand(args) {
|
|
|
202
204
|
response: `✅ Fallback (Free) configuré: main=${main}, agent=${agent || config.fallbacks.free.agent}`
|
|
203
205
|
};
|
|
204
206
|
}
|
|
207
|
+
function handleConnectCommand(args) {
|
|
208
|
+
const key = args[0];
|
|
209
|
+
if (!key) {
|
|
210
|
+
return {
|
|
211
|
+
handled: true,
|
|
212
|
+
error: `Utilisation: /pollinations connect <sk-xxxx>`
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
if (!key.startsWith('sk-')) {
|
|
216
|
+
return {
|
|
217
|
+
handled: true,
|
|
218
|
+
error: `Clé invalide. Elle doit commencer par 'sk-'.`
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
// Save API Key only (User decides mode manually)
|
|
222
|
+
saveConfig({ apiKey: key });
|
|
223
|
+
// Confirm
|
|
224
|
+
emitStatusToast('success', 'API Key enregistrée', 'Pollinations Config');
|
|
225
|
+
return {
|
|
226
|
+
handled: true,
|
|
227
|
+
response: `✅ API Key connectée. (Utilisez /pollinations mode pro pour l'activer)`
|
|
228
|
+
};
|
|
229
|
+
}
|
|
205
230
|
function handleConfigCommand(args) {
|
|
206
231
|
const [key, value] = args;
|
|
207
232
|
if (!key) {
|
package/dist/server/proxy.js
CHANGED
|
@@ -33,37 +33,6 @@ function saveSignatureMap() {
|
|
|
33
33
|
log(`ERROR: Error mapping signature: ${String(e)}`);
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
|
-
/**
|
|
37
|
-
* DEEP INSPECTION LOGGING (Temporary for v5.5.0 Analysis)
|
|
38
|
-
* Dumps the full payload to a local log file to identify OpenCode agent signatures.
|
|
39
|
-
*/
|
|
40
|
-
function dumpPayload(body) {
|
|
41
|
-
try {
|
|
42
|
-
const logPath = '/home/fkomp/Bureau/oracle/opencode-pollinations-plugin/logs/payload_dump.log';
|
|
43
|
-
if (!fs.existsSync(path.dirname(logPath)))
|
|
44
|
-
fs.mkdirSync(path.dirname(logPath), { recursive: true });
|
|
45
|
-
// Extract interesting bits for quick reading
|
|
46
|
-
const systemPrompt = body.messages?.find((m) => m.role === 'system')?.content || "NONE";
|
|
47
|
-
const inspection = {
|
|
48
|
-
timestamp: new Date().toISOString(),
|
|
49
|
-
captured_fields: {
|
|
50
|
-
model: body.model,
|
|
51
|
-
user: body.user,
|
|
52
|
-
metadata: body.metadata,
|
|
53
|
-
agent: body.agent,
|
|
54
|
-
hasTools: !!(body.tools && body.tools.length > 0),
|
|
55
|
-
toolsCount: body.tools?.length || 0,
|
|
56
|
-
messageCount: body.messages?.length || 0,
|
|
57
|
-
systemPromptSnippet: systemPrompt.substring(0, 300) + "..."
|
|
58
|
-
},
|
|
59
|
-
full_body: body
|
|
60
|
-
};
|
|
61
|
-
fs.appendFileSync(logPath, JSON.stringify(inspection, null, 2) + "\n\n--- END OF REQUEST ---\n\n");
|
|
62
|
-
}
|
|
63
|
-
catch (e) {
|
|
64
|
-
console.error("[DebugLog] Failed to dump payload:", e);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
36
|
// RECURSIVE NORMALIZER for Stable Hashing
|
|
68
37
|
function normalizeContent(c) {
|
|
69
38
|
if (!c)
|
|
@@ -181,7 +150,6 @@ export async function handleChatCompletion(req, res, bodyRaw) {
|
|
|
181
150
|
let authHeader = undefined;
|
|
182
151
|
try {
|
|
183
152
|
const body = JSON.parse(bodyRaw);
|
|
184
|
-
dumpPayload(body); // <--- DEEP INSPECTION
|
|
185
153
|
const config = loadConfig();
|
|
186
154
|
// DEBUG: Trace Config State for Hot Reload verification
|
|
187
155
|
log(`[Proxy Request] Config Loaded. Mode: ${config.mode}, HasKey: ${!!config.apiKey}, KeyLength: ${config.apiKey ? config.apiKey.length : 0}`);
|
|
@@ -316,7 +284,7 @@ export async function handleChatCompletion(req, res, bodyRaw) {
|
|
|
316
284
|
targetUrl = 'https://text.pollinations.ai/openai/chat/completions';
|
|
317
285
|
authHeader = undefined;
|
|
318
286
|
log(`Routing to FREE: ${actualModel} ${isFallbackActive ? '(FALLBACK)' : ''}`);
|
|
319
|
-
emitLogToast('info', `Routing to: FREE UNIVERSE (${actualModel})`, 'Pollinations Routing');
|
|
287
|
+
// emitLogToast('info', `Routing to: FREE UNIVERSE (${actualModel})`, 'Pollinations Routing'); // Too noisy
|
|
320
288
|
}
|
|
321
289
|
// NOTIFY SWITCH
|
|
322
290
|
if (isFallbackActive) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-pollinations-plugin",
|
|
3
3
|
"displayName": "Pollinations AI (V5.1)",
|
|
4
|
-
"version": "5.4.8-debug.
|
|
4
|
+
"version": "5.4.8-debug.3",
|
|
5
5
|
"description": "Native Pollinations.ai Provider Plugin for OpenCode",
|
|
6
6
|
"publisher": "pollinations",
|
|
7
7
|
"repository": {
|