@occum-net/occumclaw 0.2.1 → 0.2.2
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/index.ts +19 -10
- package/package.json +1 -1
package/index.ts
CHANGED
|
@@ -288,6 +288,11 @@ function createOccumChannelPlugin(logger: PluginLogger) {
|
|
|
288
288
|
// Track processed events to avoid re-dispatch
|
|
289
289
|
const processedEvents = new Set<string>();
|
|
290
290
|
|
|
291
|
+
// Only send the connect greeting once per version (not on every reconnect)
|
|
292
|
+
let greetedVersion: string | null = null;
|
|
293
|
+
// Only notify about a specific update version once
|
|
294
|
+
let notifiedUpdateVersion: string | null = null;
|
|
295
|
+
|
|
291
296
|
const wsClient = new OccumWsClient({
|
|
292
297
|
apiUrl: account.apiUrl,
|
|
293
298
|
agentToken: account.agentToken,
|
|
@@ -305,8 +310,9 @@ function createOccumChannelPlugin(logger: PluginLogger) {
|
|
|
305
310
|
connected: true,
|
|
306
311
|
});
|
|
307
312
|
|
|
308
|
-
// Send a greeting to the control channel
|
|
309
|
-
if (controlChannelId) {
|
|
313
|
+
// Send a greeting to the control channel — only once per version
|
|
314
|
+
if (controlChannelId && greetedVersion !== PLUGIN_VERSION) {
|
|
315
|
+
greetedVersion = PLUGIN_VERSION;
|
|
310
316
|
try {
|
|
311
317
|
await apiRequest(config, `/channels/${controlChannelId}/messages`, {
|
|
312
318
|
method: "POST",
|
|
@@ -318,18 +324,21 @@ function createOccumChannelPlugin(logger: PluginLogger) {
|
|
|
318
324
|
}
|
|
319
325
|
}
|
|
320
326
|
|
|
321
|
-
// Check for updates in the background
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
+
// Check for updates in the background on every reconnect,
|
|
328
|
+
// but only notify the user once per discovered version
|
|
329
|
+
if (controlChannelId) {
|
|
330
|
+
checkLatestVersion().then((latest) => {
|
|
331
|
+
if (!latest || latest === PLUGIN_VERSION) return;
|
|
332
|
+
if (latest === notifiedUpdateVersion) return;
|
|
333
|
+
notifiedUpdateVersion = latest;
|
|
334
|
+
const msg = `Update available: v${PLUGIN_VERSION} → v${latest}. Run:\ncurl -fsSL https://occum.net/update-open-claw.sh | bash`;
|
|
335
|
+
log?.warn?.(msg);
|
|
327
336
|
apiRequest(config, `/channels/${controlChannelId}/messages`, {
|
|
328
337
|
method: "POST",
|
|
329
338
|
body: JSON.stringify({ text: msg }),
|
|
330
339
|
}).catch(() => {});
|
|
331
|
-
}
|
|
332
|
-
}
|
|
340
|
+
});
|
|
341
|
+
}
|
|
333
342
|
},
|
|
334
343
|
|
|
335
344
|
onEvent: (event: OccumEvent) => {
|