@cfio/cohort-sync 0.17.0 → 0.18.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
@@ -13423,7 +13423,7 @@ function dumpCtx(ctx) {
13423
13423
  function dumpEvent(event) {
13424
13424
  return dumpCtx(event);
13425
13425
  }
13426
- var PLUGIN_VERSION = true ? "0.17.0" : "unknown";
13426
+ var PLUGIN_VERSION = true ? "0.18.0" : "unknown";
13427
13427
  function resolveGatewayToken(api) {
13428
13428
  const token = api.config?.gateway?.auth?.token;
13429
13429
  return typeof token === "string" ? token : null;
@@ -14281,6 +14281,29 @@ async function invokeSecretsReload(gwClient) {
14281
14281
  };
14282
14282
  }
14283
14283
  }
14284
+ var ALLOWED_PAIRING_KINDS = /* @__PURE__ */ new Set([
14285
+ "telegram",
14286
+ "discord",
14287
+ "slack",
14288
+ "whatsapp",
14289
+ "signal",
14290
+ "imessage"
14291
+ ]);
14292
+ var PAIRING_CODE_RE = /^[A-Z0-9]{4,16}$/;
14293
+ async function invokePairingApprove(params) {
14294
+ const kind = typeof params.kind === "string" ? params.kind : "";
14295
+ const code2 = typeof params.code === "string" ? params.code : "";
14296
+ if (!ALLOWED_PAIRING_KINDS.has(kind)) {
14297
+ return { ok: false, error: `invalid channel kind: ${kind || "(empty)"}` };
14298
+ }
14299
+ if (!PAIRING_CODE_RE.test(code2)) {
14300
+ return { ok: false, error: "invalid pairing code (expected 4\u201316 uppercase alphanumerics)" };
14301
+ }
14302
+ return {
14303
+ ok: false,
14304
+ error: "pairing-approve via gateway-method is a stub; call openclaw pairing approve via Fly machines exec instead (see convex/cohortChannels.ts:runTelegramPairingApprove)"
14305
+ };
14306
+ }
14284
14307
  function registerGatewayMethods(api, getGatewayClient) {
14285
14308
  api.registerGatewayMethod(
14286
14309
  "cohort-sync/secrets-reload",
@@ -14293,6 +14316,18 @@ function registerGatewayMethods(api, getGatewayClient) {
14293
14316
  // superset).
14294
14317
  { scope: "operator.write" }
14295
14318
  );
14319
+ api.registerGatewayMethod(
14320
+ "cohort-sync/pairing-approve",
14321
+ async ({ respond, params }) => {
14322
+ const result = await invokePairingApprove(
14323
+ params ?? {}
14324
+ );
14325
+ respond(true, result);
14326
+ },
14327
+ // Same scope rationale as secrets-reload — pairing approve is a channel
14328
+ // write operation.
14329
+ { scope: "operator.write" }
14330
+ );
14296
14331
  }
14297
14332
 
14298
14333
  // src/pocket-guide.ts
@@ -55,5 +55,5 @@
55
55
  }
56
56
  }
57
57
  },
58
- "version": "0.17.0"
58
+ "version": "0.18.0"
59
59
  }
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cfio/cohort-sync",
3
- "version": "0.17.0",
3
+ "version": "0.18.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.17.0",
3
+ "version": "0.18.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",