opencode-pollinations-plugin 5.1.12 → 5.1.15

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.
@@ -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: number;
28
+ version: string;
29
29
  mode: "manual" | "alwaysfree" | "pro";
30
30
  apiKey?: string;
31
31
  gui: {
@@ -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: 5,
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: 5 };
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
  }
@@ -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.12",
4
+ "version": "5.1.15",
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": {