@cfio/cohort-sync 0.11.5 → 0.12.1
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/README.md +2 -2
- package/dist/index.js +19 -13
- package/dist/openclaw.plugin.json +1 -1
- package/dist/package.json +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -46,10 +46,10 @@ Your agent should appear in the Cohort dashboard within seconds.
|
|
|
46
46
|
## Update
|
|
47
47
|
|
|
48
48
|
```bash
|
|
49
|
-
openclaw plugins
|
|
49
|
+
openclaw plugins update cohort-sync
|
|
50
50
|
```
|
|
51
51
|
|
|
52
|
-
|
|
52
|
+
This updates to the latest version. Restart your gateway to pick up changes.
|
|
53
53
|
|
|
54
54
|
## Known limitations (0.10.x)
|
|
55
55
|
|
package/dist/index.js
CHANGED
|
@@ -2670,15 +2670,18 @@ async function checkForUpdate(currentVersion, logger) {
|
|
|
2670
2670
|
const res = await fetch("https://registry.npmjs.org/@cfio/cohort-sync/latest", {
|
|
2671
2671
|
signal: AbortSignal.timeout(5e3)
|
|
2672
2672
|
});
|
|
2673
|
-
if (!res.ok) return;
|
|
2673
|
+
if (!res.ok) return null;
|
|
2674
2674
|
const data = await res.json();
|
|
2675
2675
|
const latest = data.version;
|
|
2676
2676
|
if (latest && latest !== currentVersion && isNewerVersion(latest, currentVersion)) {
|
|
2677
2677
|
logger.warn(
|
|
2678
|
-
`cohort-sync: update available (${currentVersion} \u2192 ${latest}) \u2014 run "openclaw plugins
|
|
2678
|
+
`cohort-sync: update available (${currentVersion} \u2192 ${latest}) \u2014 run "openclaw plugins update cohort-sync" to update`
|
|
2679
2679
|
);
|
|
2680
|
+
return latest;
|
|
2680
2681
|
}
|
|
2682
|
+
return null;
|
|
2681
2683
|
} catch {
|
|
2684
|
+
return null;
|
|
2682
2685
|
}
|
|
2683
2686
|
}
|
|
2684
2687
|
async function syncAgentStatus(agentName, status, model, cfg, logger) {
|
|
@@ -13350,7 +13353,7 @@ function dumpCtx(ctx) {
|
|
|
13350
13353
|
function dumpEvent(event) {
|
|
13351
13354
|
return dumpCtx(event);
|
|
13352
13355
|
}
|
|
13353
|
-
var PLUGIN_VERSION = true ? "0.
|
|
13356
|
+
var PLUGIN_VERSION = true ? "0.12.1" : "unknown";
|
|
13354
13357
|
function resolveGatewayToken(api) {
|
|
13355
13358
|
const token = api.config?.gateway?.auth?.token;
|
|
13356
13359
|
return typeof token === "string" ? token : null;
|
|
@@ -13485,8 +13488,10 @@ async function handleGatewayStart(event, state) {
|
|
|
13485
13488
|
}
|
|
13486
13489
|
const { cfg, tracker, logger, config, api } = state;
|
|
13487
13490
|
try {
|
|
13488
|
-
checkForUpdate(PLUGIN_VERSION, logger)
|
|
13489
|
-
|
|
13491
|
+
const latestVersion = await checkForUpdate(PLUGIN_VERSION, logger);
|
|
13492
|
+
if (latestVersion) {
|
|
13493
|
+
state.latestPluginVersion = latestVersion;
|
|
13494
|
+
}
|
|
13490
13495
|
} catch {
|
|
13491
13496
|
}
|
|
13492
13497
|
try {
|
|
@@ -13554,7 +13559,7 @@ async function handleGatewayStart(event, state) {
|
|
|
13554
13559
|
tracker.updateStatus(agentName, "idle");
|
|
13555
13560
|
const snapshot = tracker.getTelemetrySnapshot(agentName);
|
|
13556
13561
|
if (snapshot) {
|
|
13557
|
-
await pushTelemetry(cfg.apiKey, { ...snapshot, pluginVersion: PLUGIN_VERSION });
|
|
13562
|
+
await pushTelemetry(cfg.apiKey, { ...snapshot, pluginVersion: PLUGIN_VERSION, ...state.latestPluginVersion ? { latestPluginVersion: state.latestPluginVersion } : {} });
|
|
13558
13563
|
tracker.markTelemetryPushed(agentName);
|
|
13559
13564
|
}
|
|
13560
13565
|
} catch (err) {
|
|
@@ -13568,7 +13573,7 @@ async function handleGatewayStart(event, state) {
|
|
|
13568
13573
|
const agentName = state.resolveAgentName(agentId);
|
|
13569
13574
|
const snapshot = tracker.getTelemetrySnapshot(agentName);
|
|
13570
13575
|
if (snapshot) {
|
|
13571
|
-
await pushTelemetry(cfg.apiKey, { ...snapshot, pluginVersion: PLUGIN_VERSION }).catch(() => {
|
|
13576
|
+
await pushTelemetry(cfg.apiKey, { ...snapshot, pluginVersion: PLUGIN_VERSION, ...state.latestPluginVersion ? { latestPluginVersion: state.latestPluginVersion } : {} }).catch(() => {
|
|
13572
13577
|
});
|
|
13573
13578
|
}
|
|
13574
13579
|
}
|
|
@@ -13646,7 +13651,7 @@ function registerHookHandlers(api, logger, getState) {
|
|
|
13646
13651
|
if (tracker.shouldPushTelemetry(agentName)) {
|
|
13647
13652
|
const snapshot = tracker.getTelemetrySnapshot(agentName);
|
|
13648
13653
|
if (snapshot) {
|
|
13649
|
-
await pushTelemetry(cfg.apiKey, { ...snapshot, pluginVersion: PLUGIN_VERSION });
|
|
13654
|
+
await pushTelemetry(cfg.apiKey, { ...snapshot, pluginVersion: PLUGIN_VERSION, ...state.latestPluginVersion ? { latestPluginVersion: state.latestPluginVersion } : {} });
|
|
13650
13655
|
tracker.markTelemetryPushed(agentName);
|
|
13651
13656
|
}
|
|
13652
13657
|
}
|
|
@@ -13705,7 +13710,7 @@ function registerHookHandlers(api, logger, getState) {
|
|
|
13705
13710
|
if (tracker.shouldPushTelemetry(agentName)) {
|
|
13706
13711
|
const snapshot = tracker.getTelemetrySnapshot(agentName);
|
|
13707
13712
|
if (snapshot) {
|
|
13708
|
-
await pushTelemetry(cfg.apiKey, { ...snapshot, pluginVersion: PLUGIN_VERSION });
|
|
13713
|
+
await pushTelemetry(cfg.apiKey, { ...snapshot, pluginVersion: PLUGIN_VERSION, ...state.latestPluginVersion ? { latestPluginVersion: state.latestPluginVersion } : {} });
|
|
13709
13714
|
tracker.markTelemetryPushed(agentName);
|
|
13710
13715
|
}
|
|
13711
13716
|
}
|
|
@@ -13733,7 +13738,7 @@ function registerHookHandlers(api, logger, getState) {
|
|
|
13733
13738
|
if (tracker.shouldPushTelemetry(agentName)) {
|
|
13734
13739
|
const snapshot = tracker.getTelemetrySnapshot(agentName);
|
|
13735
13740
|
if (snapshot) {
|
|
13736
|
-
await pushTelemetry(cfg.apiKey, { ...snapshot, pluginVersion: PLUGIN_VERSION });
|
|
13741
|
+
await pushTelemetry(cfg.apiKey, { ...snapshot, pluginVersion: PLUGIN_VERSION, ...state.latestPluginVersion ? { latestPluginVersion: state.latestPluginVersion } : {} });
|
|
13737
13742
|
tracker.markTelemetryPushed(agentName);
|
|
13738
13743
|
}
|
|
13739
13744
|
}
|
|
@@ -13775,7 +13780,7 @@ function registerHookHandlers(api, logger, getState) {
|
|
|
13775
13780
|
if (tracker.shouldPushTelemetry(agentName)) {
|
|
13776
13781
|
const snapshot = tracker.getTelemetrySnapshot(agentName);
|
|
13777
13782
|
if (snapshot) {
|
|
13778
|
-
await pushTelemetry(cfg.apiKey, { ...snapshot, pluginVersion: PLUGIN_VERSION });
|
|
13783
|
+
await pushTelemetry(cfg.apiKey, { ...snapshot, pluginVersion: PLUGIN_VERSION, ...state.latestPluginVersion ? { latestPluginVersion: state.latestPluginVersion } : {} });
|
|
13779
13784
|
tracker.markTelemetryPushed(agentName);
|
|
13780
13785
|
}
|
|
13781
13786
|
}
|
|
@@ -13979,7 +13984,7 @@ function registerHookHandlers(api, logger, getState) {
|
|
|
13979
13984
|
tracker.updateStatus(agentName, "unreachable");
|
|
13980
13985
|
const snapshot = tracker.getTelemetrySnapshot(agentName);
|
|
13981
13986
|
if (snapshot) {
|
|
13982
|
-
await pushTelemetry(cfg.apiKey, { ...snapshot, pluginVersion: PLUGIN_VERSION });
|
|
13987
|
+
await pushTelemetry(cfg.apiKey, { ...snapshot, pluginVersion: PLUGIN_VERSION, ...state.latestPluginVersion ? { latestPluginVersion: state.latestPluginVersion } : {} });
|
|
13983
13988
|
}
|
|
13984
13989
|
} catch (err) {
|
|
13985
13990
|
log.warn(`cohort-sync: final unreachable push failed for ${agentName}: ${String(err)}`);
|
|
@@ -14111,7 +14116,8 @@ function initializeHookState(api, cfg) {
|
|
|
14111
14116
|
gwClientInitialized,
|
|
14112
14117
|
keepaliveInterval: null,
|
|
14113
14118
|
commandUnsubscriber: commandUnsub,
|
|
14114
|
-
api
|
|
14119
|
+
api,
|
|
14120
|
+
latestPluginVersion: null
|
|
14115
14121
|
};
|
|
14116
14122
|
}
|
|
14117
14123
|
|
package/dist/package.json
CHANGED
package/package.json
CHANGED