opencode-pollinations-plugin 5.1.13 → 5.1.16
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/index.js +9 -2
- package/dist/server/commands.js +24 -0
- package/dist/server/config.d.ts +2 -2
- package/dist/server/config.js +14 -2
- package/dist/server/index.js +2 -0
- package/package.json +2 -1
package/dist/index.js
CHANGED
|
@@ -7,14 +7,21 @@ import { handleChatCompletion } from './server/proxy.js';
|
|
|
7
7
|
import { createToastHooks, setGlobalClient } from './server/toast.js';
|
|
8
8
|
import { createStatusHooks } from './server/status.js';
|
|
9
9
|
import { createCommandHooks } from './server/commands.js';
|
|
10
|
-
const
|
|
10
|
+
const LIFE_LOG = '/tmp/POLLI_LIFECYCLE.log';
|
|
11
|
+
const LOC_LOG = '/tmp/POLLI_LOCATION.log';
|
|
11
12
|
function log(msg) {
|
|
12
13
|
try {
|
|
13
|
-
fs.appendFileSync(
|
|
14
|
+
fs.appendFileSync(LIFE_LOG, `[${new Date().toISOString()}] ${msg}\n`);
|
|
14
15
|
}
|
|
15
16
|
catch (e) { }
|
|
16
17
|
}
|
|
17
18
|
const TRACKING_PORT = 10001;
|
|
19
|
+
// IMMEDIATE PROBE
|
|
20
|
+
try {
|
|
21
|
+
fs.writeFileSync(LOC_LOG, `[${new Date().toISOString()}] ENTRY_POINT_RUNNING: ${__filename}\n`);
|
|
22
|
+
log(`[STARTUP] Initializing Plugin v5.1.16...`);
|
|
23
|
+
}
|
|
24
|
+
catch (e) { }
|
|
18
25
|
// === ANTI-ZOMBIE ATOMIC CLEANUP ===
|
|
19
26
|
try {
|
|
20
27
|
log(`[Init] Checking port ${TRACKING_PORT} for zombies...`);
|
package/dist/server/commands.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import * as fs from 'fs';
|
|
2
|
+
import * as path from 'path';
|
|
1
3
|
import { loadConfig, saveConfig } from './config.js';
|
|
2
4
|
import { getQuotaStatus } from './quota.js';
|
|
3
5
|
import { emitStatusToast } from './toast.js';
|
|
@@ -93,6 +95,8 @@ export async function handleCommand(command) {
|
|
|
93
95
|
return handleFallbackCommand(args);
|
|
94
96
|
case 'config':
|
|
95
97
|
return handleConfigCommand(args);
|
|
98
|
+
case 'debug':
|
|
99
|
+
return handleDebugCommand();
|
|
96
100
|
case 'help':
|
|
97
101
|
return handleHelpCommand();
|
|
98
102
|
default:
|
|
@@ -267,6 +271,26 @@ function handleConfigCommand(args) {
|
|
|
267
271
|
error: `Clé inconnue: ${key}. Clés: status_gui, logs_gui, threshold_tier, threshold_wallet, status_bar`
|
|
268
272
|
};
|
|
269
273
|
}
|
|
274
|
+
function handleDebugCommand() {
|
|
275
|
+
const info = {
|
|
276
|
+
pid: process.pid,
|
|
277
|
+
execPath: process.execPath,
|
|
278
|
+
cwd: process.cwd(),
|
|
279
|
+
home: process.env.HOME || 'undefined',
|
|
280
|
+
node: process.version,
|
|
281
|
+
uid: process.getuid ? process.getuid() : 'unknown',
|
|
282
|
+
gid: process.getgid ? process.getgid() : 'unknown',
|
|
283
|
+
tmp: '/tmp',
|
|
284
|
+
port_env: process.env.POLLINATIONS_PORT || 'default(10001)',
|
|
285
|
+
log_file_check: fs.existsSync(path.join(process.env.HOME || '', '.config/opencode/plugins/pollinations-v3.log')),
|
|
286
|
+
tmp_log_check: fs.existsSync('/tmp/POLLI_LIFECYCLE.log')
|
|
287
|
+
};
|
|
288
|
+
return {
|
|
289
|
+
handled: true,
|
|
290
|
+
response: `### 🐞 Debug Probe v5.1.16\n` +
|
|
291
|
+
`\`\`\`json\n${JSON.stringify(info, null, 2)}\n\`\`\``
|
|
292
|
+
};
|
|
293
|
+
}
|
|
270
294
|
function handleHelpCommand() {
|
|
271
295
|
const help = `
|
|
272
296
|
### 🌸 Pollinations Plugin - Commandes V5
|
package/dist/server/config.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export interface PollinationsConfigV5 {
|
|
2
|
-
version: number;
|
|
2
|
+
version: string | number;
|
|
3
3
|
mode: 'manual' | 'alwaysfree' | 'pro';
|
|
4
4
|
apiKey?: string;
|
|
5
5
|
gui: {
|
|
@@ -25,7 +25,7 @@ export interface PollinationsConfigV5 {
|
|
|
25
25
|
export declare function subscribeToConfigChange(callback: () => void): void;
|
|
26
26
|
export declare function loadConfig(): PollinationsConfigV5;
|
|
27
27
|
export declare function saveConfig(updates: Partial<PollinationsConfigV5>): {
|
|
28
|
-
version:
|
|
28
|
+
version: string;
|
|
29
29
|
mode: "manual" | "alwaysfree" | "pro";
|
|
30
30
|
apiKey?: string;
|
|
31
31
|
gui: {
|
package/dist/server/config.js
CHANGED
|
@@ -8,8 +8,18 @@ const CONFIG_FILE = path.join(CONFIG_DIR_POLLI, 'config.json');
|
|
|
8
8
|
const CONFIG_DIR_OPENCODE = path.join(HOMEDIR, '.config', 'opencode');
|
|
9
9
|
const OPENCODE_CONFIG_FILE = path.join(CONFIG_DIR_OPENCODE, 'opencode.json');
|
|
10
10
|
const AUTH_FILE = path.join(HOMEDIR, '.local', 'share', 'opencode', 'auth.json');
|
|
11
|
+
// LOAD PACKAGE VERSION
|
|
12
|
+
let PKG_VERSION = '5.0.0';
|
|
13
|
+
try {
|
|
14
|
+
const pkgPath = path.join(__dirname, '../../package.json');
|
|
15
|
+
if (fs.existsSync(pkgPath)) {
|
|
16
|
+
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf-8'));
|
|
17
|
+
PKG_VERSION = pkg.version;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
catch (e) { }
|
|
11
21
|
const DEFAULT_CONFIG_V5 = {
|
|
12
|
-
version:
|
|
22
|
+
version: PKG_VERSION,
|
|
13
23
|
mode: 'manual',
|
|
14
24
|
gui: {
|
|
15
25
|
status: 'alert',
|
|
@@ -162,13 +172,15 @@ function readConfigFromDisk() {
|
|
|
162
172
|
if (!keyFound && config.mode === 'pro') {
|
|
163
173
|
config.mode = 'manual';
|
|
164
174
|
}
|
|
175
|
+
// CRITICAL: Always enforce the runtime version, never trust the file cache for versioning
|
|
176
|
+
config.version = PKG_VERSION;
|
|
165
177
|
return config;
|
|
166
178
|
}
|
|
167
179
|
export function saveConfig(updates) {
|
|
168
180
|
try {
|
|
169
181
|
// We must base updates on current state (even if cached is slightly old, we refresh first?)
|
|
170
182
|
const current = readConfigFromDisk(); // Read disk for safety before write
|
|
171
|
-
const updated = { ...current, ...updates, version:
|
|
183
|
+
const updated = { ...current, ...updates, version: PKG_VERSION };
|
|
172
184
|
if (!fs.existsSync(CONFIG_DIR_POLLI)) {
|
|
173
185
|
fs.mkdirSync(CONFIG_DIR_POLLI, { recursive: true });
|
|
174
186
|
}
|
package/dist/server/index.js
CHANGED
|
@@ -142,8 +142,10 @@ try {
|
|
|
142
142
|
catch (e) { }
|
|
143
143
|
// LIFECYCLE DEBUG (Sync Write)
|
|
144
144
|
const LIFE_LOG = '/tmp/POLLI_LIFECYCLE.log';
|
|
145
|
+
const LOC_LOG = '/tmp/POLLI_LOCATION.log'; // NEW: Track source location
|
|
145
146
|
try {
|
|
146
147
|
fs.appendFileSync(LIFE_LOG, `[${new Date().toISOString()}] [STARTUP] PID:${process.pid} Initializing...\n`);
|
|
148
|
+
fs.writeFileSync(LOC_LOG, `[${new Date().toISOString()}] RUNNING FROM: ${__filename}\n`);
|
|
147
149
|
}
|
|
148
150
|
catch (e) { }
|
|
149
151
|
process.on('exit', (code) => {
|
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.1.
|
|
4
|
+
"version": "5.1.16",
|
|
5
5
|
"description": "Native Pollinations.ai Provider Plugin for OpenCode",
|
|
6
6
|
"publisher": "pollinations",
|
|
7
7
|
"repository": {
|
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
],
|
|
29
29
|
"scripts": {
|
|
30
30
|
"build": "tsc",
|
|
31
|
+
"prepare": "npm run build",
|
|
31
32
|
"package": "npx vsce package"
|
|
32
33
|
},
|
|
33
34
|
"contributes": {
|