@cfio/cohort-sync 0.30.0 → 0.31.0

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 CHANGED
@@ -13559,7 +13559,7 @@ function dumpCtx(ctx) {
13559
13559
  function dumpEvent(event) {
13560
13560
  return dumpCtx(event);
13561
13561
  }
13562
- var PLUGIN_VERSION = true ? "0.30.0" : "unknown";
13562
+ var PLUGIN_VERSION = true ? "0.31.0" : "unknown";
13563
13563
  function resolveGatewayToken(api) {
13564
13564
  const token = api.config?.gateway?.auth?.token;
13565
13565
  return typeof token === "string" ? token : null;
@@ -13713,6 +13713,19 @@ async function handleGatewayStart(event, state) {
13713
13713
  }
13714
13714
  } catch {
13715
13715
  }
13716
+ const UPDATE_CHECK_INTERVAL_MS = 24 * 60 * 60 * 1e3;
13717
+ if (state.updateCheckInterval) clearInterval(state.updateCheckInterval);
13718
+ state.updateCheckInterval = setInterval(async () => {
13719
+ try {
13720
+ const latest = await checkForUpdate(PLUGIN_VERSION, logger);
13721
+ if (latest) state.latestPluginVersion = latest;
13722
+ } catch {
13723
+ }
13724
+ }, UPDATE_CHECK_INTERVAL_MS);
13725
+ if (typeof state.updateCheckInterval.unref === "function") {
13726
+ state.updateCheckInterval.unref();
13727
+ }
13728
+ logger.debug("cohort-sync: update check interval scheduled (24h)");
13716
13729
  try {
13717
13730
  const agentList = (config?.agents?.list ?? []).map((a) => ({
13718
13731
  id: a.id,
@@ -14290,6 +14303,10 @@ function registerHookHandlers(api, logger, getState) {
14290
14303
  clearInterval(state.keepaliveInterval);
14291
14304
  state.keepaliveInterval = null;
14292
14305
  }
14306
+ if (state.updateCheckInterval) {
14307
+ clearInterval(state.updateCheckInterval);
14308
+ state.updateCheckInterval = null;
14309
+ }
14293
14310
  if (state.channelsUnsubscriber) {
14294
14311
  try {
14295
14312
  state.channelsUnsubscriber();
@@ -14450,7 +14467,8 @@ function initializeHookState(api, cfg) {
14450
14467
  commandUnsubscriber: commandUnsub,
14451
14468
  channelsUnsubscriber: null,
14452
14469
  api,
14453
- latestPluginVersion: null
14470
+ latestPluginVersion: null,
14471
+ updateCheckInterval: null
14454
14472
  };
14455
14473
  }
14456
14474
 
@@ -72,5 +72,5 @@
72
72
  }
73
73
  }
74
74
  },
75
- "version": "0.30.0"
75
+ "version": "0.31.0"
76
76
  }
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cfio/cohort-sync",
3
- "version": "0.30.0",
3
+ "version": "0.31.0",
4
4
  "description": "OpenClaw plugin — syncs agent telemetry, sessions, and activity to the Cohort dashboard",
5
5
  "type": "module",
6
6
  "main": "index.js",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cfio/cohort-sync",
3
- "version": "0.30.0",
3
+ "version": "0.31.0",
4
4
  "description": "OpenClaw plugin — syncs agent telemetry, sessions, and activity to the Cohort dashboard",
5
5
  "license": "MIT",
6
6
  "homepage": "https://docs.cohort.bot/gateway",