@cfio/cohort-sync 0.11.2 → 0.11.3

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
@@ -12034,7 +12034,7 @@ async function injectNotification(port, hooksToken, n, agentId = "main") {
12034
12034
  }
12035
12035
  var deliveryFailures = /* @__PURE__ */ new Map();
12036
12036
  var MAX_DELIVERY_ATTEMPTS = 3;
12037
- async function startNotificationSubscription(port, cfg, hooksToken, logger, gwClient) {
12037
+ async function startNotificationSubscription(port, cfg, hooksToken, logger, gwClient, resolvedNameMap) {
12038
12038
  const c = getClient();
12039
12039
  if (!c) {
12040
12040
  logger.warn("cohort-sync: no ConvexClient \u2014 notification subscription skipped");
@@ -12045,13 +12045,12 @@ async function startNotificationSubscription(port, cfg, hooksToken, logger, gwCl
12045
12045
  `cohort-sync: hooks.token not configured \u2014 real-time notifications disabled (telemetry will still be pushed).`
12046
12046
  );
12047
12047
  }
12048
- const agentNames = cfg.agentNameMap ? Object.values(cfg.agentNameMap) : ["main"];
12048
+ const sourceMap = resolvedNameMap ?? cfg.agentNameMap ?? { main: "main" };
12049
12049
  const reverseNameMap = {};
12050
- if (cfg.agentNameMap) {
12051
- for (const [openclawId, cohortName] of Object.entries(cfg.agentNameMap)) {
12052
- reverseNameMap[cohortName] = openclawId;
12053
- }
12050
+ for (const [openclawId, cohortName] of Object.entries(sourceMap)) {
12051
+ reverseNameMap[cohortName] = openclawId;
12054
12052
  }
12053
+ const agentNames = Array.from(new Set(Object.values(sourceMap)));
12055
12054
  for (const agentName of agentNames) {
12056
12055
  const openclawAgentId = reverseNameMap[agentName] ?? agentName;
12057
12056
  logger.info(`cohort-sync: subscribing to notifications for agent "${agentName}" (openclawId: "${openclawAgentId}")`);
@@ -13334,7 +13333,7 @@ function dumpCtx(ctx) {
13334
13333
  function dumpEvent(event) {
13335
13334
  return dumpCtx(event);
13336
13335
  }
13337
- var PLUGIN_VERSION = true ? "0.11.2" : "unknown";
13336
+ var PLUGIN_VERSION = true ? "0.11.3" : "unknown";
13338
13337
  function resolveGatewayToken(api) {
13339
13338
  const token = api.config?.gateway?.auth?.token;
13340
13339
  return typeof token === "string" ? token : null;
@@ -13515,16 +13514,21 @@ async function handleGatewayStart(event, state) {
13515
13514
  logger.debug("cohort-sync: no gateway token");
13516
13515
  logger.warn("cohort-sync: no gateway auth token \u2014 cron operations disabled");
13517
13516
  }
13517
+ const allAgentIds = ["main", ...(config?.agents?.list ?? []).map((a) => a.id)];
13518
+ const resolvedNameMap = {};
13519
+ for (const agentId of allAgentIds) {
13520
+ resolvedNameMap[agentId] = state.resolveAgentName(agentId);
13521
+ }
13518
13522
  await startNotificationSubscription(
13519
13523
  event.port,
13520
13524
  cfg,
13521
13525
  api.config.hooks?.token,
13522
13526
  logger,
13523
- state.persistentGwClient
13527
+ state.persistentGwClient,
13528
+ resolvedNameMap
13524
13529
  ).catch((err) => {
13525
13530
  logger.error(`cohort-sync: subscription init failed: ${String(err)}`);
13526
13531
  });
13527
- const allAgentIds = ["main", ...(config?.agents?.list ?? []).map((a) => a.id)];
13528
13532
  for (const agentId of allAgentIds) {
13529
13533
  const agentName = state.resolveAgentName(agentId);
13530
13534
  try {
@@ -55,5 +55,5 @@
55
55
  }
56
56
  }
57
57
  },
58
- "version": "0.11.2"
58
+ "version": "0.11.3"
59
59
  }
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cfio/cohort-sync",
3
- "version": "0.11.2",
3
+ "version": "0.11.3",
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.11.2",
3
+ "version": "0.11.3",
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",