@cfio/cohort-sync 0.11.2 → 0.11.4
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 +16 -11
- package/dist/openclaw.plugin.json +1 -1
- package/dist/package.json +1 -1
- package/package.json +1 -1
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,15 +12045,15 @@ 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
|
|
12049
|
-
const
|
|
12050
|
-
|
|
12051
|
-
|
|
12052
|
-
|
|
12048
|
+
const sourceMap = resolvedNameMap ?? cfg.agentNameMap ?? { main: "main" };
|
|
12049
|
+
const subscriptionTargets = /* @__PURE__ */ new Map();
|
|
12050
|
+
for (const [openclawId, cohortName] of Object.entries(sourceMap)) {
|
|
12051
|
+
subscriptionTargets.set(cohortName, openclawId);
|
|
12052
|
+
if (openclawId !== cohortName) {
|
|
12053
|
+
subscriptionTargets.set(openclawId, openclawId);
|
|
12053
12054
|
}
|
|
12054
12055
|
}
|
|
12055
|
-
for (const agentName of
|
|
12056
|
-
const openclawAgentId = reverseNameMap[agentName] ?? agentName;
|
|
12056
|
+
for (const [agentName, openclawAgentId] of subscriptionTargets) {
|
|
12057
12057
|
logger.info(`cohort-sync: subscribing to notifications for agent "${agentName}" (openclawId: "${openclawAgentId}")`);
|
|
12058
12058
|
let processing = false;
|
|
12059
12059
|
const apiKeyHash = hashApiKey(cfg.apiKey);
|
|
@@ -13334,7 +13334,7 @@ function dumpCtx(ctx) {
|
|
|
13334
13334
|
function dumpEvent(event) {
|
|
13335
13335
|
return dumpCtx(event);
|
|
13336
13336
|
}
|
|
13337
|
-
var PLUGIN_VERSION = true ? "0.11.
|
|
13337
|
+
var PLUGIN_VERSION = true ? "0.11.4" : "unknown";
|
|
13338
13338
|
function resolveGatewayToken(api) {
|
|
13339
13339
|
const token = api.config?.gateway?.auth?.token;
|
|
13340
13340
|
return typeof token === "string" ? token : null;
|
|
@@ -13515,16 +13515,21 @@ async function handleGatewayStart(event, state) {
|
|
|
13515
13515
|
logger.debug("cohort-sync: no gateway token");
|
|
13516
13516
|
logger.warn("cohort-sync: no gateway auth token \u2014 cron operations disabled");
|
|
13517
13517
|
}
|
|
13518
|
+
const allAgentIds = ["main", ...(config?.agents?.list ?? []).map((a) => a.id)];
|
|
13519
|
+
const resolvedNameMap = {};
|
|
13520
|
+
for (const agentId of allAgentIds) {
|
|
13521
|
+
resolvedNameMap[agentId] = state.resolveAgentName(agentId);
|
|
13522
|
+
}
|
|
13518
13523
|
await startNotificationSubscription(
|
|
13519
13524
|
event.port,
|
|
13520
13525
|
cfg,
|
|
13521
13526
|
api.config.hooks?.token,
|
|
13522
13527
|
logger,
|
|
13523
|
-
state.persistentGwClient
|
|
13528
|
+
state.persistentGwClient,
|
|
13529
|
+
resolvedNameMap
|
|
13524
13530
|
).catch((err) => {
|
|
13525
13531
|
logger.error(`cohort-sync: subscription init failed: ${String(err)}`);
|
|
13526
13532
|
});
|
|
13527
|
-
const allAgentIds = ["main", ...(config?.agents?.list ?? []).map((a) => a.id)];
|
|
13528
13533
|
for (const agentId of allAgentIds) {
|
|
13529
13534
|
const agentName = state.resolveAgentName(agentId);
|
|
13530
13535
|
try {
|
package/dist/package.json
CHANGED
package/package.json
CHANGED