@cfio/cohort-sync 0.19.0 → 0.20.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.19.0" : "unknown";
13426
+ var PLUGIN_VERSION = true ? "0.20.0" : "unknown";
13427
13427
  function resolveGatewayToken(api) {
13428
13428
  const token = api.config?.gateway?.auth?.token;
13429
13429
  return typeof token === "string" ? token : null;
@@ -14340,6 +14340,20 @@ async function invokeSendMessage(params) {
14340
14340
  error: "send-message via gateway-method is a stub; Convex invokes `openclaw agent --deliver` via Fly machines exec instead (see convex/agentOutbound.ts:_sendOne)"
14341
14341
  };
14342
14342
  }
14343
+ var ACCOUNT_ID_RE = /^[A-Za-z0-9_][A-Za-z0-9_\-]{0,63}$/;
14344
+ async function invokeWhatsappStartPair(params) {
14345
+ const accountId = typeof params.accountId === "string" ? params.accountId : "";
14346
+ if (accountId.length > 0 && !ACCOUNT_ID_RE.test(accountId)) {
14347
+ return {
14348
+ ok: false,
14349
+ error: "invalid accountId (expected 1\u201364 chars starting with [A-Za-z0-9_])"
14350
+ };
14351
+ }
14352
+ return {
14353
+ ok: false,
14354
+ error: "whatsapp-start-pair via gateway-method is a stub; Convex invokes `openclaw channels login --channel whatsapp` via Fly machines exec instead (see convex/cohortChannels.ts:startWhatsAppPairing)"
14355
+ };
14356
+ }
14343
14357
  function registerGatewayMethods(api, getGatewayClient) {
14344
14358
  api.registerGatewayMethod(
14345
14359
  "cohort-sync/secrets-reload",
@@ -14376,6 +14390,18 @@ function registerGatewayMethods(api, getGatewayClient) {
14376
14390
  // same tier as channel attach/detach.
14377
14391
  { scope: "operator.write" }
14378
14392
  );
14393
+ api.registerGatewayMethod(
14394
+ "cohort-sync/whatsapp-start-pair",
14395
+ async ({ respond, params }) => {
14396
+ const result = await invokeWhatsappStartPair(
14397
+ params ?? {}
14398
+ );
14399
+ respond(true, result);
14400
+ },
14401
+ // operator.write — initiating a WhatsApp pair is a channel write surface,
14402
+ // same scope as the other channel pairing methods.
14403
+ { scope: "operator.write" }
14404
+ );
14379
14405
  }
14380
14406
 
14381
14407
  // src/pocket-guide.ts
@@ -55,5 +55,5 @@
55
55
  }
56
56
  }
57
57
  },
58
- "version": "0.19.0"
58
+ "version": "0.20.0"
59
59
  }
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cfio/cohort-sync",
3
- "version": "0.19.0",
3
+ "version": "0.20.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.19.0",
3
+ "version": "0.20.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",