@cfio/cohort-sync 0.20.0 → 0.22.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
@@ -6,6 +6,9 @@ var __export = (target, all) => {
6
6
 
7
7
  var define_process_env_default = {};
8
8
 
9
+ // index.ts
10
+ import { definePluginEntry } from "openclaw/plugin-sdk/plugin-entry";
11
+
9
12
  // ../../node_modules/.pnpm/@sinclair+typebox@0.34.48/node_modules/@sinclair/typebox/build/esm/type/guard/value.mjs
10
13
  var value_exports = {};
11
14
  __export(value_exports, {
@@ -13423,7 +13426,7 @@ function dumpCtx(ctx) {
13423
13426
  function dumpEvent(event) {
13424
13427
  return dumpCtx(event);
13425
13428
  }
13426
- var PLUGIN_VERSION = true ? "0.20.0" : "unknown";
13429
+ var PLUGIN_VERSION = true ? "0.22.0" : "unknown";
13427
13430
  function resolveGatewayToken(api) {
13428
13431
  const token = api.config?.gateway?.auth?.token;
13429
13432
  return typeof token === "string" ? token : null;
@@ -14281,79 +14284,6 @@ async function invokeSecretsReload(gwClient) {
14281
14284
  };
14282
14285
  }
14283
14286
  }
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
- }
14307
- var ALLOWED_SEND_KINDS = /* @__PURE__ */ new Set([
14308
- "telegram",
14309
- "discord",
14310
- "slack",
14311
- "whatsapp"
14312
- ]);
14313
- var MAX_BODY_LENGTH = 4e3;
14314
- var RECIPIENT_RE = /^[A-Za-z0-9@:_.+\-]{1,128}$/;
14315
- async function invokeSendMessage(params) {
14316
- const channelKind = typeof params.channelKind === "string" ? params.channelKind : "";
14317
- const recipient = typeof params.recipient === "string" ? params.recipient : "";
14318
- const body = typeof params.body === "string" ? params.body : "";
14319
- const agentId = typeof params.agentId === "string" ? params.agentId : "";
14320
- if (!ALLOWED_SEND_KINDS.has(channelKind)) {
14321
- return { ok: false, error: `invalid channel kind: ${channelKind || "(empty)"}` };
14322
- }
14323
- if (!RECIPIENT_RE.test(recipient)) {
14324
- return { ok: false, error: "invalid recipient (must be printable ASCII, \u2264128 chars, no shell metachars)" };
14325
- }
14326
- if (body.length === 0) {
14327
- return { ok: false, error: "body is empty" };
14328
- }
14329
- if (body.length > MAX_BODY_LENGTH) {
14330
- return { ok: false, error: `body too long (${body.length} > ${MAX_BODY_LENGTH})` };
14331
- }
14332
- if (agentId.length === 0 || agentId.length > 64) {
14333
- return { ok: false, error: "agentId must be 1\u201364 chars" };
14334
- }
14335
- if (!/^[A-Za-z0-9_\-]+$/.test(agentId)) {
14336
- return { ok: false, error: "agentId contains invalid characters" };
14337
- }
14338
- return {
14339
- ok: false,
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
- };
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
- }
14357
14287
  function registerGatewayMethods(api, getGatewayClient) {
14358
14288
  api.registerGatewayMethod(
14359
14289
  "cohort-sync/secrets-reload",
@@ -14366,42 +14296,6 @@ function registerGatewayMethods(api, getGatewayClient) {
14366
14296
  // superset).
14367
14297
  { scope: "operator.write" }
14368
14298
  );
14369
- api.registerGatewayMethod(
14370
- "cohort-sync/pairing-approve",
14371
- async ({ respond, params }) => {
14372
- const result = await invokePairingApprove(
14373
- params ?? {}
14374
- );
14375
- respond(true, result);
14376
- },
14377
- // Same scope rationale as secrets-reload — pairing approve is a channel
14378
- // write operation.
14379
- { scope: "operator.write" }
14380
- );
14381
- api.registerGatewayMethod(
14382
- "cohort-sync/send-message",
14383
- async ({ respond, params }) => {
14384
- const result = await invokeSendMessage(
14385
- params ?? {}
14386
- );
14387
- respond(true, result);
14388
- },
14389
- // operator.write — outbound messaging is a mutating operator action,
14390
- // same tier as channel attach/detach.
14391
- { scope: "operator.write" }
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
- );
14405
14299
  }
14406
14300
 
14407
14301
  // src/pocket-guide.ts
@@ -14456,7 +14350,7 @@ function textResult(text, details) {
14456
14350
  return { content: [{ type: "text", text }], details: details ?? void 0 };
14457
14351
  }
14458
14352
  var sharedHookState = null;
14459
- var plugin = {
14353
+ var plugin = definePluginEntry({
14460
14354
  id: "cohort-sync",
14461
14355
  name: "Cohort Sync",
14462
14356
  description: "Syncs agent status and skills to Cohort dashboard",
@@ -14756,7 +14650,7 @@ Do not attempt more comments until tomorrow.`);
14756
14650
  }
14757
14651
  });
14758
14652
  }
14759
- };
14653
+ });
14760
14654
  var index_default = plugin;
14761
14655
  export {
14762
14656
  index_default as default
@@ -55,5 +55,5 @@
55
55
  }
56
56
  }
57
57
  },
58
- "version": "0.20.0"
58
+ "version": "0.22.0"
59
59
  }
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cfio/cohort-sync",
3
- "version": "0.20.0",
3
+ "version": "0.22.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.20.0",
3
+ "version": "0.22.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",