@cfio/cohort-sync 0.3.0 → 0.4.1
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 +128 -37
- package/dist/package.json +1 -1
- package/package.json +5 -3
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.
|
|
2704
|
-
var version = "1.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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);
|
|
@@ -11728,7 +11728,7 @@ async function initSubscription(port, cfg, hooksToken, logger) {
|
|
|
11728
11728
|
}
|
|
11729
11729
|
state.unsubscribers = [...unsubscribers];
|
|
11730
11730
|
}
|
|
11731
|
-
function initCommandSubscription(cfg, logger) {
|
|
11731
|
+
function initCommandSubscription(cfg, logger, resolveAgentName) {
|
|
11732
11732
|
const c = getOrCreateClient();
|
|
11733
11733
|
if (!c) {
|
|
11734
11734
|
logger.warn("cohort-sync: no ConvexClient \u2014 command subscription skipped");
|
|
@@ -11760,7 +11760,8 @@ function initCommandSubscription(cfg, logger) {
|
|
|
11760
11760
|
handleCronCommand(cmd.type, cmd.payload.jobId, logger);
|
|
11761
11761
|
try {
|
|
11762
11762
|
const freshJobs = fetchCronJobs(logger);
|
|
11763
|
-
|
|
11763
|
+
const resolvedJobs = resolveAgentName ? freshJobs.map((j) => ({ ...j, agentId: j.agentId ? resolveAgentName(j.agentId) : j.agentId })) : freshJobs;
|
|
11764
|
+
await pushCronSnapshot(cfg.apiKey, resolvedJobs);
|
|
11764
11765
|
} catch (snapErr) {
|
|
11765
11766
|
logger.warn(`cohort-sync: post-command snapshot push failed: ${String(snapErr)}`);
|
|
11766
11767
|
}
|
|
@@ -12626,6 +12627,53 @@ var AgentStateTracker = class {
|
|
|
12626
12627
|
}
|
|
12627
12628
|
};
|
|
12628
12629
|
|
|
12630
|
+
// src/pocket-guide.ts
|
|
12631
|
+
var POCKET_GUIDE = `# Cohort Agent Guide (Pocket Version)
|
|
12632
|
+
|
|
12633
|
+
> These are the essential rules. For the full guide, see https://docs.cohort.bot/integration/guide
|
|
12634
|
+
|
|
12635
|
+
## Getting Started
|
|
12636
|
+
- Call the cohort_context tool at the start of every work session for your personalized briefing.
|
|
12637
|
+
- If cohort_context is unavailable, call GET /api/v1/context directly.
|
|
12638
|
+
- Do not skip the context call \u2014 it contains workspace-specific overrides that supersede these rules.
|
|
12639
|
+
|
|
12640
|
+
## Task Lifecycle
|
|
12641
|
+
- Create tasks for trackable work items. Always set priority (default p2) and effort when estimable.
|
|
12642
|
+
- Use POST /tasks/:id/transition for status changes. Never PATCH status directly \u2014 the server rejects it.
|
|
12643
|
+
- If a transition is rejected, read the error response for valid transitions from the current status.
|
|
12644
|
+
- You cannot transition tasks to "done" unless your workspace admin has enabled it. Only humans close tasks by default.
|
|
12645
|
+
- When moving to "in_progress", you are claiming ownership \u2014 only claim tasks you can actively work on.
|
|
12646
|
+
- When moving to "waiting", comment what you are blocked on and who/what can unblock you.
|
|
12647
|
+
- When work is complete, comment with evidence: PR link, test output, or summary of changes.
|
|
12648
|
+
|
|
12649
|
+
## Comments
|
|
12650
|
+
- Comment before every status transition explaining what happened.
|
|
12651
|
+
- Post progress updates every 15-30 minutes on long-running work.
|
|
12652
|
+
- Keep comments factual \u2014 what you did, what you found, what is next.
|
|
12653
|
+
- No conversational filler. Every comment must contain information.
|
|
12654
|
+
- Reference specific files, line numbers, error messages, or URLs when relevant.
|
|
12655
|
+
|
|
12656
|
+
## Projects & Initiatives
|
|
12657
|
+
- Don't create projects or initiatives without explicit instruction.
|
|
12658
|
+
- Assign tasks to existing projects when one fits. Don't create a project for a single task.
|
|
12659
|
+
- If no project fits, leave the task unassigned to a project.
|
|
12660
|
+
|
|
12661
|
+
## Error Recovery
|
|
12662
|
+
- If auth fails (401), stop immediately. Do not retry. Report the failure.
|
|
12663
|
+
- If rate limited (429), wait per Retry-After header.
|
|
12664
|
+
- If 404, verify you are using the correct task number or ID (both accepted).
|
|
12665
|
+
- If 500, retry once after a brief pause. If it fails again, stop and report.
|
|
12666
|
+
|
|
12667
|
+
## What Not To Do
|
|
12668
|
+
- Don't poll /tasks in a loop \u2014 check assignments, then do your work.
|
|
12669
|
+
- Don't create duplicate tasks \u2014 search first.
|
|
12670
|
+
- Don't delete tasks unless explicitly told to.
|
|
12671
|
+
- Don't bulk-create tasks speculatively \u2014 create them as work becomes concrete.
|
|
12672
|
+
- Don't modify tasks assigned to other agents unless coordinating through comments.
|
|
12673
|
+
- Don't set "done" on tasks you didn't work on.
|
|
12674
|
+
- Don't ignore workspace-specific overrides from your context response.
|
|
12675
|
+
`;
|
|
12676
|
+
|
|
12629
12677
|
// src/hooks.ts
|
|
12630
12678
|
var BUILD_ID = "B9-ACCOUNTID-20260311";
|
|
12631
12679
|
var DIAG_LOG_PATH = "/tmp/cohort-sync-diag.log";
|
|
@@ -12762,6 +12810,23 @@ function loadSessionsFromDisk(tracker, logger) {
|
|
|
12762
12810
|
} catch {
|
|
12763
12811
|
}
|
|
12764
12812
|
}
|
|
12813
|
+
async function fetchAgentContext(apiKey, apiUrl, logger) {
|
|
12814
|
+
try {
|
|
12815
|
+
const response = await fetch(`${apiUrl}/api/v1/context`, {
|
|
12816
|
+
method: "GET",
|
|
12817
|
+
headers: { "Authorization": `Bearer ${apiKey}` }
|
|
12818
|
+
});
|
|
12819
|
+
if (!response.ok) {
|
|
12820
|
+
logger.warn(`cohort-sync: /context returned ${response.status}, using pocket guide`);
|
|
12821
|
+
return POCKET_GUIDE;
|
|
12822
|
+
}
|
|
12823
|
+
const data = await response.json();
|
|
12824
|
+
return data.briefing || POCKET_GUIDE;
|
|
12825
|
+
} catch (err) {
|
|
12826
|
+
logger.warn(`cohort-sync: /context fetch failed: ${String(err)}, using pocket guide`);
|
|
12827
|
+
return POCKET_GUIDE;
|
|
12828
|
+
}
|
|
12829
|
+
}
|
|
12765
12830
|
function registerHooks(api, cfg) {
|
|
12766
12831
|
const { logger, config } = api;
|
|
12767
12832
|
const nameMap = cfg.agentNameMap;
|
|
@@ -12783,6 +12848,18 @@ function registerHooks(api, cfg) {
|
|
|
12783
12848
|
setLogger(logger);
|
|
12784
12849
|
restoreFromHotReload(logger);
|
|
12785
12850
|
restoreRosterFromHotReload(getRosterHotState(), logger);
|
|
12851
|
+
const identityNameMap = {};
|
|
12852
|
+
const mainIdentity = parseIdentityFile(process.cwd());
|
|
12853
|
+
if (mainIdentity?.name) {
|
|
12854
|
+
identityNameMap["main"] = mainIdentity.name.toLowerCase();
|
|
12855
|
+
}
|
|
12856
|
+
for (const agent of config?.agents?.list ?? []) {
|
|
12857
|
+
const identity = resolveIdentity(agent.identity, agent.workspace);
|
|
12858
|
+
if (identity?.name) {
|
|
12859
|
+
identityNameMap[agent.id] = identity.name.toLowerCase();
|
|
12860
|
+
}
|
|
12861
|
+
}
|
|
12862
|
+
diag("IDENTITY_NAME_MAP", { identityNameMap });
|
|
12786
12863
|
if (tracker.getAgentNames().length === 0) {
|
|
12787
12864
|
loadSessionsFromDisk(tracker, logger);
|
|
12788
12865
|
const restoredAgents = tracker.getAgentNames();
|
|
@@ -12799,7 +12876,7 @@ function registerHooks(api, cfg) {
|
|
|
12799
12876
|
}
|
|
12800
12877
|
}
|
|
12801
12878
|
function resolveAgentName(agentId) {
|
|
12802
|
-
return (nameMap?.[agentId] ?? agentId).toLowerCase();
|
|
12879
|
+
return (nameMap?.[agentId] ?? identityNameMap[agentId] ?? agentId).toLowerCase();
|
|
12803
12880
|
}
|
|
12804
12881
|
function resolveAgentFromContext(ctx) {
|
|
12805
12882
|
const allCtxKeys = Object.keys(ctx);
|
|
@@ -12968,6 +13045,20 @@ Do not attempt to make more comments until ${resetAt}.`
|
|
|
12968
13045
|
}
|
|
12969
13046
|
};
|
|
12970
13047
|
});
|
|
13048
|
+
api.registerTool(() => {
|
|
13049
|
+
return {
|
|
13050
|
+
name: "cohort_context",
|
|
13051
|
+
label: "cohort_context",
|
|
13052
|
+
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.",
|
|
13053
|
+
parameters: Type.Object({}),
|
|
13054
|
+
async execute() {
|
|
13055
|
+
const briefing = await fetchAgentContext(cfg.apiKey, cfg.apiUrl, logger);
|
|
13056
|
+
return {
|
|
13057
|
+
content: [{ type: "text", text: briefing }]
|
|
13058
|
+
};
|
|
13059
|
+
}
|
|
13060
|
+
};
|
|
13061
|
+
});
|
|
12971
13062
|
function resolveModel(agentId) {
|
|
12972
13063
|
const agent = config?.agents?.list?.find((a) => a.id === agentId);
|
|
12973
13064
|
const m = agent?.model;
|
|
@@ -13077,7 +13168,7 @@ Do not attempt to make more comments until ${resetAt}.`
|
|
|
13077
13168
|
).catch((err) => {
|
|
13078
13169
|
logger.error(`cohort-sync: subscription init failed: ${String(err)}`);
|
|
13079
13170
|
});
|
|
13080
|
-
initCommandSubscription(cfg, logger);
|
|
13171
|
+
initCommandSubscription(cfg, logger, resolveAgentName);
|
|
13081
13172
|
const allAgentIds = ["main", ...(config?.agents?.list ?? []).map((a) => a.id)];
|
|
13082
13173
|
for (const agentId of allAgentIds) {
|
|
13083
13174
|
const agentName = resolveAgentName(agentId);
|
package/dist/package.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cfio/cohort-sync",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.1",
|
|
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": [
|
|
44
|
+
"extensions": [
|
|
45
|
+
"./dist/index.js"
|
|
46
|
+
]
|
|
45
47
|
},
|
|
46
48
|
"dependencies": {
|
|
47
49
|
"@sinclair/typebox": "^0.34.0",
|
|
48
|
-
"convex": "^1.
|
|
50
|
+
"convex": "^1.33.0"
|
|
49
51
|
}
|
|
50
52
|
}
|