opencode-pollinations-plugin 6.0.0-beta.22 → 6.0.0-beta.23
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 +10 -10
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -176,7 +176,11 @@ export const PollinationsPlugin = async (ctx) => {
|
|
|
176
176
|
const toastHooks = createToastHooks(ctx.client);
|
|
177
177
|
const commandHooks = createCommandHooks();
|
|
178
178
|
// Helper: Refresh provider config (for hot-reload after /connect)
|
|
179
|
+
let isRefreshing = false;
|
|
179
180
|
const refreshProviderConfig = async () => {
|
|
181
|
+
if (isRefreshing)
|
|
182
|
+
return;
|
|
183
|
+
isRefreshing = true;
|
|
180
184
|
try {
|
|
181
185
|
log('[Event] Refreshing provider config after auth update...');
|
|
182
186
|
const modelsArray = await generatePollinationsConfig();
|
|
@@ -208,21 +212,17 @@ export const PollinationsPlugin = async (ctx) => {
|
|
|
208
212
|
catch (e) {
|
|
209
213
|
log(`[Event] Failed to refresh provider config: ${e}`);
|
|
210
214
|
}
|
|
215
|
+
finally {
|
|
216
|
+
// Debounce: prevent another refresh for 5 seconds
|
|
217
|
+
setTimeout(() => { isRefreshing = false; }, 5000);
|
|
218
|
+
}
|
|
211
219
|
};
|
|
212
220
|
return {
|
|
213
221
|
// AUTH HOOK: Native /connect integration
|
|
214
222
|
auth: createAuthHook(),
|
|
215
|
-
// EVENT HOOK: Listen for
|
|
223
|
+
// EVENT HOOK: Listen ONLY for explicit /connect command
|
|
224
|
+
// We removed installation.updated/server.connected because they caused infinite loops
|
|
216
225
|
event: async ({ event }) => {
|
|
217
|
-
// Log only relevant events (auth-related)
|
|
218
|
-
if (event.type === 'installation.updated' ||
|
|
219
|
-
event.type === 'server.connected') {
|
|
220
|
-
log(`[Event] Relevant event: ${event.type}`);
|
|
221
|
-
await refreshProviderConfig();
|
|
222
|
-
}
|
|
223
|
-
// Also watch for tui.command.execute (when user types /connect)
|
|
224
|
-
// Note: This fires at START of /connect, not at completion
|
|
225
|
-
// The AuthHook handles the actual key update
|
|
226
226
|
if (event.type === 'tui.command.execute') {
|
|
227
227
|
const cmd = event.command || event.data?.command;
|
|
228
228
|
if (cmd === 'connect' || cmd === '/connect') {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-pollinations-plugin",
|
|
3
3
|
"displayName": "Pollinations AI (V5.6)",
|
|
4
|
-
"version": "6.0.0-beta.
|
|
4
|
+
"version": "6.0.0-beta.23",
|
|
5
5
|
"description": "Native Pollinations.ai Provider Plugin for OpenCode",
|
|
6
6
|
"publisher": "pollinations",
|
|
7
7
|
"repository": {
|