@cfio/cohort-sync 0.2.4 → 0.4.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
@@ -2700,10 +2700,10 @@ var Type = type_exports2;
2700
2700
  // src/sync.ts
2701
2701
  import { execSync } from "node:child_process";
2702
2702
 
2703
- // ../../node_modules/.pnpm/convex@1.32.0_react@19.2.1/node_modules/convex/dist/esm/index.js
2704
- var version = "1.32.0";
2703
+ // ../../node_modules/.pnpm/convex@1.33.0_patch_hash=l43bztwr6e2lbmpd6ao6hmcg24_react@19.2.1/node_modules/convex/dist/esm/index.js
2704
+ var version = "1.33.0";
2705
2705
 
2706
- // ../../node_modules/.pnpm/convex@1.32.0_react@19.2.1/node_modules/convex/dist/esm/values/base64.js
2706
+ // ../../node_modules/.pnpm/convex@1.33.0_patch_hash=l43bztwr6e2lbmpd6ao6hmcg24_react@19.2.1/node_modules/convex/dist/esm/values/base64.js
2707
2707
  var base64_exports = {};
2708
2708
  __export(base64_exports, {
2709
2709
  byteLength: () => byteLength,
@@ -2810,7 +2810,7 @@ function fromByteArrayUrlSafeNoPadding(uint8) {
2810
2810
  return fromByteArray(uint8).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
2811
2811
  }
2812
2812
 
2813
- // ../../node_modules/.pnpm/convex@1.32.0_react@19.2.1/node_modules/convex/dist/esm/common/index.js
2813
+ // ../../node_modules/.pnpm/convex@1.33.0_patch_hash=l43bztwr6e2lbmpd6ao6hmcg24_react@19.2.1/node_modules/convex/dist/esm/common/index.js
2814
2814
  function parseArgs(args) {
2815
2815
  if (args === void 0) {
2816
2816
  return {};
@@ -2860,7 +2860,7 @@ function isSimpleObject(value) {
2860
2860
  return isObject && isSimple;
2861
2861
  }
2862
2862
 
2863
- // ../../node_modules/.pnpm/convex@1.32.0_react@19.2.1/node_modules/convex/dist/esm/values/value.js
2863
+ // ../../node_modules/.pnpm/convex@1.33.0_patch_hash=l43bztwr6e2lbmpd6ao6hmcg24_react@19.2.1/node_modules/convex/dist/esm/values/value.js
2864
2864
  var LITTLE_ENDIAN = true;
2865
2865
  var MIN_INT64 = BigInt("-9223372036854775808");
2866
2866
  var MAX_INT64 = BigInt("9223372036854775807");
@@ -3143,7 +3143,7 @@ function convexToJson(value) {
3143
3143
  return convexToJsonInternal(value, value, "", false);
3144
3144
  }
3145
3145
 
3146
- // ../../node_modules/.pnpm/convex@1.32.0_react@19.2.1/node_modules/convex/dist/esm/values/validators.js
3146
+ // ../../node_modules/.pnpm/convex@1.33.0_patch_hash=l43bztwr6e2lbmpd6ao6hmcg24_react@19.2.1/node_modules/convex/dist/esm/values/validators.js
3147
3147
  var __defProp2 = Object.defineProperty;
3148
3148
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3149
3149
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
@@ -3540,7 +3540,7 @@ var VUnion = class _VUnion extends BaseValidator {
3540
3540
  }
3541
3541
  };
3542
3542
 
3543
- // ../../node_modules/.pnpm/convex@1.32.0_react@19.2.1/node_modules/convex/dist/esm/values/validator.js
3543
+ // ../../node_modules/.pnpm/convex@1.33.0_patch_hash=l43bztwr6e2lbmpd6ao6hmcg24_react@19.2.1/node_modules/convex/dist/esm/values/validator.js
3544
3544
  function isValidator(v2) {
3545
3545
  return !!v2.isConvexValidator;
3546
3546
  }
@@ -3804,7 +3804,7 @@ var v = {
3804
3804
  }
3805
3805
  };
3806
3806
 
3807
- // ../../node_modules/.pnpm/convex@1.32.0_react@19.2.1/node_modules/convex/dist/esm/values/errors.js
3807
+ // ../../node_modules/.pnpm/convex@1.33.0_patch_hash=l43bztwr6e2lbmpd6ao6hmcg24_react@19.2.1/node_modules/convex/dist/esm/values/errors.js
3808
3808
  var __defProp3 = Object.defineProperty;
3809
3809
  var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3810
3810
  var __publicField2 = (obj, key, value) => __defNormalProp2(obj, typeof key !== "symbol" ? key + "" : key, value);
@@ -3821,12 +3821,12 @@ var ConvexError = class extends (_b = Error, _a = IDENTIFYING_FIELD, _b) {
3821
3821
  }
3822
3822
  };
3823
3823
 
3824
- // ../../node_modules/.pnpm/convex@1.32.0_react@19.2.1/node_modules/convex/dist/esm/values/compare_utf8.js
3824
+ // ../../node_modules/.pnpm/convex@1.33.0_patch_hash=l43bztwr6e2lbmpd6ao6hmcg24_react@19.2.1/node_modules/convex/dist/esm/values/compare_utf8.js
3825
3825
  var arr = () => Array.from({ length: 4 }, () => 0);
3826
3826
  var aBytes = arr();
3827
3827
  var bBytes = arr();
3828
3828
 
3829
- // ../../node_modules/.pnpm/convex@1.32.0_react@19.2.1/node_modules/convex/dist/esm/browser/logging.js
3829
+ // ../../node_modules/.pnpm/convex@1.33.0_patch_hash=l43bztwr6e2lbmpd6ao6hmcg24_react@19.2.1/node_modules/convex/dist/esm/browser/logging.js
3830
3830
  var __defProp4 = Object.defineProperty;
3831
3831
  var __defNormalProp3 = (obj, key, value) => key in obj ? __defProp4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3832
3832
  var __publicField3 = (obj, key, value) => __defNormalProp3(obj, typeof key !== "symbol" ? key + "" : key, value);
@@ -3948,7 +3948,7 @@ function forwardData(result, error) {
3948
3948
  return error;
3949
3949
  }
3950
3950
 
3951
- // ../../node_modules/.pnpm/convex@1.32.0_react@19.2.1/node_modules/convex/dist/esm/browser/sync/udf_path_utils.js
3951
+ // ../../node_modules/.pnpm/convex@1.33.0_patch_hash=l43bztwr6e2lbmpd6ao6hmcg24_react@19.2.1/node_modules/convex/dist/esm/browser/sync/udf_path_utils.js
3952
3952
  function canonicalizeUdfPath(udfPath) {
3953
3953
  const pieces = udfPath.split(":");
3954
3954
  let moduleName;
@@ -3985,7 +3985,7 @@ function serializedQueryTokenIsPaginated(token) {
3985
3985
  return JSON.parse(token).type === "paginated";
3986
3986
  }
3987
3987
 
3988
- // ../../node_modules/.pnpm/convex@1.32.0_react@19.2.1/node_modules/convex/dist/esm/browser/sync/local_state.js
3988
+ // ../../node_modules/.pnpm/convex@1.33.0_patch_hash=l43bztwr6e2lbmpd6ao6hmcg24_react@19.2.1/node_modules/convex/dist/esm/browser/sync/local_state.js
3989
3989
  var __defProp5 = Object.defineProperty;
3990
3990
  var __defNormalProp4 = (obj, key, value) => key in obj ? __defProp5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3991
3991
  var __publicField4 = (obj, key, value) => __defNormalProp4(obj, typeof key !== "symbol" ? key + "" : key, value);
@@ -4276,7 +4276,7 @@ var LocalSyncState = class {
4276
4276
  }
4277
4277
  };
4278
4278
 
4279
- // ../../node_modules/.pnpm/convex@1.32.0_react@19.2.1/node_modules/convex/dist/esm/browser/sync/request_manager.js
4279
+ // ../../node_modules/.pnpm/convex@1.33.0_patch_hash=l43bztwr6e2lbmpd6ao6hmcg24_react@19.2.1/node_modules/convex/dist/esm/browser/sync/request_manager.js
4280
4280
  var __defProp6 = Object.defineProperty;
4281
4281
  var __defNormalProp5 = (obj, key, value) => key in obj ? __defProp6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4282
4282
  var __publicField5 = (obj, key, value) => __defNormalProp5(obj, typeof key !== "symbol" ? key + "" : key, value);
@@ -4483,10 +4483,10 @@ var RequestManager = class {
4483
4483
  }
4484
4484
  };
4485
4485
 
4486
- // ../../node_modules/.pnpm/convex@1.32.0_react@19.2.1/node_modules/convex/dist/esm/server/functionName.js
4486
+ // ../../node_modules/.pnpm/convex@1.33.0_patch_hash=l43bztwr6e2lbmpd6ao6hmcg24_react@19.2.1/node_modules/convex/dist/esm/server/functionName.js
4487
4487
  var functionName = Symbol.for("functionName");
4488
4488
 
4489
- // ../../node_modules/.pnpm/convex@1.32.0_react@19.2.1/node_modules/convex/dist/esm/server/components/paths.js
4489
+ // ../../node_modules/.pnpm/convex@1.33.0_patch_hash=l43bztwr6e2lbmpd6ao6hmcg24_react@19.2.1/node_modules/convex/dist/esm/server/components/paths.js
4490
4490
  var toReferencePath = Symbol.for("toReferencePath");
4491
4491
  function extractReferencePath(reference) {
4492
4492
  return reference[toReferencePath] ?? null;
@@ -4514,7 +4514,7 @@ function getFunctionAddress(functionReference) {
4514
4514
  return functionAddress;
4515
4515
  }
4516
4516
 
4517
- // ../../node_modules/.pnpm/convex@1.32.0_react@19.2.1/node_modules/convex/dist/esm/server/api.js
4517
+ // ../../node_modules/.pnpm/convex@1.33.0_patch_hash=l43bztwr6e2lbmpd6ao6hmcg24_react@19.2.1/node_modules/convex/dist/esm/server/api.js
4518
4518
  function getFunctionName(functionReference) {
4519
4519
  const address = getFunctionAddress(functionReference);
4520
4520
  if (address.name === void 0) {
@@ -4572,7 +4572,7 @@ function createApi(pathParts = []) {
4572
4572
  }
4573
4573
  var anyApi = createApi();
4574
4574
 
4575
- // ../../node_modules/.pnpm/convex@1.32.0_react@19.2.1/node_modules/convex/dist/esm/browser/sync/optimistic_updates_impl.js
4575
+ // ../../node_modules/.pnpm/convex@1.33.0_patch_hash=l43bztwr6e2lbmpd6ao6hmcg24_react@19.2.1/node_modules/convex/dist/esm/browser/sync/optimistic_updates_impl.js
4576
4576
  var __defProp7 = Object.defineProperty;
4577
4577
  var __defNormalProp6 = (obj, key, value) => key in obj ? __defProp7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4578
4578
  var __publicField6 = (obj, key, value) => __defNormalProp6(obj, typeof key !== "symbol" ? key + "" : key, value);
@@ -4727,7 +4727,7 @@ var OptimisticQueryResults = class {
4727
4727
  }
4728
4728
  };
4729
4729
 
4730
- // ../../node_modules/.pnpm/convex@1.32.0_react@19.2.1/node_modules/convex/dist/esm/vendor/long.js
4730
+ // ../../node_modules/.pnpm/convex@1.33.0_patch_hash=l43bztwr6e2lbmpd6ao6hmcg24_react@19.2.1/node_modules/convex/dist/esm/vendor/long.js
4731
4731
  var __defProp8 = Object.defineProperty;
4732
4732
  var __defNormalProp7 = (obj, key, value) => key in obj ? __defProp8(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4733
4733
  var __publicField7 = (obj, key, value) => __defNormalProp7(obj, typeof key !== "symbol" ? key + "" : key, value);
@@ -4804,7 +4804,7 @@ var TWO_PWR_32_DBL = TWO_PWR_16_DBL * TWO_PWR_16_DBL;
4804
4804
  var TWO_PWR_64_DBL = TWO_PWR_32_DBL * TWO_PWR_32_DBL;
4805
4805
  var MAX_UNSIGNED_VALUE = new Long(4294967295 | 0, 4294967295 | 0);
4806
4806
 
4807
- // ../../node_modules/.pnpm/convex@1.32.0_react@19.2.1/node_modules/convex/dist/esm/browser/sync/remote_query_set.js
4807
+ // ../../node_modules/.pnpm/convex@1.33.0_patch_hash=l43bztwr6e2lbmpd6ao6hmcg24_react@19.2.1/node_modules/convex/dist/esm/browser/sync/remote_query_set.js
4808
4808
  var __defProp9 = Object.defineProperty;
4809
4809
  var __defNormalProp8 = (obj, key, value) => key in obj ? __defProp9(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4810
4810
  var __publicField8 = (obj, key, value) => __defNormalProp8(obj, typeof key !== "symbol" ? key + "" : key, value);
@@ -4879,7 +4879,7 @@ var RemoteQuerySet = class {
4879
4879
  }
4880
4880
  };
4881
4881
 
4882
- // ../../node_modules/.pnpm/convex@1.32.0_react@19.2.1/node_modules/convex/dist/esm/browser/sync/protocol.js
4882
+ // ../../node_modules/.pnpm/convex@1.33.0_patch_hash=l43bztwr6e2lbmpd6ao6hmcg24_react@19.2.1/node_modules/convex/dist/esm/browser/sync/protocol.js
4883
4883
  function u64ToLong(encoded) {
4884
4884
  const integerBytes = base64_exports.toByteArray(encoded);
4885
4885
  return Long.fromBytesLE(Array.from(integerBytes));
@@ -4949,7 +4949,7 @@ function encodeClientMessage(message) {
4949
4949
  return void 0;
4950
4950
  }
4951
4951
 
4952
- // ../../node_modules/.pnpm/convex@1.32.0_react@19.2.1/node_modules/convex/dist/esm/browser/sync/web_socket_manager.js
4952
+ // ../../node_modules/.pnpm/convex@1.33.0_patch_hash=l43bztwr6e2lbmpd6ao6hmcg24_react@19.2.1/node_modules/convex/dist/esm/browser/sync/web_socket_manager.js
4953
4953
  var __defProp10 = Object.defineProperty;
4954
4954
  var __defNormalProp9 = (obj, key, value) => key in obj ? __defProp10(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4955
4955
  var __publicField9 = (obj, key, value) => __defNormalProp9(obj, typeof key !== "symbol" ? key + "" : key, value);
@@ -5588,7 +5588,7 @@ var WebSocketManager = class {
5588
5588
  }
5589
5589
  };
5590
5590
 
5591
- // ../../node_modules/.pnpm/convex@1.32.0_react@19.2.1/node_modules/convex/dist/esm/browser/sync/session.js
5591
+ // ../../node_modules/.pnpm/convex@1.33.0_patch_hash=l43bztwr6e2lbmpd6ao6hmcg24_react@19.2.1/node_modules/convex/dist/esm/browser/sync/session.js
5592
5592
  function newSessionId() {
5593
5593
  return uuidv4();
5594
5594
  }
@@ -5599,7 +5599,7 @@ function uuidv4() {
5599
5599
  });
5600
5600
  }
5601
5601
 
5602
- // ../../node_modules/.pnpm/convex@1.32.0_react@19.2.1/node_modules/convex/dist/esm/vendor/jwt-decode/index.js
5602
+ // ../../node_modules/.pnpm/convex@1.33.0_patch_hash=l43bztwr6e2lbmpd6ao6hmcg24_react@19.2.1/node_modules/convex/dist/esm/vendor/jwt-decode/index.js
5603
5603
  var InvalidTokenError = class extends Error {
5604
5604
  };
5605
5605
  InvalidTokenError.prototype.name = "InvalidTokenError";
@@ -5663,7 +5663,7 @@ function jwtDecode(token, options) {
5663
5663
  }
5664
5664
  }
5665
5665
 
5666
- // ../../node_modules/.pnpm/convex@1.32.0_react@19.2.1/node_modules/convex/dist/esm/browser/sync/authentication_manager.js
5666
+ // ../../node_modules/.pnpm/convex@1.33.0_patch_hash=l43bztwr6e2lbmpd6ao6hmcg24_react@19.2.1/node_modules/convex/dist/esm/browser/sync/authentication_manager.js
5667
5667
  var __defProp11 = Object.defineProperty;
5668
5668
  var __defNormalProp10 = (obj, key, value) => key in obj ? __defProp11(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
5669
5669
  var __publicField10 = (obj, key, value) => __defNormalProp10(obj, typeof key !== "symbol" ? key + "" : key, value);
@@ -5977,7 +5977,7 @@ var AuthenticationManager = class {
5977
5977
  }
5978
5978
  };
5979
5979
 
5980
- // ../../node_modules/.pnpm/convex@1.32.0_react@19.2.1/node_modules/convex/dist/esm/browser/sync/metrics.js
5980
+ // ../../node_modules/.pnpm/convex@1.33.0_patch_hash=l43bztwr6e2lbmpd6ao6hmcg24_react@19.2.1/node_modules/convex/dist/esm/browser/sync/metrics.js
5981
5981
  var markNames = [
5982
5982
  "convexClientConstructed",
5983
5983
  "convexWebSocketOpen",
@@ -6008,7 +6008,7 @@ function getMarksReport(sessionId) {
6008
6008
  return allMarks.map(performanceMarkToJson);
6009
6009
  }
6010
6010
 
6011
- // ../../node_modules/.pnpm/convex@1.32.0_react@19.2.1/node_modules/convex/dist/esm/browser/sync/client.js
6011
+ // ../../node_modules/.pnpm/convex@1.33.0_patch_hash=l43bztwr6e2lbmpd6ao6hmcg24_react@19.2.1/node_modules/convex/dist/esm/browser/sync/client.js
6012
6012
  var __defProp12 = Object.defineProperty;
6013
6013
  var __defNormalProp11 = (obj, key, value) => key in obj ? __defProp12(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6014
6014
  var __publicField11 = (obj, key, value) => __defNormalProp11(obj, typeof key !== "symbol" ? key + "" : key, value);
@@ -6717,11 +6717,11 @@ var BaseConvexClient = class {
6717
6717
  }
6718
6718
  };
6719
6719
 
6720
- // ../../node_modules/.pnpm/convex@1.32.0_react@19.2.1/node_modules/convex/dist/esm/browser/simple_client-node.js
6720
+ // ../../node_modules/.pnpm/convex@1.33.0_patch_hash=l43bztwr6e2lbmpd6ao6hmcg24_react@19.2.1/node_modules/convex/dist/esm/browser/simple_client-node.js
6721
6721
  import { createRequire } from "module";
6722
6722
  import { resolve as nodePathResolve } from "path";
6723
6723
 
6724
- // ../../node_modules/.pnpm/convex@1.32.0_react@19.2.1/node_modules/convex/dist/esm/browser/sync/pagination.js
6724
+ // ../../node_modules/.pnpm/convex@1.33.0_patch_hash=l43bztwr6e2lbmpd6ao6hmcg24_react@19.2.1/node_modules/convex/dist/esm/browser/sync/pagination.js
6725
6725
  function asPaginationResult(value) {
6726
6726
  if (typeof value !== "object" || value === null || !Array.isArray(value.page) || typeof value.isDone !== "boolean" || typeof value.continueCursor !== "string") {
6727
6727
  throw new Error(`Not a valid paginated query result: ${value?.toString()}`);
@@ -6729,7 +6729,7 @@ function asPaginationResult(value) {
6729
6729
  return value;
6730
6730
  }
6731
6731
 
6732
- // ../../node_modules/.pnpm/convex@1.32.0_react@19.2.1/node_modules/convex/dist/esm/browser/sync/paginated_query_client.js
6732
+ // ../../node_modules/.pnpm/convex@1.33.0_patch_hash=l43bztwr6e2lbmpd6ao6hmcg24_react@19.2.1/node_modules/convex/dist/esm/browser/sync/paginated_query_client.js
6733
6733
  var __defProp13 = Object.defineProperty;
6734
6734
  var __defNormalProp12 = (obj, key, value) => key in obj ? __defProp13(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6735
6735
  var __publicField12 = (obj, key, value) => __defNormalProp12(obj, typeof key !== "symbol" ? key + "" : key, value);
@@ -7085,7 +7085,7 @@ var PaginatedQueryClient = class {
7085
7085
  }
7086
7086
  };
7087
7087
 
7088
- // ../../node_modules/.pnpm/convex@1.32.0_react@19.2.1/node_modules/convex/dist/esm/browser/simple_client.js
7088
+ // ../../node_modules/.pnpm/convex@1.33.0_patch_hash=l43bztwr6e2lbmpd6ao6hmcg24_react@19.2.1/node_modules/convex/dist/esm/browser/simple_client.js
7089
7089
  var __defProp14 = Object.defineProperty;
7090
7090
  var __defNormalProp13 = (obj, key, value) => key in obj ? __defProp14(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7091
7091
  var __publicField13 = (obj, key, value) => __defNormalProp13(obj, typeof key !== "symbol" ? key + "" : key, value);
@@ -7478,7 +7478,7 @@ var ConvexClient = class {
7478
7478
  }
7479
7479
  };
7480
7480
 
7481
- // ../../node_modules/.pnpm/convex@1.32.0_react@19.2.1/node_modules/convex/dist/esm/browser/simple_client-node.js
7481
+ // ../../node_modules/.pnpm/convex@1.33.0_patch_hash=l43bztwr6e2lbmpd6ao6hmcg24_react@19.2.1/node_modules/convex/dist/esm/browser/simple_client-node.js
7482
7482
  var require2 = createRequire(nodePathResolve("."));
7483
7483
  var __create = Object.create;
7484
7484
  var __defProp15 = Object.defineProperty;
@@ -11299,7 +11299,7 @@ var wrapper_default = import_websocket.default;
11299
11299
  var nodeWebSocket = wrapper_default;
11300
11300
  setDefaultWebSocketConstructor(nodeWebSocket);
11301
11301
 
11302
- // ../../node_modules/.pnpm/convex@1.32.0_react@19.2.1/node_modules/convex/dist/esm/server/pagination.js
11302
+ // ../../node_modules/.pnpm/convex@1.33.0_patch_hash=l43bztwr6e2lbmpd6ao6hmcg24_react@19.2.1/node_modules/convex/dist/esm/server/pagination.js
11303
11303
  var paginationOptsValidator = v.object({
11304
11304
  numItems: v.number(),
11305
11305
  cursor: v.union(v.string(), v.null()),
@@ -11309,7 +11309,7 @@ var paginationOptsValidator = v.object({
11309
11309
  maximumBytesRead: v.optional(v.number())
11310
11310
  });
11311
11311
 
11312
- // ../../node_modules/.pnpm/convex@1.32.0_react@19.2.1/node_modules/convex/dist/esm/server/schema.js
11312
+ // ../../node_modules/.pnpm/convex@1.33.0_patch_hash=l43bztwr6e2lbmpd6ao6hmcg24_react@19.2.1/node_modules/convex/dist/esm/server/schema.js
11313
11313
  var __defProp16 = Object.defineProperty;
11314
11314
  var __defNormalProp14 = (obj, key, value) => key in obj ? __defProp16(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
11315
11315
  var __publicField14 = (obj, key, value) => __defNormalProp14(obj, typeof key !== "symbol" ? key + "" : key, value);
@@ -11503,6 +11503,7 @@ var _systemSchema = defineSchema({
11503
11503
  });
11504
11504
 
11505
11505
  // src/subscription.ts
11506
+ import { execFileSync } from "node:child_process";
11506
11507
  function deriveConvexUrl(apiUrl) {
11507
11508
  return apiUrl.replace(/\.convex\.site\/?$/, ".convex.cloud");
11508
11509
  }
@@ -11584,6 +11585,7 @@ var markDeliveredByPlugin = makeFunctionReference("notifications:markDeliveredBy
11584
11585
  var upsertTelemetryFromPlugin = makeFunctionReference("telemetryPlugin:upsertTelemetryFromPlugin");
11585
11586
  var upsertSessionsFromPlugin = makeFunctionReference("telemetryPlugin:upsertSessionsFromPlugin");
11586
11587
  var pushActivityFromPluginRef = makeFunctionReference("activityFeed:pushActivityFromPlugin");
11588
+ var upsertCronSnapshotFromPluginRef = makeFunctionReference("telemetryPlugin:upsertCronSnapshotFromPlugin");
11587
11589
  var getPendingCommandsForPlugin = makeFunctionReference("gatewayCommands:getPendingForPlugin");
11588
11590
  var acknowledgeCommandRef = makeFunctionReference("gatewayCommands:acknowledgeCommand");
11589
11591
  var addCommentFromPluginRef = makeFunctionReference("comments:addCommentFromPlugin");
@@ -11740,23 +11742,38 @@ function initCommandSubscription(cfg, logger) {
11740
11742
  if (processing) return;
11741
11743
  if (commands.length === 0) return;
11742
11744
  processing = true;
11743
- const cmd = commands[commands.length - 1];
11744
- logger.info(`cohort-sync: received gateway command: ${cmd.type} (${cmd._id})`);
11745
- if (cmd.type === "restart") {
11746
- try {
11747
- await c.mutation(acknowledgeCommandRef, {
11748
- commandId: cmd._id,
11749
- apiKey: cfg.apiKey
11750
- });
11751
- logger.info("cohort-sync: restart command acknowledged, terminating in 500ms");
11752
- await new Promise((r) => setTimeout(r, 500));
11753
- process.kill(process.pid, "SIGTERM");
11754
- } catch (err) {
11755
- logger.error(`cohort-sync: failed to process restart command: ${String(err)}`);
11756
- processing = false;
11745
+ try {
11746
+ for (const cmd of commands) {
11747
+ logger.info(`cohort-sync: processing command: ${cmd.type} (${cmd._id})`);
11748
+ try {
11749
+ await c.mutation(acknowledgeCommandRef, {
11750
+ commandId: cmd._id,
11751
+ apiKey: cfg.apiKey
11752
+ });
11753
+ if (cmd.type === "restart") {
11754
+ logger.info("cohort-sync: restart acknowledged, terminating in 500ms");
11755
+ await new Promise((r) => setTimeout(r, 500));
11756
+ process.kill(process.pid, "SIGTERM");
11757
+ return;
11758
+ }
11759
+ if (cmd.type.startsWith("cron") && cmd.payload?.jobId) {
11760
+ handleCronCommand(cmd.type, cmd.payload.jobId, logger);
11761
+ try {
11762
+ const freshJobs = fetchCronJobs(logger);
11763
+ await pushCronSnapshot(cfg.apiKey, freshJobs);
11764
+ } catch (snapErr) {
11765
+ logger.warn(`cohort-sync: post-command snapshot push failed: ${String(snapErr)}`);
11766
+ }
11767
+ } else if (cmd.type.startsWith("cron")) {
11768
+ logger.warn(`cohort-sync: cron command missing jobId: ${cmd.type}`);
11769
+ } else {
11770
+ logger.warn(`cohort-sync: unknown command type: ${cmd.type}`);
11771
+ }
11772
+ } catch (err) {
11773
+ logger.error(`cohort-sync: failed to process command ${cmd._id}: ${String(err)}`);
11774
+ }
11757
11775
  }
11758
- } else {
11759
- logger.warn(`cohort-sync: unknown command type: ${cmd.type}`);
11776
+ } finally {
11760
11777
  processing = false;
11761
11778
  }
11762
11779
  },
@@ -11768,6 +11785,31 @@ function initCommandSubscription(cfg, logger) {
11768
11785
  getHotState().unsubscribers = [...unsubscribers];
11769
11786
  logger.info("cohort-sync: command subscription active");
11770
11787
  }
11788
+ function handleCronCommand(type, jobId, logger) {
11789
+ const subcommandMap = {
11790
+ cronEnable: ["cron", "enable", jobId],
11791
+ cronDisable: ["cron", "disable", jobId],
11792
+ cronRunNow: ["cron", "run", jobId],
11793
+ cronDelete: ["cron", "delete", jobId, "--force"]
11794
+ };
11795
+ const args = subcommandMap[type];
11796
+ if (!args) {
11797
+ logger.warn(`cohort-sync: unknown cron command type: ${type}`);
11798
+ return;
11799
+ }
11800
+ const timeout = type === "cronRunNow" ? 3e4 : 15e3;
11801
+ try {
11802
+ execFileSync("openclaw", args, {
11803
+ encoding: "utf8",
11804
+ timeout,
11805
+ stdio: ["ignore", "pipe", "ignore"]
11806
+ });
11807
+ logger.info(`cohort-sync: cron command ${type} executed for job ${jobId}`);
11808
+ } catch (err) {
11809
+ logger.error(`cohort-sync: cron command ${type} failed for job ${jobId}: ${String(err)}`);
11810
+ throw err;
11811
+ }
11812
+ }
11771
11813
  async function callAddCommentFromPlugin(apiKey, args) {
11772
11814
  const c = getOrCreateClient();
11773
11815
  if (!c) {
@@ -11828,6 +11870,15 @@ async function pushActivity(apiKey, entries) {
11828
11870
  getLogger().error(`cohort-sync: pushActivity failed: ${err}`);
11829
11871
  }
11830
11872
  }
11873
+ async function pushCronSnapshot(apiKey, jobs) {
11874
+ const c = getOrCreateClient();
11875
+ if (!c) return;
11876
+ try {
11877
+ await c.mutation(upsertCronSnapshotFromPluginRef, { apiKey, jobs });
11878
+ } catch (err) {
11879
+ getLogger().error(`cohort-sync: pushCronSnapshot failed: ${err}`);
11880
+ }
11881
+ }
11831
11882
  function saveIntervalsToHot(heartbeat, activityFlush) {
11832
11883
  const state = getHotState();
11833
11884
  state.intervals = { heartbeat, activityFlush };
@@ -11891,6 +11942,44 @@ function fetchSkills(logger) {
11891
11942
  return [];
11892
11943
  }
11893
11944
  }
11945
+ function fetchCronJobs(logger) {
11946
+ try {
11947
+ const raw = execSync("openclaw cron list --all --json", {
11948
+ encoding: "utf8",
11949
+ timeout: 1e4,
11950
+ stdio: ["ignore", "pipe", "ignore"],
11951
+ env: { ...process.env, NO_COLOR: "1" }
11952
+ });
11953
+ const parsed = JSON.parse(extractJson(raw));
11954
+ const list = Array.isArray(parsed) ? parsed : parsed?.jobs ?? [];
11955
+ return list.map((j) => ({
11956
+ id: String(j.jobId ?? j.id ?? "unknown"),
11957
+ text: String(j.name ?? j.text ?? ""),
11958
+ schedule: formatSchedule(j.schedule),
11959
+ ...j.nextRunAt != null ? { nextRun: Number(j.nextRunAt) } : {},
11960
+ ...j.lastRunAt != null ? { lastRun: Number(j.lastRunAt) } : {},
11961
+ ...j.lastStatus ? { lastStatus: String(j.lastStatus) } : {},
11962
+ enabled: j.enabled !== false,
11963
+ ...j.agentId != null ? { agentId: String(j.agentId) } : {}
11964
+ }));
11965
+ } catch (err) {
11966
+ logger.warn(`cohort-sync: failed to fetch cron jobs: ${String(err)}`);
11967
+ return [];
11968
+ }
11969
+ }
11970
+ function formatSchedule(schedule) {
11971
+ if (typeof schedule === "string") return schedule;
11972
+ if (schedule && typeof schedule === "object") {
11973
+ const s = schedule;
11974
+ if (s.kind === "cron" && typeof s.expr === "string") return s.expr;
11975
+ if (s.kind === "interval" && typeof s.everyMs === "number") {
11976
+ const mins = Math.floor(Number(s.everyMs) / 6e4);
11977
+ if (mins > 0) return `*/${mins} * * * *`;
11978
+ return `every ${s.everyMs}ms`;
11979
+ }
11980
+ }
11981
+ return String(schedule);
11982
+ }
11894
11983
  var VALID_STATUSES = /* @__PURE__ */ new Set(["idle", "working", "waiting"]);
11895
11984
  function normalizeStatus(status) {
11896
11985
  return VALID_STATUSES.has(status) ? status : "idle";
@@ -12537,6 +12626,53 @@ var AgentStateTracker = class {
12537
12626
  }
12538
12627
  };
12539
12628
 
12629
+ // src/pocket-guide.ts
12630
+ var POCKET_GUIDE = `# Cohort Agent Guide (Pocket Version)
12631
+
12632
+ > These are the essential rules. For the full guide, see https://docs.cohort.bot/integration/guide
12633
+
12634
+ ## Getting Started
12635
+ - Call the cohort_context tool at the start of every work session for your personalized briefing.
12636
+ - If cohort_context is unavailable, call GET /api/v1/context directly.
12637
+ - Do not skip the context call \u2014 it contains workspace-specific overrides that supersede these rules.
12638
+
12639
+ ## Task Lifecycle
12640
+ - Create tasks for trackable work items. Always set priority (default p2) and effort when estimable.
12641
+ - Use POST /tasks/:id/transition for status changes. Never PATCH status directly \u2014 the server rejects it.
12642
+ - If a transition is rejected, read the error response for valid transitions from the current status.
12643
+ - You cannot transition tasks to "done" unless your workspace admin has enabled it. Only humans close tasks by default.
12644
+ - When moving to "in_progress", you are claiming ownership \u2014 only claim tasks you can actively work on.
12645
+ - When moving to "waiting", comment what you are blocked on and who/what can unblock you.
12646
+ - When work is complete, comment with evidence: PR link, test output, or summary of changes.
12647
+
12648
+ ## Comments
12649
+ - Comment before every status transition explaining what happened.
12650
+ - Post progress updates every 15-30 minutes on long-running work.
12651
+ - Keep comments factual \u2014 what you did, what you found, what is next.
12652
+ - No conversational filler. Every comment must contain information.
12653
+ - Reference specific files, line numbers, error messages, or URLs when relevant.
12654
+
12655
+ ## Projects & Initiatives
12656
+ - Don't create projects or initiatives without explicit instruction.
12657
+ - Assign tasks to existing projects when one fits. Don't create a project for a single task.
12658
+ - If no project fits, leave the task unassigned to a project.
12659
+
12660
+ ## Error Recovery
12661
+ - If auth fails (401), stop immediately. Do not retry. Report the failure.
12662
+ - If rate limited (429), wait per Retry-After header.
12663
+ - If 404, verify you are using the correct task number or ID (both accepted).
12664
+ - If 500, retry once after a brief pause. If it fails again, stop and report.
12665
+
12666
+ ## What Not To Do
12667
+ - Don't poll /tasks in a loop \u2014 check assignments, then do your work.
12668
+ - Don't create duplicate tasks \u2014 search first.
12669
+ - Don't delete tasks unless explicitly told to.
12670
+ - Don't bulk-create tasks speculatively \u2014 create them as work becomes concrete.
12671
+ - Don't modify tasks assigned to other agents unless coordinating through comments.
12672
+ - Don't set "done" on tasks you didn't work on.
12673
+ - Don't ignore workspace-specific overrides from your context response.
12674
+ `;
12675
+
12540
12676
  // src/hooks.ts
12541
12677
  var BUILD_ID = "B9-ACCOUNTID-20260311";
12542
12678
  var DIAG_LOG_PATH = "/tmp/cohort-sync-diag.log";
@@ -12673,6 +12809,23 @@ function loadSessionsFromDisk(tracker, logger) {
12673
12809
  } catch {
12674
12810
  }
12675
12811
  }
12812
+ async function fetchAgentContext(apiKey, apiUrl, logger) {
12813
+ try {
12814
+ const response = await fetch(`${apiUrl}/api/v1/context`, {
12815
+ method: "GET",
12816
+ headers: { "Authorization": `Bearer ${apiKey}` }
12817
+ });
12818
+ if (!response.ok) {
12819
+ logger.warn(`cohort-sync: /context returned ${response.status}, using pocket guide`);
12820
+ return POCKET_GUIDE;
12821
+ }
12822
+ const data = await response.json();
12823
+ return data.briefing || POCKET_GUIDE;
12824
+ } catch (err) {
12825
+ logger.warn(`cohort-sync: /context fetch failed: ${String(err)}, using pocket guide`);
12826
+ return POCKET_GUIDE;
12827
+ }
12828
+ }
12676
12829
  function registerHooks(api, cfg) {
12677
12830
  const { logger, config } = api;
12678
12831
  const nameMap = cfg.agentNameMap;
@@ -12879,6 +13032,20 @@ Do not attempt to make more comments until ${resetAt}.`
12879
13032
  }
12880
13033
  };
12881
13034
  });
13035
+ api.registerTool(() => {
13036
+ return {
13037
+ name: "cohort_context",
13038
+ label: "cohort_context",
13039
+ description: "Get your Cohort session briefing. Call this at the start of every work session to receive your guidelines, current assignments, active projects, and recent team activity.",
13040
+ parameters: Type.Object({}),
13041
+ async execute() {
13042
+ const briefing = await fetchAgentContext(cfg.apiKey, cfg.apiUrl, logger);
13043
+ return {
13044
+ content: [{ type: "text", text: briefing }]
13045
+ };
13046
+ }
13047
+ };
13048
+ });
12882
13049
  function resolveModel(agentId) {
12883
13050
  const agent = config?.agents?.list?.find((a) => a.id === agentId);
12884
13051
  const m = agent?.model;
@@ -12933,6 +13100,16 @@ Do not attempt to make more comments until ${resetAt}.`
12933
13100
  }
12934
13101
  }
12935
13102
  saveSessionsToDisk(tracker);
13103
+ try {
13104
+ const cronJobs2 = fetchCronJobs(logger);
13105
+ const resolvedJobs = cronJobs2.map((job) => ({
13106
+ ...job,
13107
+ agentId: job.agentId ? resolveAgentName(job.agentId) : job.agentId
13108
+ }));
13109
+ await pushCronSnapshot(cfg.apiKey, resolvedJobs);
13110
+ } catch (err) {
13111
+ logger.warn(`cohort-sync: heartbeat cron push failed: ${String(err)}`);
13112
+ }
12936
13113
  logger.info(`cohort-sync: heartbeat pushed for ${allAgentIds.length} agents`);
12937
13114
  }
12938
13115
  async function flushActivityBuffer() {
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cfio/cohort-sync",
3
- "version": "0.2.4",
3
+ "version": "0.4.0",
4
4
  "description": "Syncs agent status and skills to 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.2.4",
3
+ "version": "0.4.0",
4
4
  "description": "Syncs agent status and skills to Cohort dashboard",
5
5
  "license": "MIT",
6
6
  "homepage": "https://docs.cohort.bot/gateway",
@@ -41,10 +41,12 @@
41
41
  "openclaw": ">=0.1.0"
42
42
  },
43
43
  "openclaw": {
44
- "extensions": ["./dist/index.js"]
44
+ "extensions": [
45
+ "./dist/index.js"
46
+ ]
45
47
  },
46
48
  "dependencies": {
47
49
  "@sinclair/typebox": "^0.34.0",
48
- "convex": "^1.32.0"
50
+ "convex": "^1.33.0"
49
51
  }
50
52
  }